From: Brendan Hansen Date: Thu, 22 Apr 2021 17:43:20 +0000 (-0500) Subject: changes with unary field access in Onyx X-Git-Url: https://git.brendanfh.com/?a=commitdiff_plain;h=622fb42df73d7c8ed221bb6f4dc73dca8175e781;p=sand-toy.git changes with unary field access in Onyx --- diff --git a/lib/immediate_renderer.onyx b/lib/immediate_renderer.onyx index 470a16c..5a7c315 100644 --- a/lib/immediate_renderer.onyx +++ b/lib/immediate_renderer.onyx @@ -100,6 +100,7 @@ Immediate_Renderer :: struct { gl.useProgram(shader.program); gl.bindVertexArray(vertex_array); gl.drawArrays(gl.TRIANGLES, 0, vertex_count); + gl.bindVertexArray(-1); vertex_count = 0; } diff --git a/site/sand_toy.wasm b/site/sand_toy.wasm index ad6c39b..4ed4bab 100644 Binary files a/site/sand_toy.wasm and b/site/sand_toy.wasm differ diff --git a/src/sand_toy.onyx b/src/sand_toy.onyx index aa75920..6d78cfb 100644 --- a/src/sand_toy.onyx +++ b/src/sand_toy.onyx @@ -32,10 +32,8 @@ window_width := 0 window_height := 0 poll_events :: () { - use events.DomEventKind; - for event: events.consume() do switch event.kind { - case Resize { + case .Resize { println("The window was resized!"); window_width = event.resize.width; @@ -45,8 +43,8 @@ poll_events :: () { gl.viewport(0, 0, window_width, window_height); } - case MouseDown { - if event.mouse.button == ~~0 { + case .MouseDown { + if event.mouse.button == .Left { println("Left button click!"); } } diff --git a/src/simulation.onyx b/src/simulation.onyx new file mode 100644 index 0000000..fab4f69 --- /dev/null +++ b/src/simulation.onyx @@ -0,0 +1,10 @@ + + +Particle :: struct { + Type :: enum { + Empty; + Sand; + } + + type := Type.Empty; +}