Author: Silver Shadow (aka Zagor)
Date: 14 February 2009
Version: 1.0
Project: XDCS
Calcs: 83+/84+/SE
OS: No restriction
System requirements: the latest version of xLIB needs to be installed on the calc

------Introduction------

XDCS is a BASIC lib to make DoorsCS-style GUI available even in BASIC programs with minimal use of Pics. It uses the power of xLIB to do all the graphics and is pretty quick to do it too. Therefore, to make it more simple, the syntax used for XDCS is similar to that of xLIB.
There are currently 3 functions in XDCS, but I might add more in the future.

---Note:---
A demo of the functions of XDCS is included as the DEMOXDCS program, but you need to send Pic1 on the calc for it to work.

----- XDCS functions -----
You can use the xLIB runprog function to let the XDCS program stay in Arc. For further details, consult the xLIB readme.
-----------
|1.Windows|
-----------
This function draws a window of any size on the screen.

:{1,X1,Y1,X2,Y2,Pic #,Xicon,Yicon,close button-->L1
:"Text-->String0
:prgmXDCS

X1: X of top left corner
Y1: Y of top left corner
X2: X of bottom right corner
Y2: Y of bottom right corner
Pic #: # of Pic where the icon appearing in the top left corner is stored
--Note: the icon (5x5) is XORed so you'll have to store it in negative--
Xicon: X of the icon in the Pic (in bytes)
Yicon: Y of the icon (in pixels)
close button: makes the cross appear in the top right corner - 0 if disabled, any other number if enabled
"Text: text appearing in the top bar

-----------
|2.Buttons|
-----------
This function draws a button of any length on the screen.

{2,X,Y,L-->L1
"Text-->String0
:prgmXDCS

X: X of top left corner
Y: Y of top left corner
L: lenght of the button
"Text: the text that appears in the button

---------
|3.Mouse|
---------
Probably the most useful function.
XDCS takes everything in charge: all your program has to do is wait until XDCS detects a pressed button and outputs the corresponding mouse coordinates and key code.

{3,X,Y,Picmouse,Xmouse,Ymouse,Picmask,Xmask,Ymask,mouse speed,Picsave-->L1
:prgmXDCS

X: starting X of the mouse
Y: starting Y of the mouse
Picmouse: Pic where the mouse sprite is located
Xmouse: X of the sprite in the Pic
Ymouse: Y of the sprite in the Pic
Picmask: Pic where the mask of the mouse is located (this allows for transparent and white pixels in the mouse)
Xmask: X of the mask in Pic
Ymask: Y of the mask in Pic
mouse speed: the number of pixels the mouse scrolls each time it detects a direction key is pressed
--Note: 4 or 5 pixels is recommended for a 83+ to have an optimal speed and precision
Picsave: Pic where the screen before the mouse appears is saved (this allows for the mouse to disappear and return to the original screen)
--Note: Because a Pic is used for storing the screen, the bottom line is erased.--

----This function outputs:-----
{X,Y,K   in L2

X: X of mouse at keypress
Y: Y of mouse at keypress
K: keycode (for the the complete keycode index, see the xLIB readme)


----NOTES:----
The mouse is able to move diagonally and is prevented to go out of the screen by a built-in routine so that you don't have to worry about that.