Implement mouse invert checkbox

This commit is contained in:
Dominic Szablewski
2021-09-14 11:43:44 +02:00
parent babefbc083
commit a522cb597d
3 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -17,7 +17,7 @@ document.body.innerHTML +=
'<div id="h"></div><div id="a"></div>'+
'<div id="msg"></div>'+
'</div>'+
'<p>MOUSE SPEED: <input id="m" type="range" value=10 min=1 max=50></p>'+
'<p>MOUSE SPEED: <input id="m" type="range" value=10 min=1 max=50> INVERT: <input type="checkbox" id="mi"></p>'+
'<p><input id="f" type="button" value="FULLSCREEN"></p>'+
'<p>'+
'code: <a href="https://phoboslab.org">phoboslab.org</a> / music: <a href="http://no-fate.net">no-fate.net</a>'+
+1 -1
View File
@@ -24,7 +24,7 @@ class entity_player_t extends entity_t {
_update() {
// Mouse look
this._pitch = clamp(this._pitch + mouse_y * m.value * 0.00015, -1.5, 1.5);
this._pitch = clamp(this._pitch + mouse_y * m.value * (mi.checked ? -0.00015 : 0.00015), -1.5, 1.5);
this._yaw = (this._yaw + mouse_x * m.value * 0.00015) % (Math.PI*2);
// Acceleration in movement direction