SyntaxBomb - Indie Coders
Languages & Coding => Blitz Code Archives => User Input => Topic started by: BlitzBot on June 29, 2017, 00:28:41
Title : MINIB3D Mouselook workaround for linux
Author : D4NM4N
Posted : 1+ years ago
Description : Kind of a quick fix i threw together to fix the jumpy mousespeed on linux in minib3d.
I dont think i needed to make a type out of it though :/ still, it works :)
Code :
Type T_MouseLook
Field resetX%
Field resetY%
Field speedX% 'use these if using turnentity
Field speedY%
Field pitch:float 'use these if using rotateentity
Field yaw:float
Method Init(rX% , rY%)
resetX = rx
resetY = ry
End Method
Method Pollmouse()
speedX = resetX - MouseX()
speedY = resetY - MouseY()
yaw :- Float(-speedX) / 15
pitch :+ Float(-speedY) / 15
MoveMouse(resetX,resetY)
End Method
Method flush()
speedX = 0
speedY = 0
MoveMouse(resetX,resetY)
End Method
End Type
'Initialise mouselook
local mlook:T_MouseLook=New t_mouselook
mlook.init(512,350) ' or width & height*.5 etc
mlook.flush() 'kills any initial movements
While Not KeyDown(KEY_ESCAPE)
;Poll mouse and adjust rotation values.
mlook.pollmouse()
RotateEntity cam, mlook.pitch, mlook.yaw, 0
(......rest of main loop)
Comments :
D4NM4N(Posted 1+ years ago)
.