clay implemented

This commit is contained in:
dimitar committed 2026-05-22 12:35:38 +02:00
1 parent 2160449f43
commit 1d8178f5d6
5 files changed
+501 -45

No files matched your search

-1
View File
@@ -6,7 +6,6 @@ import "core:fmt"
import "core:math"
import "core:strings"
import rl "vendor:raylib"
import "../shared"
// --- Font IDs (indices into raylib_fonts) ---
CLAY_FONT_BODY :: u16(0)
+11 -39
View File
@@ -301,7 +301,6 @@ run_gui_app :: proc(state: ^core.Comic_State) -> shared.App_Error {
// ─── Clay Layout Declaration ──────────────────────────────
main_w := shared.compute_main_width(screen_w)
status_w := (main_w - 2) / 2
lower_y := shared.compute_lower_y(screen_h)
clay.BeginLayout()
@@ -317,11 +316,11 @@ run_gui_app :: proc(state: ^core.Comic_State) -> shared.App_Error {
if clay.UI(clay.ID("MainArea"))({
layout = {sizing = {width = clay.SizingGrow({}), height = clay.SizingGrow({})}, layoutDirection = .TopToBottom},
}) {
declare_topbar(&app, main_w, screen_w)
declare_project_setup(&app, main_w)
declare_topbar(&app)
declare_project_setup(&app)
declare_actions_row(&app, can_generate_panels, can_layout, can_export, project_path_ok, export_path_ok, has_deepseek_key)
declare_status_card(&app, status_w, lower_y)
declare_detail_area(&app, main_w, status_w, screen_w, lower_y, lower_y - 140, compact_mode)
declare_status_card(&app)
declare_detail_area(&app, status_w)
}
}
@@ -399,7 +398,7 @@ declare_sidebar :: proc(app: ^GUI_App_State, screen_h: i32) {
}
// ─── Topbar Declaration ──────────────────────────────────────────
declare_topbar :: proc(app: ^GUI_App_State, main_w: i32, screen_w: i32) {
declare_topbar :: proc(app: ^GUI_App_State) {
if clay.UI(clay.ID("Topbar"))({
layout = {sizing = {width = clay.SizingGrow({}), height = clay.SizingFit({min = 72, max = 72})}, padding = {top = 12, right = 20, bottom = 12, left = 20}, childGap = 16, childAlignment = {y = .Center}},
backgroundColor = CLAY_BG_TOPBAR,
@@ -468,7 +467,7 @@ declare_topbar :: proc(app: ^GUI_App_State, main_w: i32, screen_w: i32) {
}
// ─── Project Setup Declaration ─────────────────────────────────────
declare_project_setup :: proc(app: ^GUI_App_State, main_w: i32) {
declare_project_setup :: proc(app: ^GUI_App_State) {
if clay.UI(clay.ID("ProjectSetup"))(clay_card_style()) {
clay_title_text("Project Setup")
// Story Idea
@@ -577,7 +576,7 @@ declare_actions_row :: proc(app: ^GUI_App_State, can_gen_panels, can_layout, can
}
// ─── Status Card ──────────────────────────────────────────────────
declare_status_card :: proc(app: ^GUI_App_State, status_w: i32, lower_y: i32) {
declare_status_card :: proc(app: ^GUI_App_State) {
ready_count, total_count := ready_stage_count(app.controller)
progress := f32(0)
if total_count > 0 { progress = f32(ready_count) / f32(total_count) }
@@ -624,7 +623,7 @@ declare_status_card :: proc(app: ^GUI_App_State, status_w: i32, lower_y: i32) {
}
// ─── Detail Area ──────────────────────────────────────────────────
declare_detail_area :: proc(app: ^GUI_App_State, main_w, status_w, screen_w, lower_y, summary_y: i32, compact_mode: bool) {
declare_detail_area :: proc(app: ^GUI_App_State, status_w: i32) {
if clay.UI(clay.ID("DetailArea"))({
layout = {sizing = {width = clay.SizingGrow({}), height = clay.SizingGrow({})}, layoutDirection = .LeftToRight, childGap = 2},
}) {
@@ -635,35 +634,6 @@ declare_detail_area :: proc(app: ^GUI_App_State, main_w, status_w, screen_w, low
cornerRadius = clay.CornerRadiusAll(CLAY_RADIUS_MD),
}) {
declare_screen_summary(app)
screen := app.controller.active_screen
if screen == .Script || screen == .Layout || screen == .Panels || screen == .Bubbles {
show_txt := "Show:Top"
sort_txt := "Sort:Asc"
if screen == .Script {
if app.summary_opts.script_show_all { show_txt = "Show:All" }
if app.summary_opts.script_desc { sort_txt = "Sort:Desc" }
} else {
if app.summary_opts.layout_show_all { show_txt = "Show:All" }
if app.summary_opts.layout_desc { sort_txt = "Sort:Desc" }
}
if clay.UI(clay.ID("SummaryBtnRow"))({layout = clay_row_layout()}) {
declare_button_small("btn_summary_show", show_txt)
declare_button_small("btn_summary_sort", sort_txt)
if screen == .Script {
declare_button_small("btn_summary_prev", "< Pg")
declare_button_small("btn_summary_next", "Pg >")
} else if screen == .Panels {
declare_button_small("btn_summary_prev", "< Pn")
declare_button_small("btn_summary_next", "Pn >")
} else if screen == .Layout {
declare_button_small("btn_summary_prev", "< Ly")
declare_button_small("btn_summary_next", "Ly >")
} else if screen == .Bubbles {
declare_button_small("btn_summary_prev", "< Pn")
declare_button_small("btn_summary_next", "Pn >")
}
}
}
}
// Detail/log panel (right) — detail panels or action log
@@ -1483,8 +1453,10 @@ declare_layout_detail :: proc(app: ^GUI_App_State) {
}) {
for i in 0..<len(layout_val.panels) {
cell := layout_val.panels[i].layout_cell
w_pct := f32(cell.w * 100); if w_pct > 100 { w_pct = 100 } else if w_pct < 0 { w_pct = 0 }
h_pct := f32(cell.h * 100); if h_pct > 100 { h_pct = 100 } else if h_pct < 0 { h_pct = 0 }
if clay.UI(clay.ID(fmt.tprintf("wire_cell_%d", i)))({
layout = {sizing = {width = clay.SizingPercent(f32(cell.w * 100)), height = clay.SizingPercent(f32(cell.h * 100))}, padding = {top = 2, left = 2, right = 2, bottom = 2}},
layout = {sizing = {width = clay.SizingPercent(w_pct), height = clay.SizingPercent(h_pct)}, padding = {top = 2, left = 2, right = 2, bottom = 2}},
backgroundColor = CLAY_ACCENT_SURFACE,
cornerRadius = clay.CornerRadiusAll(2),
border = {color = CLAY_ACCENT_MUTED, width = clay.BorderOutside(1)},