; Pongr ; Very simple game to get started with PureBasic and the game development. ; 2011 - Ruben Mueller, Aaron Mueller fullscreen = 0 title.s = "Pongr - Build " + Str(#PB_Editor_BuildCount) Procedure DrawOnScreen() CreateSprite(0, 20, 20) If StartDrawing(SpriteOutput(0)) Box(0, 0, 20, 20, RGB(255, 0, 155)) Box(5, 5, 10, 10, RGB(155, 0, 255)) StopDrawing() EndIf EndProcedure ; Initialize subsystems If InitSprite() = 0 Or InitKeyboard() = 0 MessageRequester("Error", "Sorry, cant boot up.", 0) End EndIf ; 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. If OpenWindow(0, 0, 0, 800, 600, title, #PB_Window_ScreenCentered) If OpenWindowedScreen(WindowID(0), 0, 0, 800, 600, 0, 0, 0) EndIf Repeat ; Event loop Repeat event = WindowEvent() Until event = 0 ; Handle input ExamineKeyboard() ; Does not work properly ... ; http://www.purebasic.fr/german/viewtopic.php?f=4&t=23730&p=285175 If KeyboardPushed(#PB_Key_F) CloseScreen() If fullscreen = 0 OpenScreen(800, 600, 32, title) fullscreen = 1 Else OpenWindowedScreen(WindowID(0), 0, 0, 800, 600, 0, 0, 0) fullscreen = 0 EndIf EndIf ; Draw the stuff on the screen FlipBuffers() ClearScreen(RGB(0, 200, 0)) DrawOnScreen() Delay(1) Until KeyboardPushed(#PB_Key_Escape) EndIf ; IDE Options = PureBasic 4.51 (Linux - x64) ; CursorPosition = 37 ; FirstLine = 8 ; Folding = - ; EnableXP ; EnableCompileCount = 0 ; EnableBuildCount = 0