SDLengine functions list
_______________________________________________________________________________________________
initialize				: Start the engine and set the default parameter
terminate				: Stop the engine and reset parameter

_________________________________________________________________________________________________________________________
Screen

setdefaults(w,h,bpp,m)			: open the display, perform initializations on cursor and fonts and sets default values on sprites, bobs and screens system.
setdisplay(w,h,bpp,m)		 	: open the screen/window in double buffer. 0=screen|1=window|2=resizable
setcaption(title)			: change the display window title
caption()				: return the display window title
displaywidth				: return the display width
displayheight				: return the display height
displaybpp				: return the display color depth

screen(n)				: set the logic screen n  with n=-1 return the current screen
screenz(n,z)				: set the zorder position of screen if z =-1 report actual z position
lastscreen				: return the last screen open
directscreen 				: direct drawing on display like a screen(more fast but sprite and offset does not works)
screenopen(n,w,h,dx,dy,dw,dh,flag)	: open the logic screen n of dimension w,h in display coordinates dx,dy,dw,dh
screenclose(n)				: close the logic screen n

screenclone(n,s,x,y,w,h,flag)		: create a  new viewport in logic screen s
screencopy(n,x,y,w,h,nd,xd,yd)          : copy a portion of screen n in a screen nd
screenfade(n,t)				: fade the screen n in t time
screenfadein(n,i,t)			: fade the screen n to image i in t time
screencrossfade(n,i,t)			: fade the screen n from current screen  to image i in t time
screenalpha(n,a)			: set alpha(trasparency) of screen n
screenlock(n)				: lock the  screen n for direct graphics access
screenunlock(n)				: unlock the  screen n for direct graphics access

screenrect(x,y,w,h,flag)		: change the display output coordinates of the current screen
xscreenrect				: return the x coordinate of current screen viewport
yscreenrect				: return the y coordinate of current screen viewport
wscreenrect				: return the w value of current screen viewport
hscreenrect				: return the h value of current screen viewport
flagscreenrect				: return the flag value of current screen viewport

screenwidth				: return the current screen width
screenheight				: return the current screen height

offset(x,y)				: set the logical current screen position
xoffset					: return the x coordinate offset in current screen
yoffset					: return the y coordinate offset in current screen

cls 					: clear the current logic screen

screenswap				: update display,bobsystem,spritesystem
autoback(m)				: enable / disable automatic screenswap  m=0 disable m>0 wait m milliseconds and perform screenswap m<0 perform the invocate in code screenswap after m milliseconds
dualplayfield(m)			: set/unset automatic update of a screen upper sprite -1 return state
waitvbl					: wait automatic screenswap
fps(n)					: set/unset or return (with -1) the current frame rate counter (0/1/-1)

_________________________________________________________________________________________________________________________
Graphics

rgb(r,g,b)				: return current color in Uint32 format
enablepalette(state)			: enable disable and check the palettemode in 8 bit display
color (c,optional v)			: set  palette color c with value v se missing return the current color c
colorcycling(s,e,d=0|1)			: move the palettecolor one color forward or back work only in 8bit display
ink(c)					: select the current color in Uint32 format

point(x,y)				: return the color of x,y point
dot(x,y)				: write x,y point with a current color
dot_ex(x,y,c)				: write x,y point with a c color
line(x,y,x1,y1)				: write a line
box(x,y,x1,y1)				: write a empty rettangle
bar(x,y,x1,y1)				: write a fill rettangle
rectangle(x,y,w,h,mode)			: write a rettangle w and h are the sizes mode=0 empty 1=filled
circle(x,y,r)				: write a circle
fillcircle(x,y,r)			: write a fill circle
ellipse(x,y,rx,ry)			: write a ellipse
fillellipse(x,y,rx,ry)			: write a fill ellipse
paint(x,y)				: fill a close area

_________________________________________________________________________________________________________________________
File input output

getfreeimage()				: return a number of first image bank free
loadimage(filename,optional n)		: load a graphics file in a slot n if n=-1 use the first free and return as n
loadzipimage(zipfile,filename,opt n)	: load a graphics file stored in a zip archive in a slot n if n=-1 use the first free and return as n
saveimage(filename,n)			: save slot n in a graphics file(only bmp)
getfreesound()				: return a number of first sound bank free
loadsound(filename,n)			: load a wave file in a sound slot n if n=-1 use the first free and return as n
loadzipsound(zipfile,filename,n)	: load a wave zipped file in a sound slot n if n=-1 use the first free and return as n
savesound(filename,n)			: save a wave file from sound slot n
loadmusic(filename)			: load a music module (xm,mod,ogg and only for linux mp3)
loadzipmusic(zipfile,filename)		: load a zipped music module (xm,mod,ogg and only for linux mp3)

_________________________________________________________________________________________________________________________
Image manipulation

hotspot(n,x,y)				: select the point of coordinates in a imageslot (n,0,0=up left(default) | n,1,1=center | n,2,2 =down right)n= image
setcolorkey(c)				: set the colorkey for bitmap transparency if set -1 (default ) will be used the left-up corner color.
imageexists(n)				: return 1 if the image buffer n exist 0 if empty
imagewidth(n)				: return the image n width or error if image n if empty
imageheight(n)				: return the image n height or error if image n if empty
deleteimage(n)				: erase the image n of the memory
copyimage(s,d)  			: copy image s to image d
setalpha(n,a)				: set trasparency
zoomimage(n,zoomx,zoomy)		: zoom image
rotateimage(n,angle)			: rotate image
rotozoomimage(n,angle,zoom)		: rotate and zoom image
mirrorimage(n,x,y)			: vertical-orizontal mirror

_________________________________________________________________________________________________________________________
Blitting

blt(n,sx,sy,sw,sh,dx,dy)		: copy a part of graphics slot in screen
pastebob(x,y,n)				: copy on screen image n at x,y performing clip
pasteicon(x,y,n)			: copy on screen image n at x,y without clipping
grab(n,x,y,w,h)				: grab a a selectarea and copy it in slot n

_________________________________________________________________________________________________________________________
Sprite system

 In this implementation there are 512 sprites software that are indipendent from the screens

spriteclip(x,y,w,h)			: set the visibilty area of sprites
sprite(n,x,y,fr)			: set or move the sprite n at x,y with image fr
deletesprite(n)				: unset sprite n
xsprite(n)				: return the x of sprite n
ysprite(n)				: return the y of sprite n
spritewidth(n)				: return the width of sprite n
spriteheight(n)				: return the height of sprite n
frsprite(n)				: return the frame of sprite n
livesprite(n)				: return 1 if sprite n is "live"
spritehit(n,x)				: return 1 if sprite n have a collission with sprite x if x=-1 with any
spritez(n,z)				: set the zorder position of sprite if z =-1 report actual z position
lastsprite				: return the last sprite active
autoupdatesprite(m)			: set/ unset automatic sprites update at screenswap
updatesprite				: manual sprites updates at next screenswap

_________________________________________________________________________________________________________________________
Bob system

 In this implementation there are 512 bobs software that are dipendent from the screens and performs
 background preserve

setbob(n,scr)				: set bob n at logic screen scr
bob(n,x,y,fr)				: set or move bob n at x,y with frame fr
deletebob(n)				: unset bob n
xbob(n)					: return x of bob n
ybob(n)					: return y of bob n
bobwidth(n)				: return width of bob n
bobheight(n)				: return height of bob n
frbob(n)				: return the frame of bob n
livebob(n)				: return 1 if bob n is "live"
bobhit(n,x)				: return 1 if bob n have a collision with bob x if x=-1 with any
bobz(n,z)				: set the zorder position of bob if z =-1 report actual z position
lastbob					: return the last bob active
autoupdatebob(m) 			: set/ unset automatic bobs update at screenswap
updatebob  				:  manual bobs updates at next screenswap


_________________________________________________________________________________________________________________________
Text draw

text(x,y,s,text,option)			: print the text testo  on current screen with s size with option solid=0 Shaded=1 Blended=2
setfont(path)				: select the font
getfont()				: get the font selected
textrender(text,s,n,option)             : make an image slot n with the text  write with a current font and size s and option solid=0 Shaded=1 Blended=2
_________________________________________________________________________________________________________________________
Print screen

pen(c)					: set prints color (with -1 parameter return the current color)
paper(c)				: set caractere back color (with -1 parameter return the current color)
fprints(text)				: print a text monospace without cariage return
prints(text)				: print a text monospace
locate(x,y)				: move the cursor at x y
atx					: return x of cursor
aty					: return y of cursor
curson					: show the text cursor on screen at(atx,aty)
cursoff					: hide the text cursor
inputs(prompt,defs)			: return the string insert to keyboard(default is default text)
zoneinputs(x,y,l,default)		: return the string insert to keyboard in  x,y coordinates with l lenght

_________________________________________________________________________________________________________________________
Sounds and music

isenabledsound()			: return 1 if sdlsound was enabled

soundexists(n)				: return 1 if the sound buffer n exist 0 if empty
deletesound(n)				: delete from memory sound n
copysound(s,d)				: copy  sound bank s in sound bank d

musicexists()				: return 1 if the music is load 0 if empty

playsound(n,c,optional l)		: play the sound n in  channel c l loops
playfreqsound(n,c,pitch,l)		: play the sound n in  channel c l loops at freq variation (negative number=low positive number =high)
volumesound(c,optional v)		: change the volume of channel c (-1  all) at value v (0-128) with v = -1 return the current volume
stopsound(optional c)			: stop the  wave play in channel c (-1=all)
pausesound(optional c)			: paused channel c (-1=all)
resumesound(optional c)			: unpaused channel c (-1=all)
vumetersound(optional c)                : return the current state of sound channel (-1=all)
positionsound(c,angle,dist)             : position sound in 3d space
soundchannels(n)	                : dinamically change the number of channells managed by sdlBasic

playmusic(n)				: play track xm,mod,ogg,mp3 n=number of ripetition(-1 always)
positionmusic(p)                        : move the execution at p second
stopmusic				: terminate the music play
pausemusic                              : set pause of the current music
resumemusic                             : unset pause of musica
rewindmusic                             : rewind at start the music
fademusic(t)				: music fade
volumemusic(optional v)			: change the volume of music (0-128) -1 return the current volume
speedmusic(v)                           : change the speed of music

_________________________________________________________________________________________________________________________
CD support

numdrivescd() 				: returns the number of cd-rom drives on the system.
namecd(drive)				: returns a human-readable, system-dependent identifier for the cd-rom.
getfreecd()				: return first free channel Cd
opencd(n,drive)				: opens a cd-rom drive for access.
indrivecd(n)				: return 1 if cd is in driver
trackscd(n) 				: return the number of tracks in cd
curtrackcd(n)				: return the current track in cd
curframecd(n)				: return the current frame in cd
playcd(n,s,l) 				: play a cd
playtrackscd(n,trk1,fr1,ntrks,nfrs)	: play the given cd track(s)0=all
pausecd(n) 				: pauses a cdrom
resumecd(n) 				: resumes a cdrom
stopcd(n)				: stops a cdrom
ejectcd(n) 				: ejects a cdrom
closecd(n) 				: closes a cd handle
tracktypecd(n,t)			: return SDL_AUDIO_TRACK(0...) or SDL_DATA_TRACK(1...)
tracklengthcd(n,t)			: return the length of track t
trackoffsetcd(n,t)			: return the offset to the beginning of this track in frames

________________________________________________________________________________________________________________________
 Video mpeg
loadmpeg(fname,usesound)		: load a mpeg video
plaympeg(loop)				: play a mpeg1 video
stopmpeg()				: terminate the video play
deletempeg()				: unload mpeg video
pausempeg()				: Pause/Resume playback of an SMPEG object
rewindmpeg()				: Rewind the play position of an SMPEG object to the beginning of the MPEG
seekmpeg(p)				: Seek 'bytes' bytes in the MPEG stream
skipmpeg(s)				: Skip 'seconds' seconds in the MPEG stream
statusmpeg()				: return 1 if plaympeg work or 0 in other case
________________________________________________________________________________________________________________________
Keyboard

key(keycode)				: return 1 if is press the key keycode
inkey					: return ascii code of key press
waitkey(keycode)			: wait a key pression (-1 =any key)

_________________________________________________________________________________________________________________________
Mouse

xmouse					: return mouse x coordinate on display
ymouse					: return mouse y coordinate on display
xmousescreen(n)				: return mouse x coordinate on screen
ymousescreen(n)				: return mouse y coordinate on screen
bmouse 					: return the buttonclick on the mouse
changemouse(n)				: change mouse from default(0) to emulate with sprite 0 - image 0 (1,2,3)
locatemouse(x,y)			: move mouse at x y coordinates
mouseshow				: show the mouse cursor
mousehide				: hide the mouse cursor
mousezone(x,y,w,h)			: return 1 if the mouse pointer is in rectangle(xy with size wh)

_________________________________________________________________________________________________________________________
Joystick

numjoysticks 				: count available joysticks
namejoystick(i)				: get joystick name
openjoystick(i)				: opens a joystick for use.
isopenjoystick(i)			: determine if a joystick has been opened
numaxesjoystick(i) 			: get the number of joystick axes
numballsjoystick(i) 			: get the number of joystick trackballs
numhatsjoystick(i) 			: get the number of joystick hats
numbuttonsjoystick(i) 			: get the number of joysitck buttons
getaxisjoystick(i,a) 			: get the current state of an axis
gethatjoystick(i,a)			: get the current state of a joystick hat
getbuttonjoystick(i,a) 			: get the current state of a given button on a given joystick
xgetballjoystick(i,a) 			: get relative x trackball motion
ygetballjoystick(i,a) 			: get relative y trackball motion
joy(i)					: return joystick boolean coordinate
bjoy(i)					: return joystick buttons pressed in boolean expression
emulate_bjoy				: return emulate joystick buttons in keyboard keys
waitbjoy				: wait the pression of a joystick button (or emulate in keyboard)

_________________________________________________________________________________________________________________________
Time

waitTime(t)				: wait t milliseconds
timer					: return the current tick

_________________________________________________________________________________________________________________________
Socket

isenabledsock()				: return 1 if sdlnet was enabled

sock=getfreesock()			: return the first free sock in sdlSocket array
sock=OpenSock(port) 			: Server side socket sock is the stream. in sdlBasic there are 256 stream and
					  sintax is very similar of file open close.
clientsock=AcceptSock(serversock)	: Accept the client connection
IsServerReady(Sock)			: True/False if server is sending data    

sock=ConnectSock(ServerName,port)	: client side socket connection
*ConnectionReadySock(sock)		: the server have accepted the connection
IsClientReady(Sock)			: True/False if client is sending data
CloseSock(sock)				: Close the socket connection. Works for client and server

*PeekSock(Sock, NumBytes)		: Peek information coming from socket, but do not clear.
ReadSock(Sock, NumBytes)		: Read NumBytes
ReadByteSock(Sock)			: Read a single byte      
ReadLineSock(Sock)			: Read complete line
WriteSock(Sock, Message, NumBytes)	: Sends NumBytes from Message
WriteByteSock(Sock, Byte)		: Sends a single byte
WriteLineSock(Sock, Message)		: Send Message

getremoteip(sock)			: return the ip address of remote client connetted
getremoteport(sock)			: return the port address of remote client connetted
getlocalip()				: return the local ip
_________________________________________________________________________________________________________________________

