.info_boxes.rel = (SDL_FRect){.x = 0.25, .y = 0.00, .w = 0.75, .h = 1.00},
.rgb_info.rel = (SDL_FRect){.x = 0.00, .y = 0.00, .w = 1.00, .h = 0.50},
.red_component.body.rel = (SDL_FRect){.x = 0.00, .y = 0.00, .w = 0.30, .h = 1.00},
- .green_component.body.rel = (SDL_FRect){.x = 0.35, .y = 0.00, .w = 0.30, .h = 1.00},
- .blue_component.body.rel = (SDL_FRect){.x = 0.70, .y = 0.00, .w = 0.30, .h = 1.00},
- .hsl_info.rel = (SDL_FRect){.x = 0.00, .y = 0.50, .w = 1.00, .h = 0.50},
+ .green_component.body.rel = (SDL_FRect){.x = 0.00, .y = 0.40, .w = 0.30, .h = 1.00},
+ .blue_component.body.rel = (SDL_FRect){.x = 0.00, .y = 0.80, .w = 0.30, .h = 1.00},
+ .hsl_info.rel = (SDL_FRect){.x = 0.50, .y = 0.00, .w = 1.00, .h = 0.50},
.hue_component.body.rel = (SDL_FRect){.x = 0.00, .y = 0.00, .w = 0.30, .h = 1.00},
- .sat_component.body.rel = (SDL_FRect){.x = 0.35, .y = 0.00, .w = 0.30, .h = 1.00},
- .lum_component.body.rel = (SDL_FRect){.x = 0.70, .y = 0.00, .w = 0.30, .h = 1.00}
+ .sat_component.body.rel = (SDL_FRect){.x = 0.00, .y = 0.40, .w = 0.30, .h = 1.00},
+ .lum_component.body.rel = (SDL_FRect){.x = 0.00, .y = 0.80, .w = 0.30, .h = 1.00}
};
// For now we need a full path, maybe OpenFont can do automatic lookup
const char config_font_path[] = "/usr/share/fonts/TTF/iosevka-fixed-regular.ttf";
-// This currently acts more like a static resolution scale rather than font size
-const int config_font_size = 128;
+const int config_font_size = 36;
const int config_framerate = 30;
#endif //__PICKER_CONFIG__
int32_t render_text_container(Runtime_Info* runtime, Text_Container* tc)
{
+ // basics
tc->surface = TTF_RenderText_Solid(runtime->font, tc->text, black);
tc->texture = SDL_CreateTextureFromSurface(mgr.rend, tc->surface);
+
+ // Adjust text rendering so it doesn't fill the whole element
+ int width, height;
+ SDL_QueryTexture(tc->texture, NULL, NULL, &width, &height);
+ tc->body.real.w = (float)width;
+ tc->body.real.h = (float)height;
+
+ // slap it in there
SDL_RenderCopyF(mgr.rend, tc->texture, NULL, &tc->body.real);
// we'll keep this implicit to rendering for now to keep
// https://stackoverflow.com/questions/22886500/how-to-render-text-in-sdl2
int32_t render_info_boxes(Runtime_Info* runtime, SDL_FRect* container)
{
- sprintf(runtime->layout.red_component.text, "R:%d/%X\0", runtime->active_rgb.r, runtime->active_rgb.r);
- sprintf(runtime->layout.green_component.text, "G:%d/%X\0", runtime->active_rgb.g, runtime->active_rgb.g);
- sprintf(runtime->layout.blue_component.text, "B:%d/%X\0", runtime->active_rgb.b, runtime->active_rgb.b);
- sprintf(runtime->layout.hue_component.text, "H:%d/%X\0", runtime->active_hsl.h, runtime->active_hsl.h);
- sprintf(runtime->layout.sat_component.text, "S:%d/%X\0", runtime->active_hsl.s, runtime->active_hsl.s);
- sprintf(runtime->layout.lum_component.text, "L:%d/%X\0", runtime->active_hsl.l, runtime->active_hsl.l);
+ sprintf(runtime->layout.red_component.text, "R:%03d/x%02X\0", runtime->active_rgb.r, runtime->active_rgb.r);
+ sprintf(runtime->layout.green_component.text, "G:%03d/x%02X\0", runtime->active_rgb.g, runtime->active_rgb.g);
+ sprintf(runtime->layout.blue_component.text, "B:%03d/x%02X\0", runtime->active_rgb.b, runtime->active_rgb.b);
+ sprintf(runtime->layout.hue_component.text, "H:%03d/x%02X\0", runtime->active_hsl.h, runtime->active_hsl.h);
+ sprintf(runtime->layout.sat_component.text, "S:%03d/x%02X\0", runtime->active_hsl.s, runtime->active_hsl.s);
+ sprintf(runtime->layout.lum_component.text, "L:%03d/x%02X\0", runtime->active_hsl.l, runtime->active_hsl.l);
render_text_container(runtime, &runtime->layout.red_component);
render_text_container(runtime, &runtime->layout.green_component);