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 --- Makefile | 4 ++-- src/glamac/glamac.c | 2 +- src/glamac/glamac_render.c | 18 ++++++++++++++---- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 0f83283..904806c 100644 --- a/Makefile +++ b/Makefile @@ -26,8 +26,8 @@ GLAMAC_SRC=$(SRCDIR)/glamac/glamac.c \ $(SRCDIR)/glamac/glamac_events.c \ $(SRCDIR)/glamac/glass_data.c -# SDL2 Stuff -SDL2_CFLAGS=-I$(USERPROFILE)/scoop/apps/sdl2/current/include/SDl2 -I$(USERPROFILE)/scoop/apps/sdl2-ttf/current/include/SDL2_ttf -O2 -march=native -flto -ffast-math -s +# SDL2 Flags +SDL2_CFLAGS=-I$(USERPROFILE)/scoop/apps/sdl2/current/include/SDl2 -I$(USERPROFILE)/scoop/apps/sdl2-ttf/current/include/SDL2_ttf -O2 -march=native -flto -s #-ffast-math SDL2_LDFLAGS=-L$(USERPROFILE)/scoop/apps/sdl2/current/lib -L$(USERPROFILE)/scoop/apps/sdl2-ttf/current/lib -lSDL2main -lSDL2 -lSDL2_ttf -mwindows -flto SDL2_DLL_SRC=$(USERPROFILE)/scoop/apps/sdl2/current/lib/SDL2.dll SDL2_tff_DLL_SRC=$(USERPROFILE)/scoop/apps/sdl2-ttf/current/lib/SDL2_ttf.dll 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