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
@@ -109,7 +109,7 @@ npx uglify-js build/game.packed.js \
--compress --mangle toplevel --mangle-props regex=/^_/ \
-o build/game.min.js
npx roadroller -Zab14 -Zlr1113 -Zmd16 -Zpr14 -S0,1,2,3,6,7,13,21,25,50,235,333 build/game.min.js -o build/game.roadrolled.js
npx roadroller -Zab14 -Zlr930 -Zmd19 -Zpr14 -S0,1,2,3,7,13,14,19,58,97,305,422 build/game.min.js -o build/game.roadrolled.js
# Embed source into HTML
sed -e '/GAME_SOURCE/{r build/game.roadrolled.js' -e 'd}' source/html_template.html > build/index.html
+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