Dropdown element
This commit is contained in:
parent
ff32ac6227
commit
af44a9c367
4 changed files with 159 additions and 22 deletions
18
utils.odin
18
utils.odin
|
|
@ -1,7 +1,11 @@
|
|||
package main
|
||||
|
||||
import rl "libraries/raylib"
|
||||
import "base:intrinsics"
|
||||
import "core:strings"
|
||||
import "core:fmt"
|
||||
import "core:math/linalg"
|
||||
import "core:mem"
|
||||
|
||||
// Wraps os.read_entire_file and os.write_entire_file, but they also work with emscripten.
|
||||
@(require_results)
|
||||
|
|
@ -28,6 +32,20 @@ irect2 :: struct {x, y, width, height: i32}
|
|||
tri2 :: [3]v2
|
||||
Bezier :: [3]v2
|
||||
|
||||
/// ### MISCELANIOUS ### ///
|
||||
enum_to_raygui_options_string :: proc($T: typeid, allocator: mem.Allocator) -> cstring where intrinsics.type_is_enum(T) {
|
||||
b := strings.builder_make(allocator)
|
||||
for element, i in T {
|
||||
option := fmt.aprint(element, allocator = allocator)
|
||||
strings.write_string(&b, strings.to_ada_case(option, allocator))
|
||||
strings.write_rune(&b, ';')
|
||||
}
|
||||
strings.builder_replace_all(&b, "_", " ")
|
||||
b.buf[len(b.buf) - 1] = 0
|
||||
return cstring(raw_data(b.buf[:len(b.buf)]))
|
||||
}
|
||||
|
||||
|
||||
/// ### RECTANGLES ### ///
|
||||
rect_from :: proc {
|
||||
rect2_from_v2,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue