--- /dev/null
+package ouit
+
+/*
+
+Ouit ("Wheat") - The Onyx User-Interface Template
+
+An all-encompassing user-interface template for Onyx program thats makes
+it easy to setup a web-based user interface.
+
+*/
+
+#load "core/std"
+
+#load "modules/bmfont/module"
+#load "modules/immediate_mode/module"
+#load "modules/js_events/module"
+#load "modules/ui/module"
+#load "modules/webgl2/module"
+
+#load "./ouit"
\ No newline at end of file
--- /dev/null
+window.ONYX_MODULES = window.ONYX_MODULES || [];
+
+window.ONYX_MODULES.push({
+ module_name: "ouit",
+
+ loop: function() {
+ function loop() {
+ window.ONYX_INSTANCE.exports.ouit_loop();
+ window.requestAnimationFrame(loop);
+ }
+
+ window.requestAnimationFrame(loop);
+ },
+
+ time_now: function() {
+ return Date.now();
+ },
+});
\ No newline at end of file
--- /dev/null
+package ouit
+
+#private_file {
+ gl :: package gl
+ gfx :: package immediate_mode
+ events :: package js_events
+}
+
+start :: () -> void #foreign "ouit" "loop" ---
+
+init :: (canvas_name: str,
+ he: typeof ouit_handle_event,
+ u: typeof ouit_update,
+ d: typeof ouit_draw) {
+
+ gl.init(canvas_name);
+ events.init();
+ gfx.immediate_renderer_init();
+
+ ouit_handle_event = he;
+ ouit_update = u;
+ ouit_draw = d;
+}
+
+#private {
+ ouit_handle_event : (^events.Event) -> void;
+ ouit_update : (dt: f32) -> void;
+ ouit_draw : () -> void;
+}
+
+#export "ouit_loop" () {
+ time_now :: () -> i32 #foreign "ouit" "time_now" --- ;
+
+ #persist last_time := 0;
+ if last_time == 0 do last_time = time_now();
+
+ now := time_now();
+ dt := cast(f32) (now - last_time) / 1000.0f;
+ last_time = now;
+
+ for event: events.consume() do ouit_handle_event(event);
+
+ ouit_update(dt);
+ ouit_draw();
+}
\ No newline at end of file
--- /dev/null
+#!/bin/sh
+
+ONYX_FOLDER="$HOME/dev/c/onyx"
+
+[ ! -s "./modules" ] && ln -s "$ONYX_FOLDER/modules" $(pwd)/modules
+[ ! -s "./js" ] && ln -s "$ONYX_FOLDER/bin" $(pwd)/js
+[ ! -f "./index.html" ] && cp "$ONYX_FOLDER/modules/ouit/index.html" .
+
+onyx -r js -V --use-multi-threading --use-post-mvp-features -o ouit.wasm "$1"
+
Type* ltype = binop->left->type;
Type* rtype = binop->right->type;
+ if (ltype == NULL) YIELD(binop->token->pos, "Waiting for left-type to be known.");
+ if (rtype == NULL) YIELD(binop->token->pos, "Waiting for right-type to be known.");
+
if (ltype->kind == Type_Kind_Pointer) ltype = &basic_types[Basic_Kind_Rawptr];
if (rtype->kind == Type_Kind_Pointer) rtype = &basic_types[Basic_Kind_Rawptr];