sprites are workin!!

This commit is contained in:
Ruben Müller 2011-08-20 19:42:09 +02:00
parent 9dba2fb5ee
commit 70d783cc5e
9 changed files with 64 additions and 41 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

View File

@ -10,28 +10,28 @@
<section name="data">
<explorer view="../../../" pattern="0"/>
<log show="1"/>
<lastopen date="2011-08-20 18:02" user="rubenmueller" host="localhost"/>
<lastopen date="2011-08-20 19:33" user="rubenmueller" host="localhost"/>
</section>
<section name="files">
<file name="src/Main.pb">
<config load="0" scan="1" panel="1" warn="1" lastopen="0"/>
<fingerprint md5="71fe866eb4c44a6e8d63f049fa4721d4"/>
</file>
<file name="src/Draw.pbi">
<config load="0" scan="1" panel="1" warn="1" lastopen="0"/>
<fingerprint md5="a4e930d97a78a4a24633817c8cc48f5c"/>
<fingerprint md5="28d5e79f6b736428c0580d24de3999d6"/>
</file>
<file name="src/Events.pbi">
<config load="0" scan="1" panel="1" warn="1" lastopen="0"/>
<fingerprint md5="e8dfdc327acab4f10066636b6d07de30"/>
<fingerprint md5="747a1f6142b879e34b60e4c54569359d"/>
</file>
<file name="src/Functions.pbi">
<config load="0" scan="1" panel="1" warn="1" lastopen="1"/>
<fingerprint md5="94f32d32af86b8dd7fb98693843dd721"/>
<config load="0" scan="1" panel="1" warn="1" lastopen="0"/>
<fingerprint md5="5432329922208eb5928dbbb3199025fe"/>
</file>
<file name="src/Globals.pbi">
<config load="0" scan="1" panel="1" warn="1" lastopen="0"/>
<fingerprint md5="a1bb9ca37b7d3948c8a287a640230fad"/>
<fingerprint md5="4999be0d788b010d35c9c1c51b4cb78d"/>
</file>
<file name="src/Main.pb">
<config load="0" scan="1" panel="1" warn="1" lastopen="0"/>
<fingerprint md5="67a305c6fba8d36249b37da082e32e72"/>
</file>
<file name="src/Structs.pbi">
<config load="0" scan="1" panel="1" warn="1" lastopen="0"/>
@ -42,8 +42,10 @@
<target name="Default Target" enabled="1" default="1">
<inputfile value="src/Main.pb"/>
<outputfile value="bin/escape.app"/>
<executable value="bin/escape.app"/>
<options xpskin="1" debug="1"/>
<buildcount enable="1" value="0"/>
<format exe="default" cpu="1"/>
<buildcount enable="1" value="5"/>
</target>
</section>
</project>

20
spritetest.pbp Normal file
View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://www.purebasic.com/namespace" version="1.0" creator="PureBasic 4.51 (MacOS X - x86)">
<section name="config">
<options closefiles="1" openmode="0" name="Neues Projekt"/>
</section>
<section name="data">
<explorer view="../../../" pattern="0"/>
<log show="1"/>
<lastopen date="2011-08-20 19:32" user="rubenmueller" host="localhost"/>
</section>
<section name="files"/>
<section name="targets">
<target name="Standard-Ziel" enabled="1" default="1">
<inputfile value=""/>
<outputfile value=""/>
<options xpskin="1" debug="1"/>
</target>
</section>
</project>

View File

@ -7,31 +7,35 @@
; the dispatcher. The events are controlled by the
; HandleEventMenu() function.
Procedure DrawMenu()
Define Black = RGB(0, 0, 0)
Define White = RGB(255, 255, 255)
Define ActiveMenuItemColor = RGB(255, 0, 0)
DrawingFont(Font_H1)
DrawText(50, 50, *ActiveMenu\Title, white, black)
Define Offset = 0
Define FontColor = White
ForEach *ActiveMenu\Entries()
If *ActiveMenu\Entries()\Selected
FontColor = ActiveMenuItemColor
Else
FontColor = White
EndIf
StartDrawing(ScreenOutput())
Define Black = RGB(0, 0, 0)
Define White = RGB(255, 255, 255)
Define ActiveMenuItemColor = RGB(255, 0, 0)
DrawingFont(Font_H2)
DrawText(50, 300+(Offset*30), *ActiveMenu\Entries()\Label, FontColor, Black)
Offset = Offset+1
Next
DrawingFont(Font_H1)
DrawText(50, 50, *ActiveMenu\Title, white, black)
Define Offset = 0
Define FontColor = White
ForEach *ActiveMenu\Entries()
If *ActiveMenu\Entries()\Selected
FontColor = ActiveMenuItemColor
Else
FontColor = White
EndIf
DrawingFont(Font_H2)
DrawText(50, 300+(Offset*30), *ActiveMenu\Entries()\Label, FontColor, Black)
Offset = Offset+1
Next
StopDrawing()
EndProcedure
Procedure DrawRunningGame()
;Box(0, 0, 200, 200, RGB(0, 255, 0))
StartDrawing(ScreenOutput())
Box(0, 0, 200, 200, RGB(0, 255, 0))
StopDrawing()
DrawImage(ImageID(#Tile01), 20, 20)
DisplaySprite(Tile01, 20, 20)
EndProcedure

View File

@ -4,7 +4,7 @@
; *****************************************************************************
; * Tileset
Procedure InitTileset()
Tile01 = LoadSprite(#PB_Any, "../data/gfx/tileset01.bmp")
;ClipSprite(#Tile01, 0, 0, 16, 16)
EndProcedure

View File

@ -17,6 +17,8 @@ Global Font_H1 = LoadFont(1, "Courier", 40, #PB_Font_Bold)
Global Font_H2 = LoadFont(2, "Verdana", 18)
; Graphics
Global Tile01.i
Enumeration 500
#Tile01
#Tile02
@ -28,9 +30,4 @@ EndEnumeration
; Sounds
LoadSound(0, #DATA_PATH + "sound/menu_change.wav")
LoadSound(1, #DATA_PATH + "sound/menu_select.wav")
: Images
UseJPEGImageDecoder()
Debug LoadImage(#Tile01, #DATA_PATH+"gfx/tileset01.jp")
LoadSound(1, #DATA_PATH + "sound/menu_select.wav")

View File

@ -103,9 +103,9 @@ If OpenWindow(0, 0, 0, Screen\Width, Screen\Height, title, #PB_Window_ScreenCent
; Draw the stuff on the screen
FlipBuffers()
ClearScreen(RGB(0, 0, 0))
If StartDrawing(ScreenOutput()) And CurrentState <> "QUIT"
If CurrentState <> "QUIT"
GameStates(CurrentState)\DrawFun()
StopDrawing()
EndIf
Delay(1)