Compare commits
2 commits
b9d7d9ba7e
...
53a148d979
| Author | SHA1 | Date | |
|---|---|---|---|
| 53a148d979 | |||
| ff8f538996 |
6 changed files with 903 additions and 470 deletions
File diff suppressed because it is too large
Load diff
10
src/libraries/raylib/raygui/bindgen.sh
Executable file
10
src/libraries/raylib/raygui/bindgen.sh
Executable file
|
|
@ -0,0 +1,10 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
# Currently not cross compiling for windows and darwin
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
# This is supposed to use Karl Zylinski's odin-c-bindgen
|
||||||
|
# https://github.com/karl-zylinski/odin-c-bindgen
|
||||||
|
odin-c-bindgen bindgen.sjson
|
||||||
|
rm -f ../raygui.odin
|
||||||
|
cp bindgen_output/raygui.odin ../
|
||||||
|
rm -r bindgen_output
|
||||||
18
src/libraries/raylib/raygui/bindgen.sjson
Normal file
18
src/libraries/raylib/raygui/bindgen.sjson
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
inputs = [
|
||||||
|
"raygui.h"
|
||||||
|
]
|
||||||
|
|
||||||
|
imports_file = "imports.odin"
|
||||||
|
|
||||||
|
output_folder = "bindgen_output"
|
||||||
|
|
||||||
|
package_name = "raylib"
|
||||||
|
|
||||||
|
clang_include_paths = [
|
||||||
|
"../raylib/src"
|
||||||
|
]
|
||||||
|
|
||||||
|
procedure_type_overrides = {
|
||||||
|
"GuiSetStyle.control" = "GuiControl"
|
||||||
|
"GuiGetStyle.control" = "GuiControl"
|
||||||
|
}
|
||||||
28
src/libraries/raylib/raygui/imports.odin
Normal file
28
src/libraries/raylib/raygui/imports.odin
Normal 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"
|
||||||
|
}
|
||||||
|
|
@ -1091,7 +1091,7 @@ program_render_ui_and_handle_focus :: proc(ctx: ^ui.Context, focus_element_id: u
|
||||||
// TODO (synthas): implement keeping the rectangle within screen borders
|
// TODO (synthas): implement keeping the rectangle within screen borders
|
||||||
tooltip_position = rl.GetMousePosition()
|
tooltip_position = rl.GetMousePosition()
|
||||||
}
|
}
|
||||||
if rl.GuiButton(area, element.label) {
|
if rl.GuiButton(area, element.label) == 1 {
|
||||||
if element.data == nil do break
|
if element.data == nil do break
|
||||||
data := cast(^UiElementData_Button)element.data
|
data := cast(^UiElementData_Button)element.data
|
||||||
switch data.type {
|
switch data.type {
|
||||||
|
|
@ -1199,7 +1199,7 @@ program_render_ui_and_handle_focus :: proc(ctx: ^ui.Context, focus_element_id: u
|
||||||
}
|
}
|
||||||
case .InputText:
|
case .InputText:
|
||||||
data := cast(^UiElementData_TextInput)element.data
|
data := cast(^UiElementData_TextInput)element.data
|
||||||
if rl.GuiTextBox(area, data.str, i32(program.font_style.size), focus_element_id == element.id) {
|
if rl.GuiTextBox(area, data.str, i32(program.font_style.size), focus_element_id == element.id) == 1 {
|
||||||
focus_element_id = element.id
|
focus_element_id = element.id
|
||||||
}
|
}
|
||||||
case .Label:
|
case .Label:
|
||||||
|
|
|
||||||
|
|
@ -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();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue