working on this again
authorBrendan Hansen <brendan.f.hansen@gmail.com>
Mon, 1 Mar 2021 20:20:52 +0000 (14:20 -0600)
committerBrendan Hansen <brendan.f.hansen@gmail.com>
Mon, 1 Mar 2021 20:20:52 +0000 (14:20 -0600)
.gitignore
build.sh [changed mode: 0644->0755]
lib/gl/gl_utils.onyx
lib/imgui.onyx
lib/immediate_renderer.onyx
onyx-imgui.sublime-project
test/basic.onyx

index 3805cfce6fa84eac061a9d85d3936bb0e7867901..677129f7154456721cc067ea7cc8c65eec00ffb5 100644 (file)
@@ -1,2 +1,3 @@
+*.sublime-project
 *.sublime-workspace
 *.wasm
old mode 100644 (file)
new mode 100755 (executable)
index 1d3687f..f75d1e5
--- a/build.sh
+++ b/build.sh
@@ -1,3 +1,3 @@
 #!/bin/sh
 
-onyx -r js -V --use-post-mvp-features test/basic.onyx -o imgui.wasm
\ No newline at end of file
+onyx -r js -V --use-post-mvp-features test/basic.onyx -o imgui.wasm
index beb5c1620921113fa6d79992a467ac5036ed120a..2d0ddd7465bb6edbb04a95aa8abc91175e34ab2c 100644 (file)
@@ -27,7 +27,7 @@ Shader :: struct {
         vertex_shader, _   := compile_shader(vertex_source,   gl.VERTEX_SHADER);
         fragment_shader, _ := compile_shader(fragment_source, gl.FRAGMENT_SHADER);
 
-        // @Robustness: Errors in linkning the program are ignored right now.
+        // @Robustness: Errors in linking the program are ignored right now.
         shader_program, _ := link_program(vertex_shader, fragment_shader);
         program = shader_program;
 
index 7b8db6d6479926bed108b9bd592e6ea2d1ce8cda..385f9b1d33fdd3319b3ed2e0ace5291f855fecdd 100644 (file)
@@ -16,4 +16,6 @@
 
 package imgui
 
+#load "lib/gl/gl_utils"
 #load "lib/immediate_renderer"
+
index 2b7840d33908771ed2d36d5092b5534091fb2dc5..5c3528d2250cb7ff91067bddd84f45ea1b0946bd 100644 (file)
@@ -58,6 +58,10 @@ Immediate_Renderer :: struct {
         verticies = memory.make_slice(Immediate_Vertex, max_verticies);
     }
 
+    // As a small note, I love the pattern matching style of programming that
+    // can be done in situtations like this. Now, this isn't the most efficient
+    // because it is mostly just marshalling the arguments around, but the
+    // pattern matching at compile-time is very cool, I think at least.
     push_vertex :: proc {
         // If a color is not provided, the previous color is used.
         (use ir: ^Immediate_Renderer, position: Vector2) {
@@ -70,6 +74,7 @@ Immediate_Renderer :: struct {
 
             vertex_ptr.position = position;
             vertex_ptr.color = color;
+            vertex_ptr.texture = Vector2.{ 0, 0 };
         },
     }
 
@@ -83,6 +88,11 @@ Immediate_Renderer :: struct {
 
 
 
+
+// While the immediate renderer can be used on its own, below is a set of wrapping functions
+// that operate on a global immediate renderer. This is probably the most common way that 
+// it will be used.
+
 #private
 immediate_renderer : Immediate_Renderer;
 
index 21fd46ae5282ccb1a2ab41d1d5c99dae45221798..b72505aeda639d145309b1eea7e4506fd778af9d 100644 (file)
@@ -5,7 +5,7 @@
                        "path": "."
                },
                {
-                       "path": "C:\\dev\\onyx\\core"
+                       "path": "/home/brendan/dev/c/onyx/core"
                }
        ]
 }
index 1a1a32fe95d9f6261d57ff616ea0f7c9672a85a8..21b38252ccfa62969a0cb97efb38f473f20b571e 100644 (file)
@@ -31,13 +31,18 @@ update :: () {
 }
 
 draw :: () {
+    use imgui;
+
+    immediate_vertex(.{ 0, 0 }, color=.{ 1, 0, 0, 1 });
+    immediate_vertex(.{ 1, 0 });
+    immediate_vertex(.{ 0, 1 });
 }
 
 loop :: () {
     poll_events();
 
-    //update();
-    //draw();
+    update();
+    draw();
 }
 
 main :: (args: [] cstr) {