Fix the window bug and extract the screen resolution
This commit is contained in:
parent
4e6468eaa4
commit
e01046e2a0
2 changed files with 26 additions and 9 deletions
|
@ -2,8 +2,12 @@
|
||||||
; Very simple game to get started with PureBasic and the game development.
|
; Very simple game to get started with PureBasic and the game development.
|
||||||
; 2011 - Ruben Mueller, Aaron Mueller
|
; 2011 - Ruben Mueller, Aaron Mueller
|
||||||
|
|
||||||
|
XIncludeFile "structs.pb"
|
||||||
|
|
||||||
fullscreen = 0
|
fullscreen = 0
|
||||||
title.s = "Pongr - Build " + Str(#PB_Editor_BuildCount)
|
title.s = "Pongr - Build " + Str(#PB_Editor_BuildCount)
|
||||||
|
screen.ScreenDimension\width = 800
|
||||||
|
screen.ScreenDimension\height = 600
|
||||||
|
|
||||||
Procedure DrawOnScreen()
|
Procedure DrawOnScreen()
|
||||||
CreateSprite(0, 20, 20)
|
CreateSprite(0, 20, 20)
|
||||||
|
@ -16,14 +20,14 @@ EndProcedure
|
||||||
|
|
||||||
; Initialize subsystems
|
; Initialize subsystems
|
||||||
If InitSprite() = 0 Or InitKeyboard() = 0
|
If InitSprite() = 0 Or InitKeyboard() = 0
|
||||||
MessageRequester("Error", "Sorry, cant boot up.", 0)
|
MessageRequester("Error", "Sorry, can't boot up.", 0)
|
||||||
End
|
End
|
||||||
EndIf
|
EndIf
|
||||||
|
|
||||||
; Start the main loop which will create the window, wait for events and draw things
|
; Start the main loop which will create the window, wait for events and draw things
|
||||||
; on the screen. To escape from this loop, press ESC or close the window.
|
; on the screen. To escape from this loop, press ESC or close the window.
|
||||||
If OpenWindow(0, 0, 0, 800, 600, title, #PB_Window_ScreenCentered)
|
If OpenWindow(0, 0, 0, screen\width, screen\height, title, #PB_Window_ScreenCentered)
|
||||||
If OpenWindowedScreen(WindowID(0), 0, 0, 800, 600, 0, 0, 0)
|
If OpenWindowedScreen(WindowID(0), 0, 0, screen\width, screen\height, 0, 0, 0)
|
||||||
EndIf
|
EndIf
|
||||||
|
|
||||||
Repeat
|
Repeat
|
||||||
|
@ -34,9 +38,7 @@ If OpenWindow(0, 0, 0, 800, 600, title, #PB_Window_ScreenCentered)
|
||||||
|
|
||||||
; Handle input
|
; Handle input
|
||||||
ExamineKeyboard()
|
ExamineKeyboard()
|
||||||
; Does not work properly ...
|
If KeyboardReleased(#PB_Key_F)
|
||||||
; http://www.purebasic.fr/german/viewtopic.php?f=4&t=23730&p=285175
|
|
||||||
If KeyboardPushed(#PB_Key_F)
|
|
||||||
CloseScreen()
|
CloseScreen()
|
||||||
If fullscreen = 0
|
If fullscreen = 0
|
||||||
OpenScreen(800, 600, 32, title)
|
OpenScreen(800, 600, 32, title)
|
||||||
|
@ -55,8 +57,8 @@ If OpenWindow(0, 0, 0, 800, 600, title, #PB_Window_ScreenCentered)
|
||||||
Until KeyboardPushed(#PB_Key_Escape)
|
Until KeyboardPushed(#PB_Key_Escape)
|
||||||
EndIf
|
EndIf
|
||||||
; IDE Options = PureBasic 4.51 (Linux - x64)
|
; IDE Options = PureBasic 4.51 (Linux - x64)
|
||||||
; CursorPosition = 37
|
; CursorPosition = 23
|
||||||
; FirstLine = 8
|
; FirstLine = 12
|
||||||
; Folding = -
|
; Folding = -
|
||||||
; EnableXP
|
; EnableXP
|
||||||
; EnableCompileCount = 0
|
; EnableCompileCount = 0
|
||||||
|
|
15
pongr/structs.pb
Normal file
15
pongr/structs.pb
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
; This file holds all structs so we can include it in every
|
||||||
|
; file we need it.
|
||||||
|
|
||||||
|
Structure ScreenDimension
|
||||||
|
width.i
|
||||||
|
height.i
|
||||||
|
EndStructure
|
||||||
|
|
||||||
|
; IDE Options = PureBasic 4.51 (Linux - x64)
|
||||||
|
; CursorPosition = 7
|
||||||
|
; EnableUnicode
|
||||||
|
; EnableThread
|
||||||
|
; EnableXP
|
||||||
|
; EnableCompileCount = 0
|
||||||
|
; EnableBuildCount = 0
|
Reference in a new issue