Commit: dff4c4c9a71fea12db94dfe3f7d7262637b51e95
Parent: c8b92ab50d180f1d6fd4c3097a9a2f7c94738d61
Author: Randy Palamar
Date: Wed, 31 Jul 2024 20:47:58 -0600
move some default colours to config.h
Diffstat:
4 files changed, 21 insertions(+), 8 deletions(-)
diff --git a/colourpicker.c b/colourpicker.c
@@ -323,9 +323,9 @@ do_text_input(ColourPickerCtx *ctx, Rect r, Color colour)
else ctx->is.cursor_t_target = 0;
}
- v4 bg = ctx->hover_colour;
+ v4 bg = ctx->cursor_colour;
bg.a = 0;
- Color cursor_colour = colour_from_normalized(lerp_v4(bg, ctx->hover_colour,
+ Color cursor_colour = colour_from_normalized(lerp_v4(bg, ctx->cursor_colour,
ctx->is.cursor_t));
/* NOTE: guess a cursor position */
diff --git a/config.def.h b/config.def.h
@@ -1,3 +1,14 @@
-#define FONT_SIZE 40u
-
+/* NOTE: This is used by gen_incs for generating font_inc.h and shader_inc.h */
+#define FONT_SIZE 40u
#define HSV_LERP_SHADER_NAME "hsv_lerp.glsl"
+
+/* NOTE: Values below here are just used for initializing the ctx in main.
+ * They are not needed if you are are embedding into another application. */
+
+#define COLOUR_PICKER_FG (Color){.r = 0xea, .g = 0xe1, .b = 0xb4, .a = 0xff}
+#define COLOUR_PICKER_BG (Color){.r = 0x26, .g = 0x1e, .b = 0x22, .a = 0xff}
+
+#define STARTING_COLOUR (v4){.r = 0.53, .g = 0.82, .b = 0.59, .a = 1.00}
+#define HOVER_COLOUR (v4){.r = 0.85, .g = 0.38, .b = 0.38, .a = 1.00}
+#define CURSOR_COLOUR (v4){.r = 0.85, .g = 0.38, .b = 0.38, .a = 1.00}
+
diff --git a/main.c b/main.c
@@ -87,16 +87,17 @@ main(i32 argc, char *argv[])
.colour_mode = CM_HSV,
.flags = CPF_REFILL_TEXTURE,
- .colour = {.r = 0.53, .g = 0.82, .b = 0.59, .a = 1.0},
.is = {.idx = -1, .cursor_t = 1, .cursor_t_target = 0},
.mcs = {.mode_visible_t = 1, .next_mode = -1},
.ss = {.scale_t = {1, 1, 1, 1}},
- .bg = { .r = 0x26, .g = 0x1e, .b = 0x22, .a = 0xff },
- .fg = { .r = 0xea, .g = 0xe1, .b = 0xb4, .a = 0xff },
+ .bg = COLOUR_PICKER_BG,
+ .fg = COLOUR_PICKER_FG,
- .hover_colour = {.r = 0.85, .g = 0.38, .b = 0.38, .a = 1.00},
+ .colour = STARTING_COLOUR,
+ .hover_colour = HOVER_COLOUR,
+ .cursor_colour = CURSOR_COLOUR,
.colour_stack = {
.fade_param = 1.0f,
diff --git a/util.c b/util.c
@@ -163,6 +163,7 @@ typedef struct {
f32 selection_hover_t[2];
v4 hover_colour;
+ v4 cursor_colour;
Shader picker_shader;
RenderTexture slider_texture;