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"> <section name="data">
<explorer view="../../../" pattern="0"/> <explorer view="../../../" pattern="0"/>
<log show="1"/> <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>
<section name="files"> <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"> <file name="src/Draw.pbi">
<config load="0" scan="1" panel="1" warn="1" lastopen="0"/> <config load="0" scan="1" panel="1" warn="1" lastopen="0"/>
<fingerprint md5="a4e930d97a78a4a24633817c8cc48f5c"/> <fingerprint md5="28d5e79f6b736428c0580d24de3999d6"/>
</file> </file>
<file name="src/Events.pbi"> <file name="src/Events.pbi">
<config load="0" scan="1" panel="1" warn="1" lastopen="0"/> <config load="0" scan="1" panel="1" warn="1" lastopen="0"/>
<fingerprint md5="e8dfdc327acab4f10066636b6d07de30"/> <fingerprint md5="747a1f6142b879e34b60e4c54569359d"/>
</file> </file>
<file name="src/Functions.pbi"> <file name="src/Functions.pbi">
<config load="0" scan="1" panel="1" warn="1" lastopen="1"/> <config load="0" scan="1" panel="1" warn="1" lastopen="0"/>
<fingerprint md5="94f32d32af86b8dd7fb98693843dd721"/> <fingerprint md5="5432329922208eb5928dbbb3199025fe"/>
</file> </file>
<file name="src/Globals.pbi"> <file name="src/Globals.pbi">
<config load="0" scan="1" panel="1" warn="1" lastopen="0"/> <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>
<file name="src/Structs.pbi"> <file name="src/Structs.pbi">
<config load="0" scan="1" panel="1" warn="1" lastopen="0"/> <config load="0" scan="1" panel="1" warn="1" lastopen="0"/>
@ -42,8 +42,10 @@
<target name="Default Target" enabled="1" default="1"> <target name="Default Target" enabled="1" default="1">
<inputfile value="src/Main.pb"/> <inputfile value="src/Main.pb"/>
<outputfile value="bin/escape.app"/> <outputfile value="bin/escape.app"/>
<executable value="bin/escape.app"/>
<options xpskin="1" debug="1"/> <options xpskin="1" debug="1"/>
<buildcount enable="1" value="0"/> <format exe="default" cpu="1"/>
<buildcount enable="1" value="5"/>
</target> </target>
</section> </section>
</project> </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 ; the dispatcher. The events are controlled by the
; HandleEventMenu() function. ; HandleEventMenu() function.
Procedure DrawMenu() Procedure DrawMenu()
Define Black = RGB(0, 0, 0) StartDrawing(ScreenOutput())
Define White = RGB(255, 255, 255) Define Black = RGB(0, 0, 0)
Define ActiveMenuItemColor = RGB(255, 0, 0) Define White = RGB(255, 255, 255)
Define ActiveMenuItemColor = RGB(255, 0, 0)
DrawingFont(Font_H1) DrawingFont(Font_H1)
DrawText(50, 50, *ActiveMenu\Title, white, black) DrawText(50, 50, *ActiveMenu\Title, white, black)
Define Offset = 0 Define Offset = 0
Define FontColor = White Define FontColor = White
ForEach *ActiveMenu\Entries() ForEach *ActiveMenu\Entries()
If *ActiveMenu\Entries()\Selected If *ActiveMenu\Entries()\Selected
FontColor = ActiveMenuItemColor FontColor = ActiveMenuItemColor
Else Else
FontColor = White FontColor = White
EndIf EndIf
DrawingFont(Font_H2) DrawingFont(Font_H2)
DrawText(50, 300+(Offset*30), *ActiveMenu\Entries()\Label, FontColor, Black) DrawText(50, 300+(Offset*30), *ActiveMenu\Entries()\Label, FontColor, Black)
Offset = Offset+1 Offset = Offset+1
Next Next
StopDrawing()
EndProcedure EndProcedure
Procedure DrawRunningGame() 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 EndProcedure

View file

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

View file

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

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 ; Draw the stuff on the screen
FlipBuffers() FlipBuffers()
ClearScreen(RGB(0, 0, 0)) ClearScreen(RGB(0, 0, 0))
If StartDrawing(ScreenOutput()) And CurrentState <> "QUIT"
If CurrentState <> "QUIT"
GameStates(CurrentState)\DrawFun() GameStates(CurrentState)\DrawFun()
StopDrawing()
EndIf EndIf
Delay(1) Delay(1)