examples: core-triangle: cleanup width/height input handler

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
Stephen Gutekanst 2024-12-01 12:25:37 -07:00 committed by Emi Gutekanst
parent 3b45eda8df
commit 281884e9b0

View file

@ -75,14 +75,10 @@ pub fn tick(app: *App, core: *mach.Core) void {
.key_press => |ev| { .key_press => |ev| {
switch (ev.key) { switch (ev.key) {
.right => { .right => {
var w = core.windows.getValue(core.main_window); core.windows.set(core.main_window, .width, core.windows.get(core.main_window, .width) + 10);
w.width = w.width + 10;
core.windows.setValue(core.main_window, w);
}, },
.left => { .left => {
var w = core.windows.getValue(core.main_window); core.windows.set(core.main_window, .width, core.windows.get(core.main_window, .width) - 10);
w.width = w.width - 10;
core.windows.setValue(core.main_window, w);
}, },
.up => { .up => {
core.windows.set(core.main_window, .height, core.windows.get(core.main_window, .height) + 10); core.windows.set(core.main_window, .height, core.windows.get(core.main_window, .height) + 10);