Bindgen for raygui

This commit is contained in:
Synthasmagoria 2026-09-11 18:17:32 +02:00
commit ff8f538996
3 changed files with 64 additions and 13 deletions

View file

@ -0,0 +1,11 @@
inputs = [
"raygui.h"
]
imports_file = "imports.odin"
package_name = "raylib"
clang_include_paths = [
"../raylib/src"
]

View file

@ -0,0 +1,28 @@
RAYGUI_SHARED :: #config(RAYGUI_SHARED, false)
RAYGUI_WASM_LIB :: #config(RAYGUI_WASM_LIB, "wasm/libraygui.a")
when ODIN_OS == .Windows {
foreign import lib {
"windows/rayguidll.lib" when RAYGUI_SHARED else "windows/raygui.lib",
}
} else when ODIN_OS == .Linux {
foreign import lib {
"linux/libraygui.so" when RAYGUI_SHARED else "linux/libraygui.a",
}
} else when ODIN_OS == .Darwin {
when ODIN_ARCH == .arm64 {
foreign import lib {
"macos/libraygui-arm64.dylib" when RAYGUI_SHARED else "macos/libraygui-arm64.a",
}
} else {
foreign import lib {
"macos/libraygui.dylib" when RAYGUI_SHARED else "macos/libraygui.a",
}
}
} else when ODIN_ARCH == .wasm32 || ODIN_ARCH == .wasm64p32 {
foreign import lib {
RAYGUI_WASM_LIB,
}
} else {
foreign import lib "system:raygui"
}

View file

@ -4,12 +4,20 @@
<meta charset="utf-8"> <meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Odin + Raylib on the web</title> <title>Transformation Visualizer</title>
<meta name="title" content="Odin + Raylib on the web"> <meta name="title" content="Transformation Visualizer">
<meta name="description" content="Make games using Odin + Raylib that work in the browser"> <meta name="description" content="Math visualization tool">
<meta name="viewport" content="width=device-width"> <meta name="viewport" content="width=device-width">
<style> <style>
* {
vertical-align: baseline;
border: 0 none;
outline: 0;
padding: 0;
margin: 0;
box-sizing: border-box;
}
body { body {
margin: 0px; margin: 0px;
overflow: hidden; overflow: hidden;
@ -27,6 +35,11 @@
display: block; display: block;
width: 100%; width: 100%;
height: 100%; height: 100%;
overflow: hidden;
position: fixed;
top: 0;
left: 0;
} }
</style> </style>
</head> </head>
@ -61,17 +74,16 @@
e._start(); e._start();
e.main_start(); e.main_start();
function send_resize() { function send_resize() {
var canvas = document.getElementById('canvas'); var canvas = document.getElementById('canvas');
canvas.width = document.documentElement.clientWidth; canvas.width = document.documentElement.clientWidth;
canvas.height = document.documentElement.clientHeight; canvas.height = document.documentElement.clientHeight;
console.log(canvas.width, canvas.height);
e.web_window_size_changed(canvas.width, canvas.height); e.web_window_size_changed(canvas.width, canvas.height);
} }
window.addEventListener('resize', function(event) { window.addEventListener('resize', function(event) {
send_resize(); send_resize();
}, true); }, true);
send_resize(); send_resize();