simplify
This commit is contained in:
parent
1c2a324f55
commit
4e920b5f0a
3 changed files with 119 additions and 156 deletions
196
animation.odin
196
animation.odin
|
|
@ -1,141 +1,149 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import rl "libraries/raylib"
|
import rl "libraries/raylib"
|
||||||
|
import "core:math/ease"
|
||||||
import "core:math/linalg"
|
import "core:math/linalg"
|
||||||
|
import "core:slice"
|
||||||
import "core:fmt"
|
import "core:fmt"
|
||||||
|
|
||||||
|
ANIMATION_COLOR_ORIGIN :: rl.RED
|
||||||
|
ANIMATION_COLOR_END :: rl.BLUE
|
||||||
|
|
||||||
|
RectangleCorners :: struct {tl, tr, br, bl: v2}
|
||||||
|
|
||||||
|
rectangle_corners_from_rect :: proc "contextless" (rect: rect2) -> RectangleCorners {
|
||||||
|
return {
|
||||||
|
tl = {rect.x, rect.y},
|
||||||
|
tr = {rect.x + rect.width, rect.y},
|
||||||
|
bl = {rect.x + rect.width, rect.y + rect.height},
|
||||||
|
br = {rect.x, rect.y + rect.height}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
rectangle_corners_transform_mat3 :: proc "contextless" (corners: RectangleCorners, transform: mat3) -> RectangleCorners {
|
||||||
|
return {
|
||||||
|
(v3{**corners.tl, 1.0} * transform).xy,
|
||||||
|
(v3{**corners.tr, 1.0} * transform).xy,
|
||||||
|
(v3{**corners.br, 1.0} * transform).xy,
|
||||||
|
(v3{**corners.bl, 1.0} * transform).xy,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
rectangle_corners_transform_mat2 :: proc "contextless" (corners: RectangleCorners, transform: mat2) -> RectangleCorners {
|
||||||
|
return {corners.tl * transform, corners.tr * transform, corners.br * transform, corners.bl * transform}
|
||||||
|
}
|
||||||
|
|
||||||
|
draw_animation_rectangle_corners :: proc(corners: RectangleCorners, color: rl.Color) {
|
||||||
|
rect := rect_from_corners(corners.tl, corners.tr, corners.br, corners.bl)
|
||||||
|
rl.DrawRectangleRec(rect, {**color.rgb, color.a << 1})
|
||||||
|
rl.DrawRectangleLinesEx(rect, 2, color)
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Maybe it is possible to have everything 3d be mathed the same way
|
Maybe it is possible to have everything 3d be mathed the same way
|
||||||
as in 2d. But I'm not sure if that's actually how it works.
|
as in 2d. But I'm not sure if that's actually how it works.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
AnimationInterface :: struct {
|
AnimationShape_Rectangle :: struct {
|
||||||
data: rawptr,
|
origin: RectangleCorners,
|
||||||
reset: proc(animation: ^AnimationInterface),
|
|
||||||
update_last: proc(animation: ^AnimationInterface, master_matrix: mat3),
|
|
||||||
update: proc(animation: ^AnimationInterface, animation_progress: f32),
|
|
||||||
next_matrix: proc(animation: ^AnimationInterface, next_matrix: mat3),
|
|
||||||
draw_idle: proc(animation: AnimationInterface),
|
|
||||||
draw_active: proc(animation: AnimationInterface),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
animation_update_last :: proc(animation: ^AnimationInterface, master_matrix: mat3) {
|
AnimationShapes :: struct {
|
||||||
animation.update_last(animation, master_matrix)
|
rectangle: AnimationShape_Rectangle,
|
||||||
}
|
}
|
||||||
|
|
||||||
animation_update :: proc(animation: ^AnimationInterface, animation_progress: f32) {
|
Animation :: struct {
|
||||||
animation.update(animation, animation_progress)
|
matrices: []f32,
|
||||||
|
matrix_index: int,
|
||||||
|
matrix_count: int,
|
||||||
|
matrix_type: AnimationMatrixType,
|
||||||
|
shapes: AnimationShapes,
|
||||||
|
ease: ease.Ease,
|
||||||
|
state: AnimationState,
|
||||||
|
type: AnimationType,
|
||||||
}
|
}
|
||||||
|
|
||||||
animation_next_matrix :: proc(animation: ^AnimationInterface, next_matrix: mat3) {
|
AnimationMatrixType :: enum {
|
||||||
animation.next_matrix(animation, next_matrix)
|
Mat2,
|
||||||
|
Mat3,
|
||||||
|
Mat4,
|
||||||
}
|
}
|
||||||
|
|
||||||
animation_draw_idle :: proc(animation: AnimationInterface) {
|
@private @rodata animation_matrix_type_size := [AnimationMatrixType]int {
|
||||||
animation.draw_idle(animation)
|
.Mat2 = size_of(mat2),
|
||||||
}
|
.Mat3 = size_of(mat3),
|
||||||
|
.Mat4 = size_of(mat4),
|
||||||
animation_draw_active :: proc(animation: AnimationInterface) {
|
|
||||||
animation.draw_active(animation)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
AnimationType :: enum {
|
AnimationType :: enum {
|
||||||
Rectangle,
|
Rectangle,
|
||||||
}
|
}
|
||||||
|
|
||||||
RectangleCorners :: struct {
|
AnimationState :: enum {
|
||||||
tl, tr, br, bl: v2,
|
Ready,
|
||||||
|
Playing,
|
||||||
|
Paused,
|
||||||
|
Finished,
|
||||||
}
|
}
|
||||||
|
|
||||||
rectangle_corners_transform :: proc(m: mat3, corners: RectangleCorners) -> RectangleCorners {
|
animation_init :: proc(animation: ^Animation, matrices: []f32) {
|
||||||
return {
|
animation^ = {
|
||||||
tl = (v3{**corners.tl, 1.0} * m).xy,
|
ease = .Cubic_Out,
|
||||||
tr = (v3{**corners.tr, 1.0} * m).xy,
|
type = .Rectangle,
|
||||||
br = (v3{**corners.br, 1.0} * m).xy,
|
matrices = matrices,
|
||||||
bl = (v3{**corners.bl, 1.0} * m).xy,
|
shapes = {
|
||||||
|
rectangle = {
|
||||||
|
origin = rectangle_corners_from_rect(rect2{-16, -16, 32, 32})
|
||||||
|
}
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AnimationData_Rectangle :: struct {
|
animation_play :: proc(animation: ^Animation) {
|
||||||
origin, middle, previous, next, last: RectangleCorners,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
draw_transformation_rectangle :: proc(rectangle: RectangleCorners, color: rl.Color) {
|
animation_reset :: proc(animation: ^Animation) {
|
||||||
rect := rect_from_corners(rectangle.tl, rectangle.tr, rectangle.br, rectangle.bl)
|
|
||||||
rl.DrawRectangleRec(rect, rl.Color{**color.rgb, color.a / 2})
|
|
||||||
rl.DrawRectangleLinesEx(rect, 1.0, color)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
draw_transformation_rectangle_with_handles :: proc(rectangle: RectangleCorners, color: rl.Color) {
|
animation_pause :: proc(animation: ^Animation) {
|
||||||
rect := rect_from_corners(rectangle.tl, rectangle.tr, rectangle.br, rectangle.bl)
|
|
||||||
rl.DrawRectangleRec(rect, rl.Color{**color.rgb, color.a / 2})
|
|
||||||
rl.DrawRectangleLinesEx(rect, 1.0, color)
|
|
||||||
rl.DrawCircleV(rectangle.tl, 4.0, color)
|
|
||||||
rl.DrawCircleV(rectangle.tr, 4.0, color)
|
|
||||||
rl.DrawCircleV(rectangle.br, 4.0, color)
|
|
||||||
rl.DrawCircleV(rectangle.bl, 4.0, color)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_animation_rectangle_draw_idle :: proc(animation: AnimationInterface) {
|
animation_update :: proc(animation: ^Animation, matrices: []mat3) {
|
||||||
data := cast(^AnimationData_Rectangle)animation.data
|
|
||||||
draw_transformation_rectangle(data.last, TRANSFORMATION_RECTANGLE_COLOR_LAST)
|
|
||||||
draw_transformation_rectangle_with_handles(data.origin, TRANSFORMATION_RECTANGLE_COLOR_ORIGIN)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_animation_rectangle_draw_active :: proc(animation: AnimationInterface) {
|
animation_draw :: proc(animation: Animation) {
|
||||||
data := cast(^AnimationData_Rectangle)animation.data
|
switch animation.type {
|
||||||
draw_transformation_rectangle(data.last, TRANSFORMATION_RECTANGLE_COLOR_LAST)
|
case .Rectangle:
|
||||||
draw_transformation_rectangle(data.next, TRANSFORMATION_RECTANGLE_COLOR_NEXT)
|
shape := animation.shapes.rectangle
|
||||||
draw_transformation_rectangle(data.middle, TRANSFORMATION_RECTANGLE_COLOR_MIDDLE)
|
transformation := linalg.identity(mat3)
|
||||||
draw_transformation_rectangle(data.origin, TRANSFORMATION_RECTANGLE_COLOR_ORIGIN)
|
previous, next := shape.origin, shape.origin
|
||||||
}
|
color_origin := cast([4]f32)(ANIMATION_COLOR_ORIGIN)
|
||||||
|
color_end := cast([4]f32)(ANIMATION_COLOR_END)
|
||||||
|
draw_animation_rectangle_corners(next, ANIMATION_COLOR_ORIGIN)
|
||||||
|
|
||||||
_animation_rectangle_reset :: proc(animation: ^AnimationInterface) {
|
matrices := slice.reinterpret([]mat3, animation.matrices)
|
||||||
data := cast(^AnimationData_Rectangle)animation.data
|
for m, i in matrices {
|
||||||
data.middle = data.origin
|
progress := f32(i + 1) / f32(len(animation.matrices))
|
||||||
data.next = data.origin
|
transformation *= m
|
||||||
data.previous = data.origin
|
previous = next
|
||||||
}
|
next := rectangle_corners_transform_mat3(previous, transformation)
|
||||||
|
draw_animation_rectangle_corners(next, cast(rl.Color)linalg.lerp(color_origin, color_end, progress))
|
||||||
_animation_rectangle_next_matrix :: proc(animation: ^AnimationInterface, next_matrix: mat3) {
|
}
|
||||||
data := cast(^AnimationData_Rectangle)animation.data
|
|
||||||
data.previous = data.next
|
|
||||||
data.middle = data.next
|
|
||||||
data.next = rectangle_corners_transform(next_matrix, data.next)
|
|
||||||
}
|
|
||||||
|
|
||||||
_animation_rectangle_update_last :: proc(animation: ^AnimationInterface, master_matrix: mat3) {
|
|
||||||
data := cast(^AnimationData_Rectangle)animation.data
|
|
||||||
data.last = {
|
|
||||||
tl = (master_matrix * v3{**data.origin.tl, 1.0}).xy,
|
|
||||||
tr = (master_matrix * v3{**data.origin.tr, 1.0}).xy,
|
|
||||||
br = (master_matrix * v3{**data.origin.br, 1.0}).xy,
|
|
||||||
bl = (master_matrix * v3{**data.origin.bl, 1.0}).xy,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_animation_rectangle_update :: proc(animation: ^AnimationInterface, animation_progress: f32) {
|
animation_set_playback_speed :: proc(animation: ^Animation) {
|
||||||
data := cast(^AnimationData_Rectangle)animation.data
|
|
||||||
data.middle = {
|
|
||||||
tl = linalg.lerp(data.previous.tl, data.next.tl, animation_progress),
|
|
||||||
tr = linalg.lerp(data.previous.tr, data.next.tr, animation_progress),
|
|
||||||
br = linalg.lerp(data.previous.br, data.next.br, animation_progress),
|
|
||||||
bl = linalg.lerp(data.previous.bl, data.next.bl, animation_progress),
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
animation_reset :: proc(animation: ^AnimationInterface) {
|
animation_set_type :: proc(animation: ^Animation, type: AnimationType) {
|
||||||
animation.reset(animation)
|
animation.type = type
|
||||||
}
|
}
|
||||||
|
|
||||||
animation_create_rectangle :: proc(rectangle: ^AnimationData_Rectangle) -> AnimationInterface {
|
animation_is_finished :: proc() -> bool {
|
||||||
return {
|
return false
|
||||||
data = rectangle,
|
|
||||||
reset = _animation_rectangle_reset,
|
|
||||||
update_last = _animation_rectangle_update_last,
|
|
||||||
update = _animation_rectangle_update,
|
|
||||||
next_matrix = _animation_rectangle_next_matrix,
|
|
||||||
draw_idle = _animation_rectangle_draw_idle,
|
|
||||||
draw_active = _animation_rectangle_draw_active,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
79
program.odin
79
program.odin
|
|
@ -197,25 +197,7 @@ Program :: struct {
|
||||||
message_type: ProgramMessageType,
|
message_type: ProgramMessageType,
|
||||||
dialog_type: ProgramDialogType,
|
dialog_type: ProgramDialogType,
|
||||||
dialog_data: ProgramData_DialogState,
|
dialog_data: ProgramData_DialogState,
|
||||||
animation_data: AnimationData,
|
animation: Animation,
|
||||||
animation_state: AnimationState,
|
|
||||||
animations: [AnimationType]AnimationInterface,
|
|
||||||
animation: AnimationInterface,
|
|
||||||
animation_matrix_index: int,
|
|
||||||
animation_matrix_progress: f32,
|
|
||||||
animation_speed: f32,
|
|
||||||
animation_ease: ease.Ease,
|
|
||||||
}
|
|
||||||
|
|
||||||
AnimationData :: struct {
|
|
||||||
rectangle: AnimationData_Rectangle,
|
|
||||||
}
|
|
||||||
|
|
||||||
AnimationState :: enum {
|
|
||||||
Ready,
|
|
||||||
Playing,
|
|
||||||
Paused,
|
|
||||||
Finished,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
float_slice_get_mat3 :: proc(floats: []f32, index: int) -> ^mat3 {
|
float_slice_get_mat3 :: proc(floats: []f32, index: int) -> ^mat3 {
|
||||||
|
|
@ -254,7 +236,7 @@ program_load_project :: proc(program: ^Program, path: string) -> ProjectReadErro
|
||||||
for val, i in program.matrix_float_pool[:program.matrix_count * 9] {
|
for val, i in program.matrix_float_pool[:program.matrix_count * 9] {
|
||||||
fmt.bprint(program.matrix_value_string_pool[i][:], val)
|
fmt.bprint(program.matrix_value_string_pool[i][:], val)
|
||||||
}
|
}
|
||||||
animation_update_last(&program.animation, program_get_master_matrix())
|
animation_update(&program.animation, (cast([^]mat3)(raw_data(program.matrix_float_pool)))[:program.matrix_count])
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -286,16 +268,7 @@ program_init :: proc(allocator := context.allocator) {
|
||||||
ui.init(&program.ui_overlay_context, 200, ui_measure_text, &program.font_style, allocator)
|
ui.init(&program.ui_overlay_context, 200, ui_measure_text, &program.font_style, allocator)
|
||||||
program.ui_overlay_element_focus = ui.element_id_invalid()
|
program.ui_overlay_element_focus = ui.element_id_invalid()
|
||||||
|
|
||||||
animation_rectangle := RectangleCorners {{320.0, 320.0}, {352.0, 320.0}, {352.0, 352.0}, {320.0, 352.0}}
|
animation_init(&program.animation, program.matrix_float_pool)
|
||||||
program.animation_data = {
|
|
||||||
rectangle = {animation_rectangle,animation_rectangle,animation_rectangle,animation_rectangle,animation_rectangle},
|
|
||||||
}
|
|
||||||
program.animations = {
|
|
||||||
.Rectangle = animation_create_rectangle(&program.animation_data.rectangle)
|
|
||||||
}
|
|
||||||
program.animation = program.animations[.Rectangle]
|
|
||||||
program.animation_speed = 0.02
|
|
||||||
program.animation_ease = .Quadratic_Out
|
|
||||||
|
|
||||||
if err := program_load_project(&program, DEFAULT_PROJECT_LOAD_LOCATION); err != nil {
|
if err := program_load_project(&program, DEFAULT_PROJECT_LOAD_LOCATION); err != nil {
|
||||||
fmt.println("ERROR:", err)
|
fmt.println("ERROR:", err)
|
||||||
|
|
@ -312,12 +285,11 @@ program_get_master_matrix :: proc() -> mat3 {
|
||||||
}
|
}
|
||||||
|
|
||||||
program_set_transformation_state :: proc(state: AnimationState) {
|
program_set_transformation_state :: proc(state: AnimationState) {
|
||||||
if program.animation_state == state do return
|
if program.animation.state == state do return
|
||||||
previous_state := program.animation_state
|
previous_state := program.animation.state
|
||||||
program.animation_state = state
|
program.animation.state = state
|
||||||
switch program.animation_state {
|
switch program.animation.state {
|
||||||
case .Ready:
|
case .Ready:
|
||||||
program.animation_matrix_index = -1
|
|
||||||
animation_reset(&program.animation)
|
animation_reset(&program.animation)
|
||||||
case .Playing:
|
case .Playing:
|
||||||
|
|
||||||
|
|
@ -404,7 +376,7 @@ program_update :: proc() {
|
||||||
}
|
}
|
||||||
case .LoadProject:
|
case .LoadProject:
|
||||||
}
|
}
|
||||||
animation_update_last(&program.animation, program_get_master_matrix())
|
animation_update(&program.animation, (cast([^]mat3)(raw_data(program.matrix_float_pool)))[:program.matrix_count])
|
||||||
program.state = .Normal
|
program.state = .Normal
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -414,27 +386,7 @@ program_update :: proc() {
|
||||||
grid_text_clip := rect_from_area(v2{matrix_container_br.x, top_bar_container_br.y}, v2{WINDOW_WIDTH, WINDOW_HEIGHT})
|
grid_text_clip := rect_from_area(v2{matrix_container_br.x, top_bar_container_br.y}, v2{WINDOW_WIDTH, WINDOW_HEIGHT})
|
||||||
draw_grid(program.grid, rect_grow(grid_text_clip, -4.0), rect_grow(grid_text_clip, -32.0))
|
draw_grid(program.grid, rect_grow(grid_text_clip, -4.0), rect_grow(grid_text_clip, -32.0))
|
||||||
|
|
||||||
if program.animation_state == .Playing {
|
animation_draw(program.animation)
|
||||||
program.animation_matrix_progress += program.animation_speed * delta_time_fraction()
|
|
||||||
if program.animation_matrix_progress >= 1.0 {
|
|
||||||
if program.animation_matrix_index + 1 < program.matrix_count {
|
|
||||||
program.animation_matrix_index += 1
|
|
||||||
animation_next_matrix(&program.animation, float_slice_get_mat3(program.matrix_float_pool, program.animation_matrix_index)^)
|
|
||||||
program.animation_matrix_progress = fract(program.animation_matrix_progress)
|
|
||||||
} else {
|
|
||||||
program.animation_matrix_progress = 1.0;
|
|
||||||
program.animation_state = .Finished
|
|
||||||
}
|
|
||||||
}
|
|
||||||
animation_update(&program.animation, ease.ease(program.animation_ease, program.animation_matrix_progress))
|
|
||||||
}
|
|
||||||
|
|
||||||
switch program.animation_state {
|
|
||||||
case .Ready:
|
|
||||||
animation_draw_idle(program.animation)
|
|
||||||
case .Playing, .Paused, .Finished:
|
|
||||||
animation_draw_active(program.animation)
|
|
||||||
}
|
|
||||||
|
|
||||||
ui_element_focus := program.state == .Normal ? program.ui_element_focus : ui.element_id_invalid()
|
ui_element_focus := program.state == .Normal ? program.ui_element_focus : ui.element_id_invalid()
|
||||||
program.ui_element_focus = program_render_ui_and_handle_focus(&program.ui_context, ui_element_focus, program.font_style, ui_elements)
|
program.ui_element_focus = program_render_ui_and_handle_focus(&program.ui_context, ui_element_focus, program.font_style, ui_elements)
|
||||||
|
|
@ -576,7 +528,7 @@ program_build_workspace_ui :: proc(ctx: ^ui.Context) ->
|
||||||
|
|
||||||
play_button_label: cstring
|
play_button_label: cstring
|
||||||
button_data = new(UiElementData_Button, context.temp_allocator)
|
button_data = new(UiElementData_Button, context.temp_allocator)
|
||||||
switch program.animation_state {
|
switch program.animation.state {
|
||||||
case .Ready, .Finished:
|
case .Ready, .Finished:
|
||||||
button_config.label = RAYGUI_ICON_PLAY
|
button_config.label = RAYGUI_ICON_PLAY
|
||||||
button_data^ = {type = .StartTransformation}
|
button_data^ = {type = .StartTransformation}
|
||||||
|
|
@ -723,14 +675,13 @@ program_render_ui_and_handle_focus :: proc(ctx: ^ui.Context, focus_element_id: u
|
||||||
program.state = .Normal
|
program.state = .Normal
|
||||||
case .StartTransformation:
|
case .StartTransformation:
|
||||||
if program.matrix_count > 0 {
|
if program.matrix_count > 0 {
|
||||||
program.animation_state = .Playing
|
program.animation.state = .Playing
|
||||||
animation_reset(&program.animation)
|
animation_reset(&program.animation)
|
||||||
animation_next_matrix(&program.animation, (cast(^mat3)raw_data(program.matrix_float_pool))^)
|
|
||||||
}
|
}
|
||||||
case .PauseTransformation:
|
case .PauseTransformation:
|
||||||
program.animation_state = .Paused
|
program.animation.state = .Paused
|
||||||
case .ResumeTransformation:
|
case .ResumeTransformation:
|
||||||
program.animation_state = .Playing
|
program.animation.state = .Playing
|
||||||
case .ResetTransformation:
|
case .ResetTransformation:
|
||||||
animation_reset(&program.animation)
|
animation_reset(&program.animation)
|
||||||
case .SaveProjectConfirm:
|
case .SaveProjectConfirm:
|
||||||
|
|
@ -760,7 +711,7 @@ program_render_ui_and_handle_focus :: proc(ctx: ^ui.Context, focus_element_id: u
|
||||||
matrix_move_to(program.matrix_float_pool, program.matrix_value_string_pool, data.target_matrix, data.target_matrix + 1)
|
matrix_move_to(program.matrix_float_pool, program.matrix_value_string_pool, data.target_matrix, data.target_matrix + 1)
|
||||||
}
|
}
|
||||||
if data.type in UiButtonRecalculateFinishGroup {
|
if data.type in UiButtonRecalculateFinishGroup {
|
||||||
animation_update_last(&program.animation, program_get_master_matrix())
|
animation_update(&program.animation, (cast([^]mat3)(raw_data(program.matrix_float_pool)))[:program.matrix_count])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case .Slider:
|
case .Slider:
|
||||||
|
|
@ -773,7 +724,7 @@ program_render_ui_and_handle_focus :: proc(ctx: ^ui.Context, focus_element_id: u
|
||||||
focus_element_id = element.id
|
focus_element_id = element.id
|
||||||
}
|
}
|
||||||
if value_previous != data.value^ && .UpdateMatrix in data.tag {
|
if value_previous != data.value^ && .UpdateMatrix in data.tag {
|
||||||
animation_update_last(&program.animation, program_get_master_matrix())
|
animation_update(&program.animation, (cast([^]mat3)(raw_data(program.matrix_float_pool)))[:program.matrix_count])
|
||||||
}
|
}
|
||||||
case .InputText:
|
case .InputText:
|
||||||
data := cast(^UiElementData_TextInput)element.data
|
data := cast(^UiElementData_TextInput)element.data
|
||||||
|
|
|
||||||
|
|
@ -76,6 +76,10 @@ fract :: proc(val: f32) -> f32 {
|
||||||
return val - math.trunc(val)
|
return val - math.trunc(val)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
color_to_fcolor :: proc(color: rl.Color) -> [4]f32 {
|
||||||
|
return cast([4]f32)(color) / 255.0
|
||||||
|
}
|
||||||
|
|
||||||
/// ### TYPES ### ///
|
/// ### TYPES ### ///
|
||||||
v1 :: [1]f32
|
v1 :: [1]f32
|
||||||
v2 :: [2]f32
|
v2 :: [2]f32
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue