; ; ------------------------------------------------------------ ; ; SpiderBasic - WindowedScreen example file ; ; (c) Fantaisie Software ; ; ------------------------------------------------------------ ; Debug "uses arrow keys to move" OpenWindow(0, 20, 20, 820, 620, "A screen in a window...", #PB_Window_SystemMenu | #PB_Window_ScreenCentered) OpenWindowedScreen(WindowID(0), 10, 10, 800, 600) Procedure RenderFrame() Static x = 150, y = 50 ClearScreen(RGB(0, 0, 0)) If ExamineKeyboard() If KeyboardPushed(#PB_Key_Left) x-2 ElseIf KeyboardPushed(#PB_Key_Right) x+2 EndIf If KeyboardPushed(#PB_Key_Up) y-2 ElseIf KeyboardPushed(#PB_Key_Down) y+2 EndIf DisplaySprite(0, x, y) EndIf FlipBuffers() ; continue the rendering EndProcedure Procedure Loading(Type, Filename$, ObjectId) Static NbLoadedElements NbLoadedElements+1 If NbLoadedElements = 1 ; The loading of all images and sounds is finished, we can start the rendering FlipBuffers() ; start the rendering EndIf EndProcedure Procedure LoadingError(Type, Filename$, ObjectId) Debug Filename$ + ": loading error" EndProcedure ; Register the loading event before calling any resource load command BindEvent(#PB_Event_Loading, @Loading()) BindEvent(#PB_Event_LoadingError, @LoadingError()) BindEvent(#PB_Event_RenderFrame, @RenderFrame()) LoadSprite(0, "Data/SpiderBasicLogo.png")