From f2821000cff18408e6d25994f15e0027c9404368 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ruben=20Mu=CC=88ller?= Date: Sat, 20 Aug 2011 21:43:17 +0200 Subject: [PATCH] tiledraw works! --- src/Draw.pbi | 6 +---- src/Functions.pbi | 61 ++++++++++++++++++++++++++++++++++++++++++----- src/Globals.pbi | 1 + 3 files changed, 57 insertions(+), 11 deletions(-) diff --git a/src/Draw.pbi b/src/Draw.pbi index f09a15e..188e483 100644 --- a/src/Draw.pbi +++ b/src/Draw.pbi @@ -35,10 +35,6 @@ EndProcedure Procedure DrawRunningGame() - StartDrawing(ScreenOutput()) - Box(0, 0, 200, 200, RGB(0, 255, 0)) - StopDrawing() - - DisplaySprite(GFXTileset, 20, 20) + DrawGui() DrawMap() EndProcedure diff --git a/src/Functions.pbi b/src/Functions.pbi index a3bce3a..900df30 100644 --- a/src/Functions.pbi +++ b/src/Functions.pbi @@ -5,24 +5,73 @@ ; * Tileset Procedure InitGraphics() GFXLogo = LoadSprite(#PB_Any, "../data/gfx/logo.bmp") - GFXTileset = LoadSprite(#PB_Any, "../data/gfx/tileset01.bmp") + GFXTileset = LoadSprite(#PB_Any, "../data/gfx/tileset01.bmp") EndProcedure 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 Procedure DrawTile(number.i, x.i, y.i) - Debug number.i - Debug x.i - Debug y.i + DisplaySprite(Tileset(number), x, y) + + ;Debug number.i + ;Debug x.i + ;Debug y.i EndProcedure 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 - +Procedure DrawGui() + Debug "This is an awesome Gui" +EndProcedure ; ***************************************************************************** ; * Menu diff --git a/src/Globals.pbi b/src/Globals.pbi index 7bce215..6ce768a 100644 --- a/src/Globals.pbi +++ b/src/Globals.pbi @@ -26,6 +26,7 @@ Global Font_H2 = LoadFont(2, "Verdana", 18) ; Graphics Global GFXLogo.i Global GFXTileset.i +Global Dim Tileset.i(2) ; Sounds LoadSound(0, #DATA_PATH + "sound/menu_change.wav")