From 5fd4cb8ab3bb7b44899e2a68703ec3a1d5979f1d Mon Sep 17 00:00:00 2001 From: admin Date: Fri, 25 Apr 2025 23:46:04 +0200 Subject: Added Icon --- Makefile | 48 ++++++++++++++++++++++++++++++---------------- glamac.rc | 27 ++++++++++++++++++++++++++ res/icons/glamac_icon.ico | Bin 0 -> 139319 bytes res/icons/glamac_icon.png | Bin 0 -> 482968 bytes structure.txt | 8 ++++++++ 5 files changed, 67 insertions(+), 16 deletions(-) create mode 100644 glamac.rc create mode 100644 res/icons/glamac_icon.ico create mode 100644 res/icons/glamac_icon.png diff --git a/Makefile b/Makefile index 6847ef1..0f83283 100644 --- a/Makefile +++ b/Makefile @@ -1,22 +1,32 @@ CC=gcc -#Base Directories +# Base Directories SRCDIR=src BINDIR=bin INCDIR=include +RESDIR=res -#Common flags +# Common flags CFLAGS=-I$(INCDIR) -O2 -march=native -flto #-ffast-math -#glautils -GLA_SRCS = $(wildcard $(SRCDIR)/glautils/*.c) -GLA_EXES = $(patsubst $(SRCDIR)/glautils/%.c, $(BINDIR)/%.exe, $(GLA_SRCS)) -#glamac -GLAMAC_SRC = $(SRCDIR)/glamac/glamac.c \ - $(SRCDIR)/glamac/glamac_view.c \ - $(SRCDIR)/glamac/glamac_render.c \ - $(SRCDIR)/glamac/glamac_events.c \ - $(SRCDIR)/glamac/glass_data.c -#SDL2 Stuff +# Resource compiler for Windows +WINDRES=windres + +# Resource file definitions +RESOURCE_FILE=glamac.rc # Your resource script file with icon definitions +RESOURCE_OBJ=$(BINDIR)/glamac_res.o # The compiled resource object file + +# glautils +GLA_SRCS=$(wildcard $(SRCDIR)/glautils/*.c) +GLA_EXES=$(patsubst $(SRCDIR)/glautils/%.c, $(BINDIR)/%.exe, $(GLA_SRCS)) + +# glamac +GLAMAC_SRC=$(SRCDIR)/glamac/glamac.c \ + $(SRCDIR)/glamac/glamac_view.c \ + $(SRCDIR)/glamac/glamac_render.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_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 @@ -25,24 +35,30 @@ SDL2_DLL_DEST=$(BINDIR) # Setup target setup: - mkdir -p $(BINDIR) $(INCDIR) + mkdir -p $(BINDIR) -all: setup glautils glamac sdl2 structure +all: glautils glamac sdl2 structure glautils: $(GLA_EXES) $(BINDIR)/%.exe: $(SRCDIR)/glautils/%.c $(CC) $< $(CFLAGS) -o $@ +# Compile resource file +$(RESOURCE_OBJ): $(RESOURCE_FILE) + $(WINDRES) -i $< -o $@ + +# Link glamac with resources glamac: $(BINDIR)/glamac.exe -$(BINDIR)/%.exe: $(GLAMAC_SRC) +$(BINDIR)/glamac.exe: $(GLAMAC_SRC) $(RESOURCE_OBJ) $(CC) $^ $(CFLAGS) $(SDL2_CFLAGS) $(SDL2_LDFLAGS) -o $@ sdl2: cp $(SDL2_DLL_SRC) $(SDL2_DLL_DEST) cp $(SDL2_tff_DLL_SRC) $(SDL2_DLL_DEST) + clean: rm -f $(BINDIR)/* - rm structure.txt + rm -f structure.txt rebuild: clean all diff --git a/glamac.rc b/glamac.rc new file mode 100644 index 0000000..b656313 --- /dev/null +++ b/glamac.rc @@ -0,0 +1,27 @@ +// Application icon +1 ICON "res/icons/glamac_icon.ico" + +// Optional: version information +1 VERSIONINFO +FILEVERSION 1,0,0,0 +PRODUCTVERSION 1,0,0,0 +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904E4" // U.S. English, multilingual charset + BEGIN + VALUE "CompanyName", "optics-design.com" + VALUE "FileDescription", "Optical Glass Map" + VALUE "FileVersion", "1.0.0" + VALUE "InternalName", "glamac" + VALUE "LegalCopyright", "Copyright (C) 2025 optics-design.com" + VALUE "OriginalFilename", "glamac.exe" + VALUE "ProductName", "GlaMaC" + VALUE "ProductVersion", "0.1.0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1252 // U.S. English, Windows ANSI + END +END diff --git a/res/icons/glamac_icon.ico b/res/icons/glamac_icon.ico new file mode 100644 index 0000000..68b2636 Binary files /dev/null and b/res/icons/glamac_icon.ico differ diff --git a/res/icons/glamac_icon.png b/res/icons/glamac_icon.png new file mode 100644 index 0000000..4faa20b Binary files /dev/null and b/res/icons/glamac_icon.png differ diff --git a/structure.txt b/structure.txt index 53c0568..f1ce652 100644 --- a/structure.txt +++ b/structure.txt @@ -4,6 +4,7 @@ glamac | compile_flags.txt | COPYING | COPYRIGHT +| glamac.rc | Makefile | README.md | structure.txt @@ -11,6 +12,7 @@ glamac +---bin | gla.exe | glamac.exe +| glamac_res.o | SDL2.dll | SDL2_ttf.dll | @@ -44,6 +46,12 @@ glamac | glamac_view.h | glass_data.h | ++---res +| +---icons +| | glamac_icon.ico +| | glamac_icon.png +| | +| \---images \---src +---glamac | glamac.c -- cgit v1.2.3