peter
12-05-2013, 23:15
Sdl Demo
#INCLUDE "sdl.inc"
SDL_Window 640,480,1
Long bild,x,y,mouse,fo,tree,weed
Long dir,x1,y1,zr,zl,zu,zd
Single v1,v2,v3,v4
dir=1 : y1=480-64 : zr=12 : zl=8 : zu=4
fo = SDL_LoadFont "fonts/font1.ttf",38
tree = SDL_LoadImage "png/tree.png",1
weed = SDL_LoadImage "png/weed.png",1
mouse= SDL_LoadTile "png/bitmap.png",16,4
While SDL_Key(27)=0
SDL_Cls SDL_RGB(20,200,255)
SDL_Text fo,180,0,"HELLO IS A SDL DEMO", SDL_RGB(255,255,0)
SDL_Sprite tree,200,150,0
SDL_Sprite weed,0,432,0
If dir=1 Then
SDL_Tile mouse,x1,y1,zr,0
v1 +=.1
If v1 >=1 Then
v1=0
zr +=1
iF zr=16 then zr=12
EndIf
x1 +=1
If x1 >= 640-64 Then
dir=2
zr=12
EndIf
EndIf
If dir=2 Then
SDL_Tile mouse,x1,y1,zu,0
v2 +=.1
If v2 >=1 Then
v2 =0
zu +=1
iF zu=8 then zu=4
EndIf
y1 -=1
If y1 <=0 Then
dir=3
zu=4
EndIf
EndIf
If dir=3 Then
SDL_Tile mouse,x1,y1,zl,0
v3 +=.1
If v3 >=1 Then
v3=0
zl +=1
iF zl=12 then zl=8
EndIf
x1 -=1
If x1 <=0 Then
dir=4
zl=8
EndIf
EndIf
If dir=4 Then
SDL_Tile mouse,x1,y1,zd,0
v4 +=.1
If v4 >=1 Then
v4=0
zd +=1
iF zd=4 then zd=0
EndIf
y1 +=1
If y1 >= 480-64 Then
dir=1
zd=0
EndIf
EndIf
SDL_Sync
Wend
SDL_Quit
#INCLUDE "sdl.inc"
SDL_Window 640,480,1
Long bild,x,y,mouse,fo,tree,weed
Long dir,x1,y1,zr,zl,zu,zd
Single v1,v2,v3,v4
dir=1 : y1=480-64 : zr=12 : zl=8 : zu=4
fo = SDL_LoadFont "fonts/font1.ttf",38
tree = SDL_LoadImage "png/tree.png",1
weed = SDL_LoadImage "png/weed.png",1
mouse= SDL_LoadTile "png/bitmap.png",16,4
While SDL_Key(27)=0
SDL_Cls SDL_RGB(20,200,255)
SDL_Text fo,180,0,"HELLO IS A SDL DEMO", SDL_RGB(255,255,0)
SDL_Sprite tree,200,150,0
SDL_Sprite weed,0,432,0
If dir=1 Then
SDL_Tile mouse,x1,y1,zr,0
v1 +=.1
If v1 >=1 Then
v1=0
zr +=1
iF zr=16 then zr=12
EndIf
x1 +=1
If x1 >= 640-64 Then
dir=2
zr=12
EndIf
EndIf
If dir=2 Then
SDL_Tile mouse,x1,y1,zu,0
v2 +=.1
If v2 >=1 Then
v2 =0
zu +=1
iF zu=8 then zu=4
EndIf
y1 -=1
If y1 <=0 Then
dir=3
zu=4
EndIf
EndIf
If dir=3 Then
SDL_Tile mouse,x1,y1,zl,0
v3 +=.1
If v3 >=1 Then
v3=0
zl +=1
iF zl=12 then zl=8
EndIf
x1 -=1
If x1 <=0 Then
dir=4
zl=8
EndIf
EndIf
If dir=4 Then
SDL_Tile mouse,x1,y1,zd,0
v4 +=.1
If v4 >=1 Then
v4=0
zd +=1
iF zd=4 then zd=0
EndIf
y1 +=1
If y1 >= 480-64 Then
dir=1
zd=0
EndIf
EndIf
SDL_Sync
Wend
SDL_Quit