Code: Select all
EnableExplicit
#Camara = 3
#Entity = 3
#node= 3
#Light = 3
#Texture = 3
#Material = 3
#Mesh = 3
If ExamineDesktops()=0 : End : EndIf
Global bitplanes.a=DesktopDepth(0)
Global FRX.u=DesktopWidth(0)*0.9
Global FRY.u=DesktopHeight(0)*0.9
If InitEngine3D(#PB_Engine3D_NoLog,#PB_Compiler_Home+"Compilers\Engine3d.dll")=0
MessageRequester("Error","The 3D Engine can't be initialized",0)
End
EndIf
InitSprite()
InitKeyboard()
InitMouse()
OpenWindow(0,0,0,FRX,FRY,"special rotation",#PB_Window_BorderLess|#PB_Window_ScreenCentered)
OpenWindowedScreen(WindowID(0),0,0,FRX,FRY,1,0,0,#PB_Screen_WaitSynchronization)
Add3DArchive(#PB_Compiler_Home+"examples/3D/Data/Packs/skybox.zip",#PB_3DArchive_Zip)
SkyBox("stevecube.jpg")
CreateLight(#Light,$EEEEEE,4,4,2,#PB_Light_Point)
CreateCamera(#Camara,0,0,100,100)
CreateNode(#node,0,0,0)
CameraRange(#Camara,0.1,10000)
CameraBackColor(#Camara,$181911)
MoveCamera(#Camara,0,0,6,#PB_Absolute)
If CreateTexture(#Texture,32,32)
Global Font.i=LoadFont(#PB_Any,"Arial",8)
StartDrawing(TextureOutput(#Texture))
Box(0,0,16,16,RGB(255,0,0))
Box(16,0,16,16,RGB(0,255,0))
Box(0,16,16,16,RGB(0,0,255))
Box(16,16,16,16,RGB(255,255,0))
DrawingFont(FontID(Font))
DrawingMode(#PB_2DDrawing_Transparent)
DrawText(5,3,"Hello",RGB(0,0,0))
DrawText(2,15,"World",RGB(0,0,0))
StopDrawing()
EndIf
CreateNode(#node,0,0,0)
CreateMaterial(#material,TextureID(#Texture))
CreateCube(#Mesh,1)
CreateEntity(#Entity,MeshID(#Mesh),MaterialID(#material))
Global.f mdx,mdy,mdz,THETA
Global.b lmb,rmb,mmb
#speed=0.01
Repeat
While WindowEvent() : Wend
ExamineMouse()
ExamineKeyboard()
; lmb=MouseButton(#PB_MouseButton_Left)
rmb=MouseButton(#PB_MouseButton_Right)
; mmb=MouseButton(#PB_MouseButton_Middle)
mdx=MouseDeltaX()*#speed
mdy=MouseDeltaY()*#speed
mdz=MouseWheel()*#speed
If KeyboardPushed(#PB_Key_F5)
RotateEntity(#Entity, 0,0,0)
MoveNode(#node,0,0,0, #PB_Absolute)
ElseIf rmb
MoveNode(#node , mdx , -mdy , -mdz*30)
Else
DetachNodeObject(#node, EntityID(#Entity))
MoveEntity (#Entity,0,0,0,#PB_Absolute)
AttachNodeObject(#node, EntityID(#Entity))
RotateNode (#node, mdy*10 , mdx*10 , mdz*300)
EndIf
RenderWorld()
FlipBuffers()
Until KeyboardPushed(#PB_Key_Escape)