sdlbasic / syntax


FrontPage

# sdlBasic is a little basic for make simple games in 2d

#

# This basic run on :

# linux(with a reasonable recent version)

# windows (9x and nt-XP based)

# macOSX

# FreeBSD

# OpenBSD

# MorphOS

# AmigaOS

#

# This basic is another demostration to the GPL's power

# the basic interpreter come from wxbasic by David Cuny

("http://wxbasic.sourceforge.net") distribuited under lGPL

# The graphic system is based uppon SDL graphics libraries family

("http://www.libsdl.org")distribuited under GPL

# The graphics engine was initially based on the aliens demo game

("http://www.libsdl.org/projects/aliens")

# written in c and distribuited on GPL, later graphic engine was re-written from

scratch.

# putpixel and getpixel routines are derivated from SDL tutorial and was improved

with Gigi Davassi suggestions

# The original line rutine was imported from Alvyn Basic with Author's write

permission.

# I used also the source of sdldraw library ("http://sdl-draw.sourceforge.net/") ever

lGPL

#

# I cut, pasted and adapted code distribuited under lGPL.

# This software is subject to lGPL license and is free as every program used to

create it

#

#____________________________________________________________________________________

_____________________________#

#

# sdlBasic comands and syntax list:

#

# i suggest to read full documentation for more details

#

# sections:

# Run time

# Sub and function

# Control structures

# Operator

# Array

# Strings

# Maths

# Files

# Dirs

# Data function

# console output

# Date and time

# Memory Bank

#

# Screen

# Graphics

# File graphics input output

# Image manipulation

# Blitting

# Sprite system

# Bob system

# Text draw

# Print screen

# Sounds and music

# CD support

# Video Mpeg

# Keyboard

# Mouse

# Joystick

# SDLtime

# Socket

#

#____________________________________________________________________________________

____________________________

#

# notes:

# * it don't works

# ** it don't works and need to be tested

# ? it don't work well: unresolved bug

# -> to be deleted

#

#____________________________________________________________________________________

____________________________

# Run Time

# command line arguments

# --nodefaults : disable the default setting display

# --nosound : disable sound

# --nosocket : disable socket support

# --debug : start sdlBasic in step to step mode

# --version : display the version (iso date)

# --license : display license type

# --copyright : display copyright ( ;-) absolutelly free software )

# --help : display a run option list

#

const : declaration of numeric constant option explicit : must declare variable option qbasic : qbasic mode you can use a function before

create in a code include(filename) : inclusion of extern source file argc : return number of args in caller argv(index) : return arg in caller command [param] : returns requested arg from command line command$ [param] : returns requested arg from command line argument(optional n) : returns the arguments sends to sub/function

with n=0 or without parameter will be return the arguments count argument$(optional n) : returns the arguments sends to sub/function

with n=0 or without parameter will be return the arguments count ?setenv(varname,value) : set a enviremont variable in currently os.

if variable exist it will be overwrite getenv(varname) : return the value of enviremont variable in

currently os

run : run command on new thread

shell : execute command, wait until finished end : terminate program and exit stop : breakpoint and start debug

os : return the operative system in work (linux

windows macosx etc...) isfbsd : return 1 if the current os is FreeBSD isosx : return 1 if the current os is MacOSX islinux : return 1 if the current os is linux iswin32 : return 1 if the current os is windows ismos : return 1 if the current os is MorphOS isnetbsd : return 1 if the current os is NetBSD isamigaos : return 1 if the current os is AmigaOS

# debug : work with option --debug at start or when you press ctrl+c key in

interpretation of basic program

# if you press F5 you continue the normal execution

# with F6 you advanced in execution of one step

# with F4 you can see the vale of the prompted variable. For see the value of an

array you must enter the name

# of array without the square bracket and at the request you must enter the indexes

of record requested.

#____________________________________________________________________________________

_____________________________________

# Sub and Function

declare [sub | function][name] : declare a subrutine/function in qbasic mode sub [name](args...) : start a subrutine exit sub : break a subrutine end sub : terminate a subrutine

function [name](args...) : start a function exit function : break a function end function : terminate a function return [value | variable] : set the result of a function(can

substituite funcname=x)

#____________________________________________________________________________________

_____________________________________

# Control Structures

while [condition expression] : start while cycle wend : end while cycle end while : end while cycle exit while : stop while cycle continue : terminate the last while cycle

if [condition expression] : classic if control structure then : then must be terminate a command else : classic else:it must be a single command elseif : elseif is support in sdlBasic end if : must terminate a if structure

select case [condition expression] : similar to c switch (syntax like pascal) case : control condition case else : default condition end select : end select case structure

for[var]=[val1]to[val2][step[vals]] : classic for-next well implemented for each [var] in [array] : for each are well supported warning: report

the indexes of array not the value continue : force the exit of for next cycle (work only

with for each) exit for : force the exit of for next cycle next : end for loop end for : sdlBasic accept end for

do : start a do-loop cycle loop : the bottom of do-loop cycle exit do : the exit of a do-loop cycle

repeat : not implemented yet

until : not implemented yet

or : condition in espression logic or and : condition in espression logic and xor : condition in espression logic xor not : condition in espression logic not

#____________________________________________________________________________________

_____________________________________

Operator

  • [+] : 加算演算子

[-] : 減算演算子

[*] : 乗算演算子

[/] : 除算演算子

[^] : 指数演算子

mod : 剰余演算子

shl : 左シフト演算子

shr : 右シフト演算子

#____________________________________________________________________________________

_____________________________________

# Array

dim [name]index of array? : declare an array note: array use [] for

parentesis

redim [name]index of array? : redeclare an array

shared [variable] : declare variable extern in a subrutine common [variable] : declare variable or array global lbound [array] : returns lower bound of array


quicksort [array] : sort an array

ubound [array] : upperbound of array erase [array] : free an array

#____________________________________________________________________________________

_____________________________________

# Strings

asc(char) : returns ascii value of first char in string chr(v) : return string corresponding to ascii key

value chr$(v) : return string corresponding to ascii key

value

format() : returns formatted string with embedded args

format$() : returns formatted string with embedded args

insert(source,target,position) : insert source string to target at index insert(source,target$,position) : insert source string to target at index instr(optional start,source,target) : returns position in source that target was

found lcase(string$) : convert string to lower case lcase(string) : convert string to lower case left(string$,number) : returns leftmost chars in string left(string,number) : returns leftmost chars in string len(string$) : return length of string length(string$) : return length of string ltrim(string$) : returns string with left whitespace removed ltrim(string) : returns string with left whitespace removed mid(string$,start,optional end) : returns string with chars 1..n from source mid(string,start,optional end) : returns string with chars 1..n from source replace(opt index,source,replace) : replace string from source with replace

starting at index replace(opt index,source,replace$) : replace string from source with replace

starting at index replacesubstr(source,rep) : replace substring in source with withstring

return the new string replacesubstr(source,rep$) : replace substring in source with withstring

return the new string reverse(string$) : reverse a string return the new string reverse(string) : reverse a string return the new string right(string$,number) : returns rightmost chars in string right(string,number) : returns rightmost chars in string rinstr(optional start,source,target) : reverse Instr function, search from end to

start rtrim(string$) : right trim string rtrim(string) : right trim string space(n) : return string with n spaces in it space$(n) : return string with n spaces in it str(value) : return string representation of numeric

expression str$(value) : return string representation of numeric

expression strf(value) : converts a floating point or number value

to a string strf$(value) : converts a floating point or number value

to a string string(n,string$) : returns string m chars wide with n in it string(n,string) : returns string m chars wide with n in it tally(src,sub) : returns number of occurances of matchstring trim(string$) : trim string trim(string) : trim string typeof(variable) : returns string with datatype typeof$(variable) : returns string with datatype ucase(string$) : convert string to upper case ucase(string) : convert string to upper case val(string$) : returns closest numeric representation of

number

#____________________________________________________________________________________

_____________________________________

# Maths

abs(value) : returns absolute value of number acos(value) : returns arccos of number asin(value) : returns arcsin of number atan(value) : returns arctan of number bin(value) : returns binary representation of number bin$(value) : returns binary representation of number cos(value) : returns cos of number exp(value) : returns exponential function fix(value) : truncate fractional number, rounding down

towards zero floor(value) : truncate fractional number, rounding down

towards zero frac(value) : return fractional portion of number hex(value) : returns hexidecimal representation of

number hex$(value) : returns hexidecimal representation of

number int(value) : convert to 32 bit integer, truncating

decimals log(value) : returns natural log of expression randomize(value) : reseed the random number generator rnd(optional upper) : return an random number round(value) : round to nearest integer sgn(value) : returns sign of numeric expression sin(value) : returns sine of given angle in radians sqr(value) : return square root - make sure it's non-

negative tan(value) : return tanget of given angle in radians min(value1,value2) : return min number of the operands max(value1,value2) : return max number of the operands bitwiseand(value1,value2) : return the logic and of the operands andbit(value1,value2) : return the logic and of the operands bitwiseor(value1,value2) : return the logic or of the operands orbit(value1,value2) : return the logic or of the operands bitwisexor(value1,value2) : return the logic xor of the operands xorbit(value1,value2) : return the logic xor of the operands

#____________________________________________________________________________________

____________________________________

# Files

open[filename]for{input|output|append}as[stream]: open file stream file input #[stream] : read a line from file stream input #[stream] : read a line from file stream file output #[stream] : print a line in file stream print #[stream] : print a line in file stream close [stream] : close file stream

eof(stream) : returns nonzero if Eof fileexists(filename) : returns true if the file exists filecopy(source,dest) : copy a file filemove(source,dest) : move a file filerename(filename,newname) : rename a file freefile() : return the handle of the next free file kill(filename) : delete filename. filename can be then

path+filename filedelete(filename) : delete filename. filename can be then

path+filename loc(stream) : returns position in file lof(stream) : returns length of file readbyte(stream) : return a byte from the file rename(filename,newname) : rename file seek(stream) : seek file position/return current file

position writebyte(stream,byte) : write a byte in the file

#____________________________________________________________________________________

_____________________________________

# Dirs

chdir(path) : change directory dir dir$ : returns current path direxists(path) : returns true if directory exists dirfirst(path) : returns first entry in path dir dirnext : returns next entry in path dir mkdir(path) : create a new directory rmdir(path) : remove directory

#____________________________________________________________________________________

_____________________________________

# Data Function

data(optional 0-255 param) : store the data read(optional pointer) : without parameter read a data record with

point change the next data loaded

#____________________________________________________________________________________

_____________________________________

# Console Output

print [text|variable|number] : Print in standard output a espression (i

use it for debugging output)

#____________________________________________________________________________________

_____________________________________

# Date and Time

date() : returns date in MM-DD-YYYY format date$() : returns date in MM-DD-YYYY format time() : return time in HH:MM:SS format time$() : return time in HH:MM:SS format ticks() : returns current timer value

#____________________________________________________________________________________

_____________________________________

# Memory Bank

reservebank(bank,size) : make a raw memory bank. there are 256 bank

( 0 - 255) baseimage(bank,image) : link a memorybank from a imagebank bitmap

access baseimageCC(bank,image) : link a memorybank from a imagebank bitmap

access with colorkey trasparency basescreen(bank,image) : link a memorybank from a screen bitmap

access basesound(bank,sound) : link a memory bank with soundb bank

freebase(bank) : unconnect a memory bank with a image or

screen freebank(bank) : destroy a memory bank

copybank(s,d) : copy the bank s in d

loadbank(filename,optional bank) : load a file in memory bank (if omitted the

current ) savebank(filename,optional bank) : save memory bank in a file

setbank(optional bank) : set the current bank (if omitted return the

current) currentbank(optional bank) : set the current bank (if omitted return the

current) sizebank(optional bank) : return the bank memory size (if omitted

return the value of current bank) banksize(optional bank) : return the bank memory size (if omitted

return the value of current bank)

poke(optional bank,address,value) : write a byte value in memory bank at

specific address doke(optional bank,address,value) : write a 16bit value in memory bank at

specific address loke(optional bank,address,value) : write a 32bit value in memory bank at

specific address

peek(optional bank,address) : read a byte value in memory bank at

specific address deek(optional bank,address) : read a 16bit value in memory bank at

specific address leek(optional bank,address) : read a 32bit value in memory bank at

specific address

memcopy(sbank,s,dbank,d,size) : copy a part of bank memory s in d

#____________________________________________________________________________________

_____________________________________

# 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=fullscreen|1=window|2=resizable|3=fullscreen software (provvisory) setcaption(title) : change the display window title setalphachannel(v) : activate deactivate alpha channel

trasparency caption() : return the display window title displaymode : return the display mode displaywidth : return the display width displayheight : return the display height displaybpp : return the display color depth

screen(n) : set the logic screen n without parameter

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 in multitasking

without parameter return 0 if terminate screenfadeout(n,t) : fade the screen n in t time in multitasking

without parameter return 0 if terminate screenfadein(n,otional i,optional t) : fade the screen n to image i in t time in

multitasking without parameter return 0 if terminate screencrossfade(n,i,t) : fade the screen n from current screen to

image i in t time in multitasking without parameter return 0 if terminate 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 screenviewport(x,y,w,h,flag) : change the display output coordinates of

the current screen xscreenrect : give the x coordinate of current screen

viewport screenviewportx : give the x coordinate of current screen

viewport yscreenrect : give the y coordinate of current screen

viewport screenviewporty : give the y coordinate of current screen

viewport wscreenrect : give the w value of current screen viewport screenviewportw : give the w value of current screen viewport hscreenrect : give the h value of current screen viewport screenviewporth : give the h value of current screen viewport flagscreenrect : give the flag value of current screen

viewport screenviewportflag : give the flag value of current screen

viewport

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

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

screen screenoffsetx : give the x coordinate offset in current

screen yoffset : give the y coordinate offset in current

screen screenoffsety : give 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 setautoback(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 dualplayfield(optional m) : set/unset automatic update of a screen

upper sprite waitvbl : wait automatic screenswap fps(optional n) : set/unset or give the current frame rate

counter (0/1/none)

#____________________________________________________________________________________

_____________________________________

# Graphics

rgb(r,g,b) : give current color in Uint32 format enablepalette(optional state) : enable disable and check the palettemode in

8 bit display color (c,optional v) : set palette color c with value v se missing

give the current color c palette(optional 0-255 param) : set all palettes color(0,0xff,0xff00,....) colorcycling(s,e,d=0|1,optional delay) : move the palette color one color forward or

back work only in 8bit display

					  if you set delay automatically colorcycling 

work on multitasking colorcycling() : stop the multitasking colorcycling ink(c) : select the current color in Uint32 format

point(x,y) : give the color of x,y point getpixel(x,y) : give the color of x,y point dot(x,y) : write x,y point with a current color setpixel(x,y) : write x,y point with a current color putpixel(x,y) : write x,y point with a current color plot(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 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 triangle(xa,ya,xb,yb,xc,yc) : draw a fill triangle polyline(xa,ya,xb,yb,xc,yc,.....) : draw a perimeter of a polygon polygon(xa,ya,xb,yb,xc,yc,.....) : draw a fill polygon

#____________________________________________________________________________________

_____________________________________

# File Graphics Input Output

loadimage(filename,optional n) : load a graphics file in a slot n if omitted

n is the first free return n loadzipimage(zipfile,filename,opt n) : load a zipped graphics file in a slot n if

omitted n is the first free return n saveimage(filename,n) : save slot n in a graphics file(only bmp) loadsound(filename,opt n) : load a wave file in a sound slot n loadzipsound(zipfile,filename,opt n) : load a zipped wave file in a sound slot n ?savesound(filename,n) : save a wave file from sound slot n (low

quality result) loadmusic(filename) : load a music module (mod family,ogg,mp3 and

midi)

#____________________________________________________________________________________

_____________________________________

# 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. colorkey(c) : set the colorkey for bitmap transparency if

set -1 (default ) will be used the left-up corner color. imageexists(n) : give 1 if the image buffer n exist 0 if

empty imagewidth(n) : give the image n width or error if image n

if empty imageheight(n) : give 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 in image n imagealpha(n,a) : set trasparency in image n 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

colorkey trasparency 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) : give the x of sprite n spritex(n) : give the x of sprite n ysprite(n) : give the y of sprite n spritey(n) : give the y of sprite n spritewidth(n) : give the width of sprite n spriteheight(n) : give the height of sprite n frsprite(n) : give the frame of sprite n spriteimage(n) : give the frame of sprite n livesprite(n) : give 1 if sprite n is "live" spriteexist(n) : give 1 if sprite n is "live" spritehit(n,optional x) : give 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

omitted or-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) : give x of bob n bobx(n) : give x of bob n ybob(n) : give y of bob n boby(n) : give y of bob n bobwidth(n) : give width of bob n bobheight(n) : give height of bob n frbob(n) : give the frame of bob n bobimage(n) : give the frame of bob n livebob(n) : give 1 if bob n is "live" bobexist(n) : give 1 if bob n is "live" bobhit(n,optional x) : give 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,testo,optional type) : print the text testo on current screen with

s size The type of render can be default=solid 1=Shaded 2=blended setfont(path) : select the font getfont() : return the current font textrender(testo,s,optional n,optional type) : make an image slot n with the text

write with a current font and size s if n is omitted use and return first free The

type of render can be default=solid 1=Shaded 2=blended

#____________________________________________________________________________________

_____________________________________

# Print Screen

pen(c) : set prints color (without parameter give

the current color) paper(c) : set caractere back color (without parameter

give the current color) fprints(testo) : print a text monospace without cariage

return prints(testo) : print a text monospace locate(x,y) : move the cursor at x y atx : give x of cursor aty : give y of cursor curson : show the text cursor on screen at(atx,aty) cursoff : hide the text cursor inputs(prompt,defs) : give the string insert to keyboard(default

is default text) zoneinputs(x,y,l,default) : give the string insert to keyboard in x,y

coordinates with l lenght

#____________________________________________________________________________________

_____________________________________

# Sounds and Music

isenabledsound() : return 1 if sdlsound was enabled soundenabled() : return 1 if sdlsound was enabled

soundexists(n) : give 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() : give 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,optional l) : play the sound n in channel with pitch

resampling frequency c l loops volumesound(c,optional v) : change the volume of channel c (-1 all) at

value v (0-128) without v or -1 give the current volume soundvolume(c,optional v) : change the volume of channel c (-1 all) at

value v (0-128) without v or -1 give the current volume stopsound(optional c) : stop the wave play in channel c (-1 or none

=all) pausesound(optional c) : paused channel c (-1 or none =all) resumesound(optional c) : unpaused channel c (-1 or none =all) ?vumetersound(optional c) : give the current state of sound channel (-1

or none=all) sound3d(c,angle,dist) : position sound in 3d space 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 : report at start the music fademusic(t) : music fade volumemusic(optional v) : change the volume of music (0-128) -1 or

none give the current volume musicvolume(optional v) : change the volume of music (0-128) -1 or

none give the current volume speedmusic(v) : change the speed of music musicspeed(v) : change the speed of music

#____________________________________________________________________________________

_____________________________________

#CD Support

numdrivescd() : returns the number of cd-rom drives on the

system. countcddrives() : returns the number of cd-rom drives on the

system. namecd(drive) : returns a human-readable, system-dependent

identifier for the cd-rom. cdname(drive) : returns a human-readable, system-dependent

identifier for the cd-rom. opencd(n,drive) : opens a cd-rom drive for access. indrivecd(n) : return 1 if cd is in driver cdinserted(n) : return 1 if cd is in driver trackscd(n) : return the number of tracks in cd countcdtracks(n) : return the number of tracks in cd curtrackcd(n) : return the current track in cd cdcurtrack(n) : return the current track in cd curframecd(n) : return the current frame in cd cdcurframe(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) from frame fr1

of trrack trk1 for ntrks/nfrs playtrackscd(n,trk1,ntrks) : play the given cd track(s)from trk1 for

ntracks playtrackscd(n) : play all cd track(s) playcdtracks(n,trk1,fr1,ntrks,nfrs) : play the given cd track(s) from frame fr1

of trrack trk1 for ntrks/nfrs playcdtracks(n,trk1,ntrks) : play the given cd track(s)from trk1 for

ntracks playcdtracks(n) : play all cd track(s) 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...) cdtracktype(n,t) : return SDL_AUDIO_TRACK(0...) or

SDL_DATA_TRACK(1...) tracklengthcd(n,t) : return the length of track t cdtracklength(n,t) : return the length of track t trackoffsetcd(n,t) : return the offset to the beginning of this

track in frames cdtrackoffset(n,t) : return the offset to the beginning of this

track in frames

#____________________________________________________________________________________

____________________________________

# Video Mpeg

loadmpeg(fname,usesound) : load a mpeg video plaympeg(optional 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) : give 1 if is press the key keycode inkey : give ascii code of key press waitkey(optional keycode) : wait a key pression (0 =any key)

#____________________________________________________________________________________

_____________________________________

# Mouse

xmouse : give mouse x coordinate on display ymouse : give mouse y coordinate on display mousex : give mouse x coordinate on display mousey : give mouse y coordinate on display xmousescreen(n) : give mouse x coordinate on screen ymousescreen(n) : give mouse y coordinate on screen mousescreenx(n) : give mouse x coordinate on screen mousescreeny(n) : give mouse y coordinate on screen bmouse : give the buttonclick on the mouse mousebutton : give the buttonclick on the mouse changemouse(optional n) : change mouse from default(0) to emulate

with sprite 0 - image 0 (1,2,3)without n return current pointer mousepointer(optional n) : change mouse from default(0) to emulate

with sprite 0 - image 0 (1,2,3)without n return current pointer locatemouse(x,y) : move mouse at x y coordinates placemouse(x,y) : move mouse at x y coordinates mouseshow : show the mouse cursor howmouse : show the mouse cursor mousehide : hide the mouse cursor hidemouse : hide the mouse cursor mousezone(x,y,w,h) : give 1 if the mouse pointer is in

rectangle(xy with size wh)

#____________________________________________________________________________________

_____________________________________

# Joystick

numjoysticks : count available joysticks namejoystick(index) : get joystick name 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 joybuttons(i) : return joystick buttons pressed in boolean

expression fire(i) : return joystick buttons pressed in boolean

expression waitbjoy(optional i) : wait the pression of a joystick button (or

emulate in keyboard)

#____________________________________________________________________________________

_____________________________________

# SDLtime

wait(t) : wait t milliseconds timer : give 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 (not work on windows)

#____________________________________________________________________________________

_____________________________________

#