From 970169f035a670ab3721ee7c889da07ed25f2931 Mon Sep 17 00:00:00 2001 From: admin Date: Sat, 26 Apr 2025 00:38:31 +0200 Subject: added Vd and nd to axis --- src/glamac/glamac.c | 2 +- src/glamac/glamac_render.c | 18 ++++++++++++++---- 2 files changed, 15 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/glamac/glamac.c b/src/glamac/glamac.c index 955d515..d176403 100644 --- a/src/glamac/glamac.c +++ b/src/glamac/glamac.c @@ -45,7 +45,7 @@ int main(int argc, char* argv[]) { } // Create window with SDL2 - window = SDL_CreateWindow("Optical Glass Map", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, + window = SDL_CreateWindow("GlaMaC", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, INITIAL_WIDTH, INITIAL_HEIGHT, SDL_WINDOW_SHOWN | SDL_WINDOW_RESIZABLE); if (window == NULL) { diff --git a/src/glamac/glamac_render.c b/src/glamac/glamac_render.c index 201738b..a39a670 100644 --- a/src/glamac/glamac_render.c +++ b/src/glamac/glamac_render.c @@ -163,11 +163,21 @@ void draw_axes(SDL_Renderer *renderer, TTF_Font *font, TTF_Font *titleFont, cons draw_text(renderer, font, label, padding - 50, y - 10, black); } - // Add axis titles - draw_text(renderer, titleFont, "Abbe Number", view->windowWidth / 2 - 50, view->windowHeight - padding + 30, black); - draw_text(renderer, titleFont, "Refractive Index", padding - 20, padding - 30, black); + // Add axis titles with subscripts + // For X axis title (Abbe Number) + draw_text(renderer, titleFont, "Abbe Number (V", view->windowWidth / 2 - 80, view->windowHeight - padding + 30, black); + // Draw the subscript "d" with a smaller font and lowered position + draw_text(renderer, font, "d", view->windowWidth / 2 + 54, view->windowHeight - padding + 38, black); + // Draw the closing parenthesis + draw_text(renderer, titleFont, ")", view->windowWidth / 2 + 63, view->windowHeight - padding + 30, black); + + // For Y axis title (Refractive Index) + draw_text(renderer, titleFont, "Refractive Index (n", padding - 20, padding - 35, black); + // Draw the subscript "d" with a smaller font and lowered position + draw_text(renderer, font, "d", padding + 132, padding - 25, black); + // Draw the closing parenthesis + draw_text(renderer, titleFont, ")", padding + 141, padding - 35, black); } - // Function to draw a grid based on visible data range void draw_grid(SDL_Renderer *renderer, const ViewState* view) { const i32 padding = (i32)(view->windowWidth * PADDING_PERCENT); -- cgit v1.2.3