[sourceforge] [sdlbasic]

sdlbasic 速習ガイド


sdlBasic はシンプルな 2D ゲームを作成するための小規模 BASIC 処理系です。

sdlBasic の動作環境:
Linux (最新版を推奨)
Windows (9x と NT-XP ベース)
macOSX
FreeBSD
OpenBSD
MorphOS
AmigaOS

この BASIC は GPL ライセンスパワーの実証です。
BASIC インタプリタは LGPL ライセンスで配布されている David Cuny 作の wxBasic ("https://wxbasic.sourceforge.net/") からの派生製品です。
グラフィックスシステムは GPL ライセンスで配布されている SDL グラフィックスライブラリとその関連製品 ("https://www.libsdl.org/") をベースとしています。
初期のグラフィックスエンジンは C で開発されており GPL ライセンスで配布されている aliens デモゲーム ("https://www.libsdl.org/projects/aliens") をベースとしています。
後期のグラフィックスエンジンはゼロから完全に書き直してあります。
putpixel と getpixel ルーチンは SDL チュートリアルの派生品であり、 Gigi Davassi (ジジ・デイバシー) の提案で改良しました。
オリジナルの線描ルーチンは Alvyn Basic ("https://alvyn.sourceforge.net/") 開発者の使用許諾を得て sdlBasic へ組み込みました。
LGPL ライセンスで配布されている sdldraw ライブラリ ("https://sdl-draw.sourceforge.net/") のソースコードも使用しております。

sdlBasic からの切り取り、貼り付け、および改変後のコードは GPL の配布条件を遵守してください。
このソフトウェアは LGPL ライセンスで保護されており、これで作成したプログラムは自由に扱えます。




sdlBasic のコマンドと文法リスト:

詳細情報は総合取扱説明書をお読みください。

セクション:
ランタイム
サブルーチンと関数
制御構造
演算子
配列
文字列
算術処理
ファイル
ディレクトリ
Data 関数
コンソール出力
日付と時刻
メモリバンク

スクリーン
グラフィックス
ファイルの入出力
画像処理
画像転送
スプライトシステム
Bob システム
テキストの描画
スクリーン出力
サウンドとミュージック
CD サポート
MPEG ビデオ
キーボード
マウス
ジョイスティック
SDLtime
ソケット




備考:
* 不動機能

** 不動機能でありテストが必要

?正常に動作しない: 未解決の不具合

-> 廃止予定




ランタイム

コマンドライン引数
--nodefaults : デフォルトのディスプレイ設定を無効化
--nosound : サウンドの無効化
--nosocket : ソケットサポートの無効化
--debug : ステップ実行モードで sdlBasic を起動
--version : バージョン情報の表示 (ISO 日付)
--license : ライセンス形態を表示
--copyright : 著作権情報の表示 ( ;-) 当然ですがフリーソフトウェア )
--help : 実行オプションのリストを表示


const : 数値定数を宣言します。
option explicit : 変数の自動作成を禁止します。
option qbasic : qbasic モードはコードの作成前に関数を使用可能にします。
include(filename) : 外部ソースファイルをインクルードします。
argc : 呼び出し元から渡された引数の個数を返します。
argv(index) : 呼び出し元から渡された個数を返します。
command [param] : コマンドラインから要求された arg を返します。
command$ [param] : コマンドラインから要求された arg を返します。
argument(optional n) : サブルーチン・関数へ渡すためのコマンドライン引数を返します。 パラメータに n=0 を指定、またはパラメータの省略時はコマンドライン引数の総数を返します。
argument$(optional n) : サブルーチン・関数へ渡すためのコマンドライン引数を返します。 パラメータに n=0 を指定、またはパラメータの省略時はコマンドライン引数の総数を返します。
?setenv(varname,value) : 現在のオペレーティングシステムにおいて指定された環境変数の値を設定します。変数が存在する場合は置換されます。

getenv(varname) : 現在のオペレーティングシステムにおいて指定された環境変数の値を返します。
*run : 新しいスレッドでコマンドを実行

shell : コマンドの実行後、完了まで待機
end : プログラムの停止と終了
stop : ブレークポイントとデバッグの開始

os : 動作中のオペレーティングシステムを返します (linux windows macosx など...)
isfbsd : 現在のオペレーティングシステムが FreeBSD ならば 1 を返します。
isosx : 現在のオペレーティングシステムが MacOSX ならば 1 を返します。
islinux : 現在のオペレーティングシステムが Linux ならば 1 を返します。
iswin32 : 現在のオペレーティングシステムが Windows ならば 1 を返します。
ismos : 現在のオペレーティングシステムが MorphOS ならば 1 を返します。
isnetbsd : 現在のオペレーティングシステムが NetBSD ならば 1 を返します。
isamigaos : 現在のオペレーティングシステムが AmigaOS ならば 1 を返します。

debug : 起動時に --debug オプションの指定、あるいは BASIC プログラムの実行中に Ctrl + C を押したときに動作します。
F5 キーを押すと通常実行を再開します。
F6 キーを押すと sdlBasic は強制的にプログラムの行を一行ずつ毎回ステップ実行します。
F4 キーを押すと値を監視する変数の名前を入力できます。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.



サブルーチンと関数

declare [sub | function][name] : qbasic モードでサブルーチンや関数を宣言します。
sub [name](args...) : サブルーチンを定義します。
exit sub : サブルーチンを打ち切ります。
end sub : サブルーチンを終了します。

function [name](args...) : 関数を定義します
exit function : 関数を打ち切ります。
end function : 関数を終了します。
関数の結果を設定します (関数名 = x で代用可能)



制御構造

while [condition expression] : while の繰り返しを開始します。
wend : while の繰り返しを終了します。
end while : while の繰り返しを終了します。
exit while : while の繰り返しを停止します。
continue : ループの先頭へ直行します。

if [condition expression] : 古典的な if による制御構造です。
then : これはコマンドの末尾に記述します。
else : 古典的な else です。コマンド単体で記述します。
elseif : elseif は sdlBasic の機能です。
end if : if の構造を終了します。

select case [condition expression] : C の switch と似ています (Pascal 風の構文)
case : 制御条件です。
case else : デフォルトの条件です。
end select : select ~ case の構造を終了します。

for[var]=[val1]to[val2][step[vals]] : 古典的な for ~ next の完全実装です。
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 : sdlBasic accept end for

do : do ループによる繰り返しを開始します。
loop : do ループによる繰り返しの底部です。
exit do : do ループによる繰り返しを終了します。

*repeat : まだ実装されていません。

*until : まだ実装されていません。


or : 論理和式による条件
and : 論理積式による条件
xor : 論理排他和式による条件
not : 論理否定式による条件




演算子

[+] : 加算演算子
[-] : 減算演算子
[*] : 乗算演算子
[/] : 除算演算子
[^] : 指数演算子
mod : 余剰演算子
shl : 左シフト
shr : 右シフト



配列

dim [name][[index of array]] : 配列を宣言します。注意: 配列では [] の括弧を使います。
*redim [name][[index of array]] : 配列を再宣言します。

shared [variable] : サブルーチン、または関数の内側で作成された変数や配列のスコープを外側へ拡張します。
common [variable] : グローバルな変数、または配列を宣言します。
lbound [array] : 配列のインデックスにおける下限を返します。
*quicksort [array] : 配列を並べ替えます。

ubound [array] : 配列のインデックスにおける上限を返します。
erase [array] : 配列を開放します。



文字列

asc(char) : 文字列の先頭文字に関する ASCII 値を返します。
chr(v) : ASCII コードの文字集合から一文字を文字列として返します。
chr$(v) : ASCII コードの文字集合から一文字を文字列として返します。
*format() : 組み込み args から書式文字列を返します。

*format$() : 組み込み 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$) : 文字列全体を小文字へ変換します。
lcase$(string$) : 文字列全体を小文字へ変換します。
left(string$,number) : 文字列の左端から指定された数の文字を返します。
left$(string$,number) : 文字列の左端から指定された数の文字を返します。
len(string$) : 文字列の長さを返します。
length(string$) : 文字列の長さを返します。
ltrim(string$) : 文字列の左側にあるホワイトスペースを切り詰めます。
ltrim$(string$) : 文字列の左側にあるホワイトスペースを切り詰めます。
mid(string$,start,optional end) : 入力文字列から 1..n 文字の文字列を返します。
mid$(string$,start,optional end) : 入力文字列から 1..n 文字の文字列を返します。
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$) : 文字列の右側にあるホワイトスペースを切り詰めます。
rtrim$(string$) : 文字列の右側にあるホワイトスペースを切り詰めます。
space(n) : 指定文字数 n のスペースから構築される文字列を返します。
space$(n) : 指定文字数 n のスペースから構築される文字列を返します。
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$) : 文字列を切り詰めます。
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



算術処理

abs(value) : 数値から絶対値を返します。
acos(value) : 数値からアークコサインを返します。
asin(value) : 数値からアークサインを返します。
atan(value) : 数値からアークタンジェントを返します。
bin(value) : 数値から二進数形式を返します。
bin$(value) : 数値から二進数形式を返します。
cos(value) : 数値からコサインを返します。
exp(value) : 指数関数を返します。
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) : 数値から十六進数形式を返します。
hex$(value) : 数値から十六進数形式を返します。
int(value) : convert to 32 bit integer, truncating decimals
log(value) : 式から自然対数を返します。
randomize(value) : 疑似乱数生成器で使うシード値を再指定します。
rnd(optional upper) : 乱数を返します。
round(value) : 最近似整数で切り下げます。
sgn(value) : 数値式の正負符号を返します。
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) : 演算数の論理積を返します。
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



ファイル

open[filename]for{input|output|append}as[stream]: ファイルストリームを開きます。
file input [stream] : ファイルストリームから一行読み取ります。
input [stream] : ファイルストリームから一行読み取ります。
file output [stream] : ファイルストリームへ一行書き込みます。
print [stream] : ファイルストリームへ一行書き込みます。
close [stream] : ファイルストリームを閉じます。

eof(stream) : EOF の場合は非ゼロを返します。
fileexists(filename) : ファイルが存在すれば true を返します。
filecopy(source,dest) : ファイルをコピーします。
filemove(source,dest) : ファイルを移動します。
filerename(filename,newname) : ファイル名を変更します。
freefile() : 次回以降に利用可能な空きファイルストリームのハンドルを返します。
kill(filename) : ファイルを削除します。filename には「パス+ファイル名」を指定します。
filedelete(filename) : ファイルを削除します。filename には「パス+ファイル名」を指定します。
loc(stream) : ファイルの読み取り・書き込み指示位置を返します。
lof(stream) : ファイルの長さを返します。
readbyte(stream) : ファイルから単バイト返します。
rename(filename,newname) : ファイル名を変更します。
seek(stream) : ファイルの探査位置、あるいは現在のファイル位置を返します。
writebyte(stream,byte) : ファイルに単バイトを書き込みます。



ディレクトリ

chdir(path) : ディレクトリを変更します。
dir dir$ : 現在のパスを返します。
direxists(path) : ディレクトリが存在すれば true を返します。
dirfirst(path) : path で指定されたディレクトリにある最初のエントリを返します。
dirnext : path で指定されたディレクトリにある次のエントリを返します。
mkdir(path) : 新しいディレクトリを作成します。
rmdir(path) : ディレクトリを削除します。



Data 関数

data(必要に応じて 0 ~ 255 の引数を指定) : 定数配列データを割り当てます。
read(必要に応じてポインタを指定) : ポインタを渡さない場合、 read コマンドは現在の Data 値を読み取り後に次の Data 値へポインタを移動します。



コンソール出力

print [text|variable|number] : 準出力へ式を表示します (デバッグ出力用)



日付と時刻

date() : 日付を MM-DD-YYYY 形式で返します。
date$() : 日付を MM-DD-YYYY 形式で返します。
time() : 現在時刻を HH:MM:SS 形式で返します。
time$() : 現在時刻を HH:MM:SS 形式で返します。
ticks() : 現在のタイマー値を返します。



メモリバンク


reservebank(bank,size) : 指定されたサイズで新しい物理メモリバンクを作成します。 0 ~ 256 バンクまで指定可能です。
baseimage(bank,image) : ビットマップとしてアクセスするイメージバンクとメモリバンクをリンクします。
baseimageCC(bank,image) : ビットマップとしてアクセスするイメージバンクにおいてメモリバンクをカラーキーの透過度をリンクします。
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) : 指定されたアドレスに従いメモリバンクへ単バイトを書き込みます。
doke(optional bank,address,value) :指定されたアドレスに従いメモリバンクへ 2 バイト (16 bits) を書き込みます。
loke(optional bank,address,value) : 指定されたアドレスに従いメモリバンクへ 4 バイト (32 bits) を書き込みます。

peek(optional bank,address) : 指定されたアドレスに従いメモリバンクから単バイト値を読み取ります。
deek(optional bank,address) : 指定されたアドレスに従いメモリバンクから 2 バイト (16 bits) 値を読み取ります。
leek(optional bank,address) : 指定されたアドレスに従いメモリバンクから 4 バイト (32 bits) 値を読み取ります。

memcopy(sbank,s,dbank,d,size) : メモリバンク s からメモリバンク d へその一部をコピーします。



スクリーン

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|4=window without decoration
setcaption(title) : change the display window title
setalphachannel(v) : activate deactivate alpha channel trasparency
caption() : 表示ウィンドウのタイトルを返します。

systemwidth : 現在のスクリーンの幅を返します。
systemheight : 現在のスクリーンの高さを返します。
displaymode : ディスプレイモードを返します。
displaywidth : ディスプレイの幅を返します。
displayheight : ディスプレイの高さを返します。
displaybpp : ディスプレイのカラー深度を返します。

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) : 論理スクリーンを閉じます。

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 : 現在のスクリーンの幅を返します。
screenheight : 現在のスクリーンの高さを返します。

offset(x,y) : 現在の論理スクリーンに関する座標を設定します。
screenoffset(x,y) : 現在の論理スクリーンに関する座標を設定します。
xoffset : 現在のスクリーンに関する X 座標のオフセットを返します。
screenoffsetx : 現在のスクリーンに関する X 座標のオフセットを返します。
yoffset : 現在のスクリーンに関する Y 座標のオフセットを返します。
screenoffsety : 現在のスクリーンに関する Y 座標のオフセットを返します。

cls : 現在の論理スクリーンを消去します。

screenswap : ディスプレイ、 bob システム、スプライトシステムを更新します。
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 : 自動スクリーンスワップで待機します。
fps(optional n) : set/unset or give the current frame rate counter (0/1/none)



グラフィックス

rgb(r,g,b) : 指定された RGB カラーを Uint32 形式で返します。
enablepalette(optional state) : 256 カラー表示 (8-bit) によるパレットモードの有効、無効化と照合を行います。
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) : 線を描画します。
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) : 閉鎖領域を塗り潰します。
triangle(xa,ya,xb,yb,xc,yc) : 塗り潰した三角形を描画します。
polyline(xa,ya,xb,yb,xc,yc,.....) : 多角形の輪郭線を描画します。
polygon(xa,ya,xb,yb,xc,yc,.....) : 塗り潰した多角形を描画します。



ファイルの入出力

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)



画像処理

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



画像転送

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



スプライトシステム

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) : 指定されたスプライト n の X 座標を返します。
spritex(n) : 指定されたスプライト n の X 座標を返します。
ysprite(n) : 指定されたスプライト n の Y 座標を返します。
spritey(n) : 指定されたスプライト n の Y 座標を返します。
spritewidth(n) : 指定されたスプライト n の幅を返します。
spriteheight(n) : 指定されたスプライト n の高さを返します。
frsprite(n) : スプライト n のフレームを返します。
spriteimage(n) : スプライト 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 システム

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

setbob(n,scr) : 指定されたスクリーン scr へ bob n を割り当てます。
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) : 指定された bob n の幅を返します。
bobheight(n) : 指定された bob の高さを返します。
frbob(n) : bob n のフレームを返します。
bobimage(n) : 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(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) : 現在のフォントを選択します。
getfont() : 現在のフォントを返します。
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



スクリーン出力

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 : テキストカーソルを非表示にします。
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



サウンドとミュージック

isenabledsound() : sdlsound が有効であれば 1 を返します。
soundenabled() : sdlsound が有効であれば 1 を返します。

soundexists(n) : 指定されたサウンドスロットが存在すれば 1 を、空であれば 0 を返します。
deletesound(n) : メモリからサウンド n を削除します。
copysound(s,d) : 指定されたサウンドスロット s を別のサウンドスロット n へコピーします。

musicexists() : ミュージックがロードされていれば 1 を、それ以外は 0 を返します。

playsound(n,c,optional l) : 指定されたチャンネル c のスロットにあるサウンド n を l 回を再生します。
playfreqsound(n,c,pitch,optional l) : 指定されたチャンネル n のサウンドを要求されたリサンプリング周波数 c で l 回を再生します。
volumesound(c,optional v) : チャンネル c (-1 は全体) の音量を値 v (0-128) で変更します。 v の省略時、または -1 の指定時は現在のミュージックトラックに関する音量を返します。
soundvolume(c,optional v) : チャンネル c (-1 は全体) の音量を値 v (0-128) で変更します。 v の省略時、または -1 の指定時は現在のミュージックトラックに関する音量を返します。
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) : 3D 空間におけるサウンドの位置を指定します。
positionsound(c,angle,dist) : 3D 空間におけるサウンドの位置を指定します。
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 : 以前に一時停止したミュージックトラックの再生を再開します。
rewindmusic : ミュージックトラックを先頭再生位置へ巻き戻します。
fademusic(t) : ミュージックをフェードインします。
volumemusic(optional v) : ミュージックトラックの音量 (0-128) を変更します。volume の省略時、または -1 の指定時は現在のミュージックトラックに関する音量を返します。
musicvolume(optional v) : ミュージックトラックの音量 (0-128) を変更します。volume の省略時、または -1 の指定時は現在のミュージックトラックに関する音量を返します。
speedmusic(v) : ミュージックトラックの再生速度を変更します。
musicspeed(v) : ミュージックトラックの再生速度を変更します。



CD サポート

numdrivescd() : システムに搭載されている CD-ROM ドライブの台数を返します。
countcddrives() : システムに搭載されている CD-ROM ドライブの台数を返します。
namecd(drive) : システム依存の CD-ROM 識別子を可読形式で返します。
cdname(drive) : システム依存の CD-ROM 識別子を可読形式で返します。
opencd(n,drive) : アクセスするために CD-ROM ドライブを開きます。
indrivecd(n) : コンパクトディスクが CD-ROM ドライブに挿入されていれば、 1 を返します。
cdinserted(n) : コンパクトディスクが CD-ROM ドライブに挿入されていれば、 1 を返します。
trackscd(n) : CD-ROM のトラック番号を返します。
countcdtracks(n) : CD-ROM のトラック番号を返します。
curtrackcd(n) : 現在再生中の CD-ROM のトラックを返します。
cdcurtrack(n) : 現在再生中の CD-ROM のトラックを返します。
curframecd(n) : CD-ROM における現在のフレーム数を返します。
cdcurframe(n) : CD-ROM における現在のフレーム数を返します。
playcd(n,s,l) : オーディオ CD を再生します。
playtrackscd(n,trk1,fr1,ntrks,nfrs) : トラック trk1 のフレーム fr1 で指定された CD トラックから n トラック (ntrks) / n フレーム (nfrs) までを再生します。
playtrackscd(n,trk1,ntrks) : トラック trk1 で指定された CD トラックから n トラック (ntrks) までを再生します。
playtrackscd(n) : 指定されたトラック番号をすべて再生します。
playcdtracks(n,trk1,fr1,ntrks,nfrs) : トラック trk1 のフレーム fr1 で指定された CD トラックから n トラック (ntrks) / n フレーム (nfrs) までを再生します。
playcdtracks(n,trk1,ntrks) : トラック trk1 で指定された CD トラックから n トラック (ntrks) までを再生します。
playcdtracks(n) : 指定されたトラック番号をすべて再生します。
pausecd(n) : 指定された CD-ROM の再生を一時停止します。
resumecd(n) : 以前に一時停止した CD-ROM の再生を再開します。
stopcd(n) : CD-ROM の再生を停止します。
ejectcd(n) : CD-ROM を取り出します。
closecd(n) : CD-ROM のハンドルを閉じます。
tracktypecd(n,t) : SDL_AUDIO_TRACK(0...) または SDL_DATA_TRACK(1...) を返します。
cdtracktype(n,t) : SDL_AUDIO_TRACK(0...) または SDL_DATA_TRACK(1...) を返します。
tracklengthcd(n,t) : トラック t の長さを返します。
cdtracklength(n,t) : トラック t の長さを返します。
trackoffsetcd(n,t) : このトラックに関する開始位置のオフセットをフレーム単位で返します。
cdtrackoffset(n,t) : このトラックに関する開始位置のオフセットをフレーム単位で返します。



MPEG ビデオ

loadmpeg(fname,usesound) : MPEG ビデオをロードします。
plaympeg(optional loop) : MPEG ビデオを再生します。
stopmpeg() : ビデオの再生を停止します。
deletempeg() : MPEG ビデオのストリームを閉じます。
pausempeg() : SMPEG オブジェクトの再生を一時停止、または再開します。
rewindmpeg() : MPEG の再生開始位置へ SMPEG オブジェクトを巻き戻します。
seekmpeg(p) : MPEG ビデオストリームの再生位置を 'bytes' バイト指定で頭出しします。
skipmpeg(s) : 指定された 'seconds' 秒数で MPEG ビデオストリームを再生します。
statusmpeg() : MPEG が再生中であれば 1 を、それ以外は 0 を返します。



キーボード

key(keycode) : 指定されたキーコードと一致するキーが押されていれば 1 を返します。
inkey : その時に押されたキーの ASCII コードを返します。
waitkey(optional keycode) : 指定されたキーが押されるまでプログラムの実行を一時停止します (0 =全てのキー)。



マウス

xmouse : ディスプレイにおけるマウスの絶対 X 座標を返します。
ymouse : ディスプレイにおけるマウスの絶対 Y 座標を返します。
mousex : ディスプレイにおけるマウスの絶対 X 座標を返します。
mousey : ディスプレイにおけるマウスの絶対 Y 座標を返します。
xmousescreen(n) : 指定されたスクリーンにおけるマウスの相対 X 座標を返します。
ymousescreen(n) : 指定されたスクリーンにおけるマウスの相対 Y 座標を返します。
mousescreenx(n) : 指定されたスクリーンにおけるマウスの相対 X 座標を返します。
mousescreeny(n) : 指定されたスクリーンにおけるマウスの相対 Y 座標を返します。
bmouse : マウスボタンの状態を返します。
mousebutton : マウスボタンの状態を返します。
changemouse(optional n) :デフォルト (0) のマウスポインタを変更します。代替マウスポインタはスプライト 0 とスロットイメージ 0 (1, 2, 3) でエミュレートされます。ポインタ番号の省略時、現在使用しているポインタ n を返します。
mousepointer(optional n) : デフォルト (0) のマウスポインタを変更します。代替マウスポインタはスプライト 0 とスロットイメージ 0 (1, 2, 3) でエミュレートされます。ポインタ番号の省略時、現在使用しているポインタ n を返します。
locatemouse(x,y) : x, y 座標へマウスポインタを移動します。
placemouse(x,y) : x, y 座標へマウスポインタを移動します。
mouseshow : マウスカーソルを表示状態にします。
howmouse : マウスカーソルを表示状態にします。
mousehide : マウスカーソルを非表示状態にします。
hidemouse : マウスカーソルを非表示状態にします。
mousezone(x,y,w,h) : マウスポインタが指定された矩形領域内 (w, h のサイズは x, y である) にあれば 1 返します。



ジョイスティック

numjoysticks : 利用可能なジョイスティックの台数を返します。
namejoystick(index) : ジョイスティックの名称を取得します。
numaxesjoystick(i) : ジョイスティックで利用可能なアナログ軸の搭載数を取得します。
numballsjoystick(i) : ジョイスティックで利用可能なトラックボールの搭載数を取得します。
numhatsjoystick(i) : ジョイスティックで利用可能なハットの搭載数を取得します。
numbuttonsjoystick(i) : ジョイスティックで利用可能なボタンの搭載数を取得します。
getaxisjoystick(i,a) : アナログ軸に関する現在の状態を取得します。
gethatjoystick(i,a) : ハットに関する現在の状態を取得します。
getbuttonjoystick(i,a) : 指定されたジョイスティックのボタンに関する状態を取得します。
xgetballjoystick(i,a) : トラックボールの移動を相対 x 座標で取得します。
ygetballjoystick(i,a) : トラックボールの移動を相対 y 座標で取得します。
joy(i) : ジョイスティックのスティックに関する座標を論理値 (ブーリアン) で取得します。
bjoy(i) : ジョイスティックで押されたボタンを論理値 (ブーリアン) の式で返します。
joybuttons(i) : ジョイスティックで押されたボタンを論理値 (ブーリアン) の式で返します。
fire(i) : ジョイスティックで押されたボタンを論理値 (ブーリアン) の式で返します。
waitbjoy(b,optional i) : ジョイスティックのボタン (またはキーボードによるエミュレート) が押されるまで待機します。



SDLtime

wait(t) : t ミリ秒間待機します。
timer : 現在のティックを取得します。



ソケット

isenabledsock() : sdlnet が有効であれば 1 を返します。

sock=getfreesock() : sdlSocket 配列にある最初の空き sock (ソック) を返します。
sock=OpenSock(port) : 指定されたポート番号によりソケットをリスニングモード (着信待ち受け) で開きます。sdlBasic では最大 256 ソケットストリームまで利用可能です。
概念上、ソケットの処理は sdlBasic のファイル操作との類似性があります。
AcceptSock(serversock) : クライアントとの接続を確立後にクライアントのソケットを返します。
IsServerReady(Sock) : サーバがデータを送信中ならば True を、そうでなければ False を返します。
sock=ConnectSock(ServerName,port) : クライアント側のソケット接続です。
*ConnectionReadySock(sock) : サーバとの接続を確立します。

IsClientReady(Sock) : クライアントがデータを送信中ならば True を、そうでなければ False を返します。
CloseSock(sock) : ソケットの接続を閉じます。クライアントとサーバーサイドともに動作します
*PeekSock(Sock, NumBytes) : ソケットから得た情報を参照します (消去はしません)。

ReadSock(Sock, NumBytes) : 指定された NumBytes 数をソケットから読み取ります。
ReadByteSock(Sock) : 指定されたソケットから単バイトを読み取ります。
ReadLineSock(Sock) : 指定されたソケットから一行まるごと読み取ります。
WriteSock(Sock, Message, NumBytes) : Message から NumBytes を送信します。
WriteByteSock(Sock, Byte) : ソケットへ単バイトを送信します。
WriteLineSock(Sock, Message) : メッセージを送信します。
getremoteip(sock) : 接続されたクライアントのリモート IP アドレスを返します
getremoteport(sock) : 接続されたクライアントのリモートポートアドレスを返します
?getlocalip() : ローカル IP アドレスを返します (Windows では動作しません)。




SQLite データベース

SqlOpen( filename, n ) :
SqlClose( n ) :
SqlPrepare( n, pnum, sql )
SqlFinalize( n )
SqlStep( n )
SqlGetRows( n )
SqlGetColumns( n )
SqlGetText( n, col )
SqlGetImage( n, col, imageslot )








sdlbasic で生成
グラフィックス: zoiba