Code: Select all
InitEngine3D()
If InitSprite() = 0
MessageRequester("Error", "Can't open screen & sprite enviroment!", 0)
End
EndIf
If OpenWindow(0, 0, 0, 320, 200, "A screen in a window...", #PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_ScreenCentered)
CreateStatusBar(0, WindowID(0))
AddStatusBarField(320)
StatusBarText(0, 0, "Automatically zoomed screen area when changing window size...")
If OpenWindowedScreen(WindowID(0), 0, 0, 320, 200, 1, 0, 20)
CreateSprite(0, 50, 50) ; Create an empty sprite, will be whole black
; ====================================
; création caméra, objet , lumière
; ====================================
CreateCamera(0, 0, 0, 100, 100) ; Crée une caméra en (0,0) qui prend tout l'écran
CameraLocate(0 ,0,0,5)
CameraLookAt(0 ,0,0,0)
CameraBackColor(0, RGB(0, 0, 200))
CreateLight(0, RGB(255,255,255), 0,0,5) ; Crée une lumière blanche en position (0,0,5)
CreateCube(1,1)
CreateEntity(1, MeshID(1), #PB_Material_None ) ; pas de texture
EntityLocate(1, 0,0,0)
Repeat
; It's very important to process all the events remaining in the queue at each frame
;
Repeat
Event = WaitWindowEvent(10)
If Event = #PB_Event_CloseWindow
End
EndIf
Until Event = 0
RenderWorld()
DisplaySprite(0, 10, 10) ; Display our black box at the left-top corner
DisplaySprite(0, 260, 10) ; Display our black box at the right-top corner
FlipBuffers()
;ClearScreen(RGB(0, 0, 200)) ; A blue background
ForEver
Else
MessageRequester("Error", "Can't open windowed screen!", 0)
EndIf
EndIf