tiledraw works!

This commit is contained in:
Ruben Müller 2011-08-20 21:43:17 +02:00
parent 71f2ea055e
commit f2821000cf
3 changed files with 57 additions and 11 deletions

View file

@ -35,10 +35,6 @@ EndProcedure
Procedure DrawRunningGame() Procedure DrawRunningGame()
StartDrawing(ScreenOutput()) DrawGui()
Box(0, 0, 200, 200, RGB(0, 255, 0))
StopDrawing()
DisplaySprite(GFXTileset, 20, 20)
DrawMap() DrawMap()
EndProcedure EndProcedure

View file

@ -9,20 +9,69 @@ Procedure InitGraphics()
EndProcedure EndProcedure
Procedure InitTileset() Procedure InitTileset()
ClipSprite(GFXTileset, 0, 0, 16, 16) Tileset(0) = CopySprite(GFXTileset, #PB_Any)
ClipSprite(Tileset(0), 0, 0, 16, 16)
Tileset(1) = CopySprite(GFXTileset, #PB_Any)
ClipSprite(Tileset(1), 16, 0, 16, 16)
Tileset(2) = CopySprite(GFXTileset, #PB_Any)
ClipSprite(Tileset(2), 32, 0, 16, 16)
EndProcedure EndProcedure
Procedure DrawTile(number.i, x.i, y.i) Procedure DrawTile(number.i, x.i, y.i)
Debug number.i DisplaySprite(Tileset(number), x, y)
Debug x.i
Debug y.i ;Debug number.i
;Debug x.i
;Debug y.i
EndProcedure EndProcedure
Procedure DrawMap() Procedure DrawMap()
DrawTile(0, 0, 0);
DrawTile(0, 16, 0);
DrawTile(0, 32, 0);
DrawTile(0, 48, 0);
DrawTile(0, 64, 0);
DrawTile(0, 80, 0);
DrawTile(0, 96, 0);
DrawTile(0, 0, 16);
DrawTile(0, 16, 16);
DrawTile(0, 32, 16);
DrawTile(0, 48, 16);
DrawTile(0, 64, 16);
DrawTile(0, 80, 16);
DrawTile(0, 96, 16);
DrawTile(1, 0, 32);
DrawTile(1, 16, 32);
DrawTile(1, 32, 32);
DrawTile(0, 48, 32);
DrawTile(1, 64, 32);
DrawTile(1, 80, 32);
DrawTile(1, 96, 32);
DrawTile(0, 0, 48);
DrawTile(0, 16, 48);
DrawTile(0, 32, 48);
DrawTile(0, 48, 48);
DrawTile(0, 64, 48);
DrawTile(0, 80, 48);
DrawTile(0, 96, 48);
DrawTile(2, 0, 64);
DrawTile(2, 16, 64);
DrawTile(2, 32, 64);
DrawTile(2, 48, 64);
DrawTile(2, 64, 64);
DrawTile(2, 80, 64);
DrawTile(2, 96, 64);
EndProcedure EndProcedure
Procedure DrawGui()
Debug "This is an awesome Gui"
EndProcedure
; ***************************************************************************** ; *****************************************************************************
; * Menu ; * Menu

View file

@ -26,6 +26,7 @@ Global Font_H2 = LoadFont(2, "Verdana", 18)
; Graphics ; Graphics
Global GFXLogo.i Global GFXLogo.i
Global GFXTileset.i Global GFXTileset.i
Global Dim Tileset.i(2)
; Sounds ; Sounds
LoadSound(0, #DATA_PATH + "sound/menu_change.wav") LoadSound(0, #DATA_PATH + "sound/menu_change.wav")