Merge pull request #51 from Clownacy/master

Added the cursors and icons
This commit is contained in:
Cucky 2019-02-10 13:22:47 -05:00 committed by GitHub
commit 1e03ec73ce
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 138 additions and 9 deletions

View file

@ -129,7 +129,8 @@ RESOURCES = \
BITMAP/CREDIT16.bmp \
BITMAP/CREDIT17.bmp \
BITMAP/CREDIT18.bmp \
ICON/4.bmp \
CURSOR/CURSOR_IKA.bmp \
CURSOR/CURSOR_NORMAL.bmp \
ORG/ACCESS \
ORG/ANZEN \
ORG/BALCONY \
@ -180,8 +181,16 @@ else
RESOURCES += BITMAP/PIXEL.bmp
endif
ifneq ($(WINDOWS), 1)
RESOURCES += ICON/ICON_MINI.bmp
endif
OBJECTS = $(addprefix obj/$(FILENAME)/, $(addsuffix .o, $(SOURCES)))
ifeq ($(WINDOWS), 1)
OBJECTS += obj/$(FILENAME)/win_icon.o
endif
all: build/$(FILENAME)
build/$(FILENAME): $(OBJECTS)
@ -209,5 +218,9 @@ obj/bin2h: res/bin2h.c
@echo Compiling $^
@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:
@rm -rf build obj

BIN
res/CURSOR/CURSOR_IKA.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 654 B

BIN
res/CURSOR/CURSOR_IKA.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 400 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 258 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 338 B

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"

View file

Before

Width:  |  Height:  |  Size: 282 B

After

Width:  |  Height:  |  Size: 282 B

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
strcpy(gDataPath, gModulePath);
memcpy(&gDataPath[strlen(gDataPath)], "/data", 6); //Pixel didn't use a strcat
#ifdef WINDOWS
// Set the window icons. See res/ICON/ICON.rc.
SDL_SetHint(SDL_HINT_WINDOWS_INTRESOURCE_ICON, "101");
SDL_SetHint(SDL_HINT_WINDOWS_INTRESOURCE_ICON_SMALL, "102");
#endif
//Initialize SDL
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_EVENTS | SDL_INIT_GAMECONTROLLER) >= 0)
{
@ -204,7 +210,29 @@ int main(int argc, char *argv[])
}
RECT unused_rect = {0, 0, 320, 240};
//Load cursor
SDL_RWops *fp = FindResource("CURSOR_NORMAL");
if (fp)
{
SDL_Surface *cursor_surface = SDL_LoadBMP_RW(fp, 1);
SDL_SetColorKey(cursor_surface, SDL_TRUE, SDL_MapRGB(cursor_surface->format, 0xFF, 0, 0xFF)); // Pink regions are transparent
SDL_Cursor *cursor = SDL_CreateColorCursor(cursor_surface, 0, 0); // Don't worry, the hotspots are accurate to the original files
if (cursor)
SDL_SetCursor(cursor);
else
printf("Failed to load cursor");
SDL_FreeSurface(cursor_surface);
}
else
{
printf("Failed to load cursor");
}
//Get window dimensions and colour depth
int colourDepth = 16;
@ -263,8 +291,9 @@ int main(int argc, char *argv[])
if (CheckFileExists("fps"))
bFps = true;
#ifndef WINDOWS
//Load icon
SDL_RWops *fp = FindResource("ICON4");
SDL_RWops *fp = FindResource("ICON_MINI");
if (fp)
{
@ -281,7 +310,8 @@ int main(int argc, char *argv[])
{
printf("Failed to load icon");
}
#endif
//Set rects
RECT loading_rect = {0, 0, 64, 8};
RECT clip_rect = {0, 0, gWindowWidth, gWindowHeight};

View file

@ -69,7 +69,11 @@
#else
#include "Resource/BITMAP/PIXEL.bmp.h"
#endif
#include "Resource/ICON/4.bmp.h"
#ifndef WINDOWS
#include "Resource/ICON/ICON_MINI.bmp.h"
#endif
#include "Resource/CURSOR/CURSOR_IKA.bmp.h"
#include "Resource/CURSOR/CURSOR_NORMAL.bmp.h"
const unsigned char* GetResource(const char *name, size_t *size)
{
@ -389,11 +393,25 @@ const unsigned char* GetResource(const char *name, size_t *size)
#endif
}
#ifndef WINDOWS
//ICON
if (!strcmp(name, "ICON4"))
if (!strcmp(name, "ICON_MINI"))
{
*size = sizeof(r4);
return r4;
*size = sizeof(rICON_MINI);
return rICON_MINI;
}
#endif
//CURSOR
if (!strcmp(name, "CURSOR_NORMAL"))
{
*size = sizeof(rCURSOR_NORMAL);
return rCURSOR_NORMAL;
}
if (!strcmp(name, "CURSOR_IKA"))
{
*size = sizeof(rCURSOR_IKA);
return rCURSOR_IKA;
}
return NULL;
}

View file

@ -0,0 +1,45 @@
#pragma once
const unsigned char rCURSOR_IKA[0x28E] = {
0x42, 0x4D, 0x8E, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8E, 0x00, 0x00, 0x00, 0x6C, 0x00,
0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x04, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x23, 0x2E, 0x00, 0x00, 0x23, 0x2E, 0x00, 0x00, 0x05, 0x00,
0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x42, 0x47, 0x52, 0x73, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00,
0xFF, 0x00, 0x80, 0x80, 0x80, 0x00, 0xC0, 0xC0, 0xC0, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x11, 0x11,
0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
0x11, 0x11, 0x11, 0x10, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
0x11, 0x11, 0x11, 0x04, 0x01, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
0x11, 0x11, 0x11, 0x04, 0x40, 0x10, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
0x11, 0x11, 0x11, 0x03, 0x40, 0x04, 0x01, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
0x11, 0x11, 0x10, 0x00, 0x30, 0x44, 0x01, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
0x11, 0x11, 0x03, 0x30, 0x00, 0x34, 0x01, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
0x11, 0x11, 0x04, 0x44, 0x00, 0x03, 0x01, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
0x11, 0x10, 0x44, 0x44, 0x40, 0x00, 0x00, 0x00, 0x01, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x01,
0x11, 0x04, 0x44, 0x04, 0x44, 0x00, 0x03, 0x44, 0x40, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x00,
0x10, 0x34, 0x40, 0x44, 0x44, 0x40, 0x00, 0x34, 0x01, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x04,
0x00, 0x34, 0x04, 0x44, 0x44, 0x44, 0x00, 0x00, 0x00, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x04,
0x40, 0x04, 0x44, 0x44, 0x44, 0x44, 0x40, 0x03, 0x44, 0x01, 0x11, 0x11, 0x11, 0x11, 0x11, 0x04,
0x44, 0x03, 0x44, 0x44, 0x44, 0x44, 0x44, 0x00, 0x34, 0x40, 0x11, 0x11, 0x11, 0x11, 0x11, 0x04,
0x44, 0x30, 0x44, 0x44, 0x44, 0x40, 0x44, 0x40, 0x00, 0x01, 0x11, 0x11, 0x11, 0x11, 0x11, 0x04,
0x44, 0x42, 0x04, 0x44, 0x44, 0x04, 0x44, 0x43, 0x01, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x04,
0x44, 0x44, 0x00, 0x44, 0x40, 0x44, 0x42, 0x00, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x04,
0x44, 0x44, 0x40, 0x04, 0x44, 0x44, 0x00, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x04,
0x44, 0x44, 0x44, 0x00, 0x34, 0x30, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x04,
0x44, 0x44, 0x44, 0x42, 0x00, 0x01, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x04,
0x44, 0x44, 0x44, 0x44, 0x30, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x04,
0x44, 0x44, 0x44, 0x44, 0x43, 0x01, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11
};

View file

@ -0,0 +1,21 @@
#pragma once
const unsigned char rCURSOR_NORMAL[0x102] = {
0x42, 0x4D, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x82, 0x00, 0x00, 0x00, 0x6C, 0x00,
0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00,
0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x23, 0x2E, 0x00, 0x00, 0x23, 0x2E, 0x00, 0x00, 0x02, 0x00,
0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x42, 0x47, 0x52, 0x73, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00, 0xFF,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0xF0,
0x00, 0x00, 0x10, 0xF0, 0x00, 0x00, 0x19, 0xE0, 0x00, 0x00, 0x1F, 0xE0, 0x00, 0x00, 0x1F, 0xC0,
0x00, 0x00, 0x1F, 0xFC, 0x00, 0x00, 0x1F, 0xF8, 0x00, 0x00, 0x1F, 0xF0, 0x00, 0x00, 0x1F, 0xE0,
0x00, 0x00, 0x1F, 0xC0, 0x00, 0x00, 0x1F, 0x80, 0x00, 0x00, 0x1F, 0x00, 0x00, 0x00, 0x1E, 0x00,
0x00, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00
};

View file

@ -1,6 +1,6 @@
#pragma once
const unsigned char r4[0x11A] = {
const unsigned char rICON_MINI[0x11A] = {
0x42, 0x4D, 0x1A, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9A, 0x00, 0x00, 0x00, 0x6C, 0x00,
0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x04, 0x00, 0x00, 0x00,
0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x23, 0x2E, 0x00, 0x00, 0x23, 0x2E, 0x00, 0x00, 0x08, 0x00,