; ; ------------------------------------------------------------ ; ; PureBasic - Window 3D ; ; (c) Fantaisie Software ; ; ------------------------------------------------------------ ; #MainWindow = 0 #CloseButton = 0 IncludeFile #PB_Compiler_Home + "examples/3d/Screen3DRequester.pb" Define.f KeyX, KeyY, MouseX, MouseY If InitEngine3D() Add3DArchive(#PB_Compiler_Home + "examples/3d/Data/GUI", #PB_3DArchive_FileSystem) Add3DArchive(#PB_Compiler_Home + "examples/3d/Data/Packs/desert.zip", #PB_3DArchive_Zip) InitSprite() InitKeyboard() InitMouse() If Screen3DRequester() SkyBox("desert07.jpg") CreateCamera(0, 0, 0, 100, 100) ; Front camera MoveCamera(0,0,100,100, #PB_Absolute) OpenWindow3D(#MainWindow, 100, 100, 300, 100, "Hello in 3D !") ButtonGadget3D(#CloseButton, 150, 40, 120, 25, "Quit") ShowGUI(128, 1) ; Отображение GUI, полу-прозрачность и отображение курсора мыши Repeat Screen3DEvents() If ExamineKeyboard() And ExamineMouse() Input$ = KeyboardInkey() InputEvent3D(MouseX(), MouseY(), MouseButton(#PB_MouseButton_Left), Input$, 0) EndIf ; Обработка события GUI 3D, это похоже на обычные события GUI ; Repeat Event = WindowEvent3D() Select Event Case #PB_Event3D_CloseWindow If EventWindow3D() = #MainWindow CloseWindow3D(#MainWindow) EndIf Case #PB_Event3D_Gadget If EventGadget3D() = #CloseButton Quit = 1 EndIf EndSelect Until Event = 0 RenderWorld() FlipBuffers() Until KeyboardPushed(#PB_Key_Escape) Or Quit = 1 EndIf Else MessageRequester("Ошибка", "3D Движок не может быть инициализирован", 0) EndIf