From 6265f81b14e95e939119a4e22132cd69261118e0 Mon Sep 17 00:00:00 2001 From: Clownacy Date: Sun, 10 Feb 2019 16:35:23 +0000 Subject: [PATCH] Added cursors --- Makefile | 2 ++ res/CURSOR/CURSOR_IKA.bmp | Bin 0 -> 654 bytes res/CURSOR/CURSOR_IKA.png | Bin 0 -> 400 bytes res/CURSOR/CURSOR_NORMAL.bmp | Bin 0 -> 258 bytes res/CURSOR/CURSOR_NORMAL.png | Bin 0 -> 338 bytes src/Main.cpp | 22 ++++++++++++ src/Resource.cpp | 14 ++++++++ src/Resource/CURSOR/CURSOR_IKA.bmp.h | 45 ++++++++++++++++++++++++ src/Resource/CURSOR/CURSOR_NORMAL.bmp.h | 21 +++++++++++ 9 files changed, 104 insertions(+) create mode 100644 res/CURSOR/CURSOR_IKA.bmp create mode 100644 res/CURSOR/CURSOR_IKA.png create mode 100644 res/CURSOR/CURSOR_NORMAL.bmp create mode 100644 res/CURSOR/CURSOR_NORMAL.png create mode 100644 src/Resource/CURSOR/CURSOR_IKA.bmp.h create mode 100644 src/Resource/CURSOR/CURSOR_NORMAL.bmp.h diff --git a/Makefile b/Makefile index a8b33ca1..7a6caea2 100644 --- a/Makefile +++ b/Makefile @@ -129,6 +129,8 @@ RESOURCES = \ BITMAP/CREDIT16.bmp \ BITMAP/CREDIT17.bmp \ BITMAP/CREDIT18.bmp \ + CURSOR/CURSOR_IKA.bmp \ + CURSOR/CURSOR_NORMAL.bmp \ ICON/4.bmp \ ORG/ACCESS \ ORG/ANZEN \ diff --git a/res/CURSOR/CURSOR_IKA.bmp b/res/CURSOR/CURSOR_IKA.bmp new file mode 100644 index 0000000000000000000000000000000000000000..6c14d1a20daeb6f858c3ff53b4585fc4e727b32c GIT binary patch literal 654 zcmd5(F%H5o40MUv+aDmYqYQmO6i#Ad;T>#zpfBi~`m=B*NoiOR89!C8V#ikial4P1DS(ZgoN;3RI^dC!T*A_Ii9WFE- zy?AUVoR@Kn72-Cy2Lf+WD&3&4288S>{TQsFDyWPKfCHJ=U=YC-ONBEG8MA=G8%>35 spoj`OoQofUkdF28#HLsww=pfh9>8#{%d%=1Z#v^DPQLu@b^goa3E=5Ej{pDw literal 0 HcmV?d00001 diff --git a/res/CURSOR/CURSOR_IKA.png b/res/CURSOR/CURSOR_IKA.png new file mode 100644 index 0000000000000000000000000000000000000000..c497cca7c126dae9ebd94eea5bc78d32851fb251 GIT binary patch literal 400 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE0wix1Z>k4UEa{HEjtmSN`?>!lvVtU&J%W50 z7^>757#dm_7=8hT8eT9klo~KFyh>nTu$sZZAYL$MSD+10f+@+{-G$+Qd;gjJKpuOE zr>`sfBTgX!UB2CKEUy5CW_Y?dhIkx*JH=6~L4m{N`3t$;*%uEfIlClWb&C3#@{eWF z0sE%8`fMAT4iyPcm?+&aO)G(^;oy{C-JbtqmoluExnGpjuuR3ji?)005oz6I=iQ literal 0 HcmV?d00001 diff --git a/res/CURSOR/CURSOR_NORMAL.png b/res/CURSOR/CURSOR_NORMAL.png new file mode 100644 index 0000000000000000000000000000000000000000..b708311ff07ebc194cdfa4b2d8d64e82b67281b3 GIT binary patch literal 338 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnH3?%tPCZz)@mUKs7M+SzC{oH>NSwWJ?9znhg z3{`3j3=J&|48MRv4KElNN(~qoUL`OvSj}Ky5HFasE6@fg!5QEa;tHf0{xkgl|KD>b zM;wsNSQ6wH%;50sMjD8d21sKjP%)Ru|yp(SHXNvh;Lu43W5; zoY27NW^tJD7)OJlQ$kMwI`hEN8-m9Y8YFuYI;<8LM@YWlWjIsH@$LNcLnc5&R7+eV zN>UO_QmvAUQh^kMk%6Iwu7Rblp=pSrp_Q?vm7$rgfw`4|fuc-iJ&K0h{FKbJO57R( T94{UQYGCkm^>bP0l+XkKXc<~- literal 0 HcmV?d00001 diff --git a/src/Main.cpp b/src/Main.cpp index 547cb977..38c9fc79 100644 --- a/src/Main.cpp +++ b/src/Main.cpp @@ -204,7 +204,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; diff --git a/src/Resource.cpp b/src/Resource.cpp index 1cae74a4..52e704c5 100644 --- a/src/Resource.cpp +++ b/src/Resource.cpp @@ -70,6 +70,8 @@ #include "Resource/BITMAP/PIXEL.bmp.h" #endif #include "Resource/ICON/4.bmp.h" +#include "Resource/CURSOR/CURSOR_IKA.bmp.h" +#include "Resource/CURSOR/CURSOR_NORMAL.bmp.h" const unsigned char* GetResource(const char *name, size_t *size) { @@ -395,6 +397,18 @@ const unsigned char* GetResource(const char *name, size_t *size) *size = sizeof(r4); return r4; } + + //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; } diff --git a/src/Resource/CURSOR/CURSOR_IKA.bmp.h b/src/Resource/CURSOR/CURSOR_IKA.bmp.h new file mode 100644 index 00000000..6d3a1368 --- /dev/null +++ b/src/Resource/CURSOR/CURSOR_IKA.bmp.h @@ -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 +}; diff --git a/src/Resource/CURSOR/CURSOR_NORMAL.bmp.h b/src/Resource/CURSOR/CURSOR_NORMAL.bmp.h new file mode 100644 index 00000000..084f17af --- /dev/null +++ b/src/Resource/CURSOR/CURSOR_NORMAL.bmp.h @@ -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 +};