wasm shell + destructuring

This commit is contained in:
agra
2026-03-03 13:21:54 +02:00
parent 6c5672c7df
commit 004aff5f67
18 changed files with 219 additions and 32 deletions

View File

@@ -8,6 +8,7 @@ POINTER_SIZE : s64 = 8;
BuildOptions :: struct {
add_link_flag :: (self: BuildOptions, flag: [:0]u8) #compiler;
set_output_path :: (self: BuildOptions, path: [:0]u8) #compiler;
set_wasm_shell :: (self: BuildOptions, path: [:0]u8) #compiler;
}
build_options :: () -> BuildOptions #compiler;

View File

@@ -86,6 +86,12 @@ glReadPixels : (s32, s32, s32, s32, u32, u32, *void) -> void = ---;
glActiveTexture : (u32) -> void = ---;
glUniform1i : (s32, s32) -> void = ---;
glPixelStorei : (u32, s32) -> void = ---;
glTexSubImage2D : (u32, s32, s32, s32, s32, s32, u32, u32, *void) -> void = ---;
glDeleteTextures : (s32, *u32) -> void = ---;
GL_TEXTURE_WRAP_S :u32: 0x2802;
GL_TEXTURE_WRAP_T :u32: 0x2803;
GL_CLAMP_TO_EDGE :u32: 0x812F;
// Loader: call once after creating GL context
// Pass in a proc loader (e.g. SDL_GL_GetProcAddress)
@@ -133,6 +139,8 @@ load_gl :: (get_proc: ([*]u8) -> *void) {
glActiveTexture = xx get_proc("glActiveTexture");
glUniform1i = xx get_proc("glUniform1i");
glPixelStorei = xx get_proc("glPixelStorei");
glTexSubImage2D = xx get_proc("glTexSubImage2D");
glDeleteTextures = xx get_proc("glDeleteTextures");
}

View File

@@ -4,7 +4,9 @@ sdl3 :: #library "SDL3";
SDL_INIT_VIDEO :u32: 0x20;
// SDL_WindowFlags
SDL_WINDOW_OPENGL :u64: 0x2;
SDL_WINDOW_OPENGL :u64: 0x2;
SDL_WINDOW_RESIZABLE :u64: 0x20;
SDL_WINDOW_HIGH_PIXEL_DENSITY :u64: 0x2000;
// SDL_GLAttr (enum starting at 0)
SDL_GL_DOUBLEBUFFER :s32: 5;
@@ -332,3 +334,16 @@ SDL_GL_GetProcAddress :: (proc: [:0]u8) -> *void #foreign sdl3;
SDL_PollEvent :: (event: *SDL_Event) -> bool #foreign sdl3;
SDL_GetTicks :: () -> u64 #foreign sdl3;
SDL_Delay :: (ms: u32) -> void #foreign sdl3;
SDL_GetWindowDisplayScale :: (window: *void) -> f32 #foreign sdl3;
SDL_GetWindowSize :: (window: *void, w: *s32, h: *s32) -> bool #foreign sdl3;
SDL_GetWindowSizeInPixels :: (window: *void, w: *s32, h: *s32) -> bool #foreign sdl3;
SDL_Rect :: struct {
x: s32;
y: s32;
w: s32;
h: s32;
}
SDL_GetPrimaryDisplay :: () -> u32 #foreign sdl3;
SDL_GetDisplayUsableBounds :: (display_id: u32, rect: *SDL_Rect) -> bool #foreign sdl3;

View File

@@ -4,4 +4,7 @@
#include "vendors/file_utils/file_utils.h";
#source "vendors/file_utils/file_utils.c";
#include "vendors/kb_text_shape/kbts_api.h";
#source "vendors/kb_text_shape/kb_text_shape_impl.c";
};