Scary keyboard behaviour with 3D !
Posted: Wed Apr 03, 2024 8:06 pm
Still not sure if this happens in every machine or what.
Please just look at the tip, an check
Just hit key '1', then '2', then '3', and all is as it should.
Then hit 'F5'
Then:
Just hit key '1', then '2', then 'Up', and it does not work
.
Please just look at the tip, an check
Just hit key '1', then '2', then '3', and all is as it should.
Then hit 'F5'
Then:
Just hit key '1', then '2', then 'Up', and it does not work
Code: Select all
InitEngine3D(#PB_Engine3D_NoLog,#PB_Compiler_Home+"Compilers\Engine3d.dll")
InitSprite():InitKeyboard():InitMouse()
OpenWindow(0,0,0,800,600,"tip",#PB_Window_BorderLess|#PB_Window_ScreenCentered)
OpenWindowedScreen(WindowID(0),0,0,800,600,0,0,0,#PB_Screen_WaitSynchronization)
Add3DArchive(#PB_Compiler_Home + "examples/3d/Data/Textures", #PB_3DArchive_FileSystem)
CreateLight(0,$EEEEEE,4,4,2,#PB_Light_Point)
CreateCamera(0,0,0,100,100):CameraProjectionMode(0,#PB_Camera_Perspective)
MoveCamera(0,0,0,10,#PB_Absolute)
CreateMaterial(0,LoadTexture(0,"soil_wall.jpg"))
; MaterialBlendingMode(0,#PB_Material_Color)
CreateCylinder(0,0.5,1):CreateEntity(0,MeshID(0),MaterialID(0),-2,0,0)
CreateCone(1,0.3,2):CreateEntity(1,MeshID(1),MaterialID(0))
CreateCylinder(2,0.25,2):CreateEntity(2,MeshID(2),MaterialID(0),2,0,0)
Macro atach
AttachEntityObject(0,"",EntityID(1))
AttachEntityObject(1,"",EntityID(2))
EndMacro
Macro dtach
DetachEntityObject(1,EntityID(2))
DetachEntityObject(0,EntityID(1))
EndMacro
Macro rstor
MoveEntity(0,-2,0,0)
MoveEntity(1,0,0,0)
MoveEntity(2,2,0,0)
RotateEntity(0,0,0,0)
RotateEntity(1,0,0,0)
RotateEntity(2,0,0,0)
EndMacro
Repeat
While WindowEvent():Wend
ExamineKeyboard()
If KeyboardReleased(#PB_Key_Up)
ElseIf KeyboardReleased(#PB_Key_1)
atach
ElseIf KeyboardReleased(#PB_Key_2)
dtach
ElseIf KeyboardReleased(#PB_Key_Up); <- with KeyboardReleased(#PB_Key_3) it works, with KeyboardReleased(#PB_Key_Up) it does not !! ??
rstor
ElseIf KeyboardReleased(#PB_Key_3); <- with KeyboardReleased(#PB_Key_3) it works, with KeyboardReleased(#PB_Key_Up) it does not !! ??
rstor
ElseIf KeyboardReleased(#PB_Key_F5)
dtach
rstor
ElseIf KeyboardPushed(#PB_Key_left):x.f-0.01
EntityLookAt(1,x,3,0,0,1,0)
ElseIf KeyboardPushed(#PB_Key_right):x.f+0.01
EntityLookAt(1,x,3,0,0,1,0)
EndIf
RenderWorld()
FlipBuffers()
Until KeyboardPushed(#PB_Key_Escape)