Code: Alles auswählen
InitEngine3D()
InitKeyboard()
;InitMouse()
InitSprite()
hoehe1=60
If OpenWindow(0, 0, 0, 1200, 900,"TEST",#PB_Window_SystemMenu|#PB_Window_SizeGadget)
OpenWindowedScreen(WindowID(0), 0, 0, 800, 800, 0.1, 0, 0)
If CreateGadgetList(WindowID(0))
ButtonGadget(1,1050, 110,60,20,"Button 1")
ButtonGadget(2,1050, 140,60,20,"Button 2")
ButtonGadget(3,1050, 170,60,20,"Button 3")
TextGadget (4,1050, 210,60,30,"")
EndIf
EndIf
Define.f cameraX, cameraY,cameraZ
Define.f cameraRotationX,cameraRotationY, cameraRotationZ, hoehe, hoehe1
Add3DArchive(".", #PB_3DArchive_FileSystem)
AmbientColor(RGB(155,255,255))
CreateMaterial (0, LoadTexture(0, "Terrain_Texture5.png"))
AddMaterialLayer(0, LoadTexture(1, "Terrain_Detail1.jpg"), 1)
CreateTerrain("terrain03a.png",MaterialID(0),1, 1, 1)
;WorldShadows(#PB_Shadow_Modulative) ; funktioniert nicht
;;CreateLight(0, RGB(0,0,255), 700, 200, 990) ; Blue light funktioniert nicht
CreateCamera(0, 0, 0, 100, 100)
CameraLocate(0, 200, 100, 210)
CameraFOV(0, 71)
CameraProjection(0, #PB_Camera_Perspective )
;CameraRenderMode(0, #PB_Camera_Wireframe)
Repeat
ExamineKeyboard()
;ExamineMouse()
Event = WaitWindowEvent(1)
WindowID = EventWindow()
GadgetID = EventGadget()
EventType = EventType()
Select GadgetID
Case 1, 2, 3
SetGadgetText(4,"Button "+Str(GadgetID)+" pressed.")
EndSelect
If KeyboardPushed(#PB_Key_Pad7)
cameraRotationX+1
ElseIf KeyboardPushed(#PB_Key_Pad4)
cameraRotationX-1
Else
cameraRotationX=0
EndIf
If KeyboardPushed(#PB_Key_Pad8)
cameraRotationY=0.1
ElseIf KeyboardPushed(#PB_Key_Pad5)
cameraRotationY=-0.1
Else
cameraRotationY=0
EndIf
If KeyboardPushed(#PB_Key_Pad9)
cameraRotationZ=0.1
ElseIf KeyboardPushed(#PB_Key_Pad6);Z
cameraRotationZ=-0.1
Else
cameraRotationZ=0
EndIf
If KeyboardPushed(#PB_Key_Up)
cameraZ-0.1
ElseIf KeyboardPushed(#PB_Key_Down)
cameraZ+0.1
Else
cameraZ=0
EndIf
If KeyboardPushed(#PB_Key_Left)
cameraX-0.1
ElseIf KeyboardPushed(#PB_Key_Right)
cameraX+0.1
Else
cameraX=0
EndIf
If KeyboardPushed(#PB_Key_PageUp)
hoehe1.l=hoehe1+1
ElseIf KeyboardPushed(#PB_Key_PageDown)
If hoehe1 > 1
hoehe1.l=hoehe1-1
EndIf
EndIf
hoehe = TerrainHeight(CameraX(0),CameraZ(0)) +hoehe1
RotateCamera(0, cameraRotationX, cameraRotationY, cameraRotationZ)
MoveCamera(0, cameraX,-(CameraY(0)-hoehe),cameraZ)
RenderWorld()
FlipBuffers()
Until Event = #PB_Event_CloseWindow Or KeyboardPushed(#PB_Key_Escape)
End