This commit is contained in:
2026-05-06 17:52:45 -07:00
parent 9fc3f35125
commit 1463c23334
402 changed files with 3758 additions and 0 deletions

View File

@ -0,0 +1,3 @@
Keyboard `Escape` to toggle mouse lock.
https://api.leenkx3d.org/iron/system/Mouse.html

View File

@ -0,0 +1,28 @@
package lnx;
import iron.math.Vec4;
import iron.system.Input;
class LockTrait extends iron.Trait {
public function new() {
super();
var mouse = Input.getMouse();
var kb = Input.getKeyboard();
notifyOnUpdate(() -> {
if (mouse.started("left")) {
mouse.lock();
} else if (kb.started("escape")) {
mouse.unlock();
}
var cube = iron.Scene.active.getChild("Cube");
if (cube != null) {
cube.transform.rotate(Vec4.zAxis(), mouse.movementX * 0.002);
cube.transform.rotate(Vec4.xAxis(), mouse.movementY * 0.002);
}
});
}
}

Binary file not shown.