November 28, 2020, 10:55:06 AM

Author Topic: [bmx] MINIB3D Mouselook workaround for linux by D4NM4N [ 1+ years ago ]  (Read 575 times)

Offline BlitzBot

  • Jr. Member
  • **
  • Posts: 1
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 :
Code: BlitzMax
  1. Type T_MouseLook
  2.         Field resetX%
  3.         Field resetY%
  4.         Field speedX%  'use these if using turnentity
  5.         Field speedY%  
  6.         Field pitch:float  'use these if using rotateentity
  7.         Field yaw:float
  8.  
  9.         Method Init(rX% , rY%)
  10.                 resetX = rx
  11.                 resetY = ry
  12.         End Method
  13.        
  14.         Method Pollmouse()
  15.                 speedX = resetX - MouseX()
  16.                 speedY = resetY - MouseY()
  17.                 yaw :- Float(-speedX) / 15
  18.                 pitch :+ Float(-speedY) / 15
  19.                 MoveMouse(resetX,resetY)       
  20.         End Method
  21.        
  22.         Method flush()
  23.                 speedX = 0
  24.                 speedY = 0
  25.                 MoveMouse(resetX,resetY)
  26.         End Method     
  27. End Type
  28.  
  29. 'Initialise mouselook
  30. local mlook:T_MouseLook=New t_mouselook
  31. mlook.init(512,350) ' or width & height*.5 etc
  32. mlook.flush() 'kills any initial movements
  33.  
  34. While Not KeyDown(KEY_ESCAPE)          
  35.  
  36.         ;Poll mouse and adjust rotation values.
  37.         mlook.pollmouse()
  38.         RotateEntity cam, mlook.pitch, mlook.yaw, 0
  39.         (......rest of main loop)


Comments :


D4NM4N(Posted 1+ years ago)

 .


 

SimplePortal 2.3.6 © 2008-2014, SimplePortal