Added Windows-specific icon files

This commit is contained in:
Clownacy 2019-02-10 16:55:54 +00:00
parent 2ee2a1b34b
commit d4c0cde748
6 changed files with 30 additions and 5 deletions

View file

@ -131,7 +131,6 @@ RESOURCES = \
BITMAP/CREDIT18.bmp \ BITMAP/CREDIT18.bmp \
CURSOR/CURSOR_IKA.bmp \ CURSOR/CURSOR_IKA.bmp \
CURSOR/CURSOR_NORMAL.bmp \ CURSOR/CURSOR_NORMAL.bmp \
ICON/4.bmp \
ORG/ACCESS \ ORG/ACCESS \
ORG/ANZEN \ ORG/ANZEN \
ORG/BALCONY \ ORG/BALCONY \
@ -182,8 +181,16 @@ else
RESOURCES += BITMAP/PIXEL.bmp RESOURCES += BITMAP/PIXEL.bmp
endif endif
ifneq ($(WINDOWS), 1)
RESOURCES += ICON/4.bmp
endif
OBJECTS = $(addprefix obj/$(FILENAME)/, $(addsuffix .o, $(SOURCES))) OBJECTS = $(addprefix obj/$(FILENAME)/, $(addsuffix .o, $(SOURCES)))
ifeq ($(WINDOWS), 1)
OBJECTS += obj/$(FILENAME)/win_icon.o
endif
all: build/$(FILENAME) all: build/$(FILENAME)
build/$(FILENAME): $(OBJECTS) build/$(FILENAME): $(OBJECTS)
@ -211,5 +218,9 @@ obj/bin2h: res/bin2h.c
@echo Compiling $^ @echo Compiling $^
@gcc -O3 -s -static $^ -o $@ @gcc -O3 -s -static $^ -o $@
obj/$(FILENAME)/win_icon.o: res/ICON/ICON.rc res/ICON/0.ico res/ICON/ICON_MINI.ico
@mkdir -p $(@D)
@windres $< $@
clean: clean:
@rm -rf build obj @rm -rf build obj

BIN
res/ICON/0.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 766 B

2
res/ICON/ICON.rc Normal file
View file

@ -0,0 +1,2 @@
101 ICON "0.ico"
102 ICON "ICON_MINI.ico"

BIN
res/ICON/ICON_MINI.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 318 B

View file

@ -102,7 +102,13 @@ int main(int argc, char *argv[])
//Get path of the data folder //Get path of the data folder
strcpy(gDataPath, gModulePath); strcpy(gDataPath, gModulePath);
memcpy(&gDataPath[strlen(gDataPath)], "/data", 6); //Pixel didn't use a strcat memcpy(&gDataPath[strlen(gDataPath)], "/data", 6); //Pixel didn't use a strcat
#ifdef WINDOWS
// Set the window icons. See icon.rc.
SDL_SetHint(SDL_HINT_WINDOWS_INTRESOURCE_ICON, "101");
SDL_SetHint(SDL_HINT_WINDOWS_INTRESOURCE_ICON_SMALL, "102");
#endif
//Initialize SDL //Initialize SDL
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_EVENTS | SDL_INIT_GAMECONTROLLER) >= 0) if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_EVENTS | SDL_INIT_GAMECONTROLLER) >= 0)
{ {
@ -226,7 +232,7 @@ int main(int argc, char *argv[])
{ {
printf("Failed to load cursor"); printf("Failed to load cursor");
} }
//Get window dimensions and colour depth //Get window dimensions and colour depth
int colourDepth = 16; int colourDepth = 16;
@ -285,6 +291,7 @@ int main(int argc, char *argv[])
if (CheckFileExists("fps")) if (CheckFileExists("fps"))
bFps = true; bFps = true;
#ifndef WINDOWS
//Load icon //Load icon
SDL_RWops *fp = FindResource("ICON4"); SDL_RWops *fp = FindResource("ICON4");
@ -303,7 +310,8 @@ int main(int argc, char *argv[])
{ {
printf("Failed to load icon"); printf("Failed to load icon");
} }
#endif
//Set rects //Set rects
RECT loading_rect = {0, 0, 64, 8}; RECT loading_rect = {0, 0, 64, 8};
RECT clip_rect = {0, 0, gWindowWidth, gWindowHeight}; RECT clip_rect = {0, 0, gWindowWidth, gWindowHeight};

View file

@ -69,7 +69,9 @@
#else #else
#include "Resource/BITMAP/PIXEL.bmp.h" #include "Resource/BITMAP/PIXEL.bmp.h"
#endif #endif
#ifndef WINDOWS
#include "Resource/ICON/4.bmp.h" #include "Resource/ICON/4.bmp.h"
#endif
#include "Resource/CURSOR/CURSOR_IKA.bmp.h" #include "Resource/CURSOR/CURSOR_IKA.bmp.h"
#include "Resource/CURSOR/CURSOR_NORMAL.bmp.h" #include "Resource/CURSOR/CURSOR_NORMAL.bmp.h"
@ -391,13 +393,15 @@ const unsigned char* GetResource(const char *name, size_t *size)
#endif #endif
} }
#ifndef WINDOWS
//ICON //ICON
if (!strcmp(name, "ICON4")) if (!strcmp(name, "ICON4"))
{ {
*size = sizeof(r4); *size = sizeof(r4);
return r4; return r4;
} }
#endif
//CURSOR //CURSOR
if (!strcmp(name, "CURSOR_NORMAL")) if (!strcmp(name, "CURSOR_NORMAL"))
{ {