cp "$ONYX_MODULE_DIRECTORY/modules/js_events/js_events.js" ./site/js/js_events.js
FLAGS=
-[ ! -z "$DEBUG" ] && FLAGS=--print-function-mappings
+[ ! -z "$DEBUG" ] && FLAGS="--print-function-mappings -VVV"
RUNTIME=js
[ ! -z "$CONSOLE" ] && RUNTIME=wasi
-onyx --no-colors $FLAGS -r $RUNTIME \
+onyx --no-colors $FLAGS -r $RUNTIME -V \
--use-post-mvp-features \
-I $ONYX_MODULE_DIRECTORY \
--doc doc/source_reference \
start_loop();
}
-test_canvas : gfx.Canvas;
-
init :: () {
gl.init("main_canvas");
events.init();
gl.enable(gl.BLEND);
gl.blendFuncSeparate(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA);
- test_canvas = gfx.create_canvas(1000, 1000);
- {
- time_now :: () -> i32 #foreign "decompiler" "time_now" ---
- random.set_seed(time_now() / 1000);
-
- gfx.use_canvas(^test_canvas);
- defer gfx.use_canvas(null);
-
- gl.clearColor(0, 0, 0, 0.6);
- gl.clear(gl.COLOR_BUFFER_BIT);
-
- gfx.set_mode(.Lines);
- gfx.set_texture();
- gl.lineWidth(10);
-
- pv := gfx.Vector2.{ 0, 0 };
- for i: 11 {
- pv = .{ ~~random.between(0, 1000), ~~random.between(0, 1000) };
- gfx.vertex(pv, config.Colors.primary);
-
- pv = .{ ~~random.between(0, 1000), ~~random.between(0, 1000) };
- gfx.vertex(pv, config.Colors.primary);
- }
-
- gfx.set_mode(.Triangles);
- }
-
load_colors :: () {
json :: package json
last_time := 0;
#export "loop" () {
- time_now :: () -> i32 #foreign "decompiler" "time_now" ---
+ time_now :: () -> i32 #foreign "decompiler" "time_now" --- ;
if last_time == 0 do last_time = time_now();
draw_background_lines(~~window_width, ~~window_height, 0, 0, line_color=config.Colors.dark_background);
draw_menu_bar(window_rectangle);
- gfx.set_texture(^test_canvas.color_texture);
- gfx.textured_rect(.{ 300, 100 }, .{ 800, 400 }, .{ 0, 0 }, .{ 1, 1 });
- gfx.set_texture();
-
gfx.flush();
ui.clear_buttons();
}
draw_menu_bar :: (window_rectangle: ui.Rectangle) {
menu_bar, _ := ui.Flow.split_horizontal(window_rectangle, top_height=32);
- ui.draw_rect(menu_bar, color=.{ 0.2, 0.2, 0.2 });
+ ui.draw_rect(menu_bar, color=config.Colors.background);
menu_button_theme := ui.default_button_theme;
menu_button_theme.border_width = 2;