Added a program icon.
This commit is contained in:
@@ -20,7 +20,7 @@ UFLAGS =
|
|||||||
# hence we ignore the incompliance in our code.
|
# hence we ignore the incompliance in our code.
|
||||||
# NOTE: We allow function declrations with specifying void
|
# NOTE: We allow function declrations with specifying void
|
||||||
# (ex, void test() is allowed).
|
# (ex, void test() is allowed).
|
||||||
FLAGS = -ansi -pedantic -pedantic-errors -Wno-long-long \
|
FLAGS = -ansi -pedantic -pedantic-errors -Wno-long-long -Wno-overlength-strings \
|
||||||
-Wno-strict-prototypes -Wall -Wextra -fno-caret-diagnostics \
|
-Wno-strict-prototypes -Wall -Wextra -fno-caret-diagnostics \
|
||||||
-fno-show-column -Wno-missing-field-initializers \
|
-fno-show-column -Wno-missing-field-initializers \
|
||||||
-Wno-unused-function -Wno-unused-parameter -Wno-unused-variable \
|
-Wno-unused-function -Wno-unused-parameter -Wno-unused-variable \
|
||||||
|
|||||||
+117200
File diff suppressed because it is too large
Load Diff
@@ -25,6 +25,8 @@
|
|||||||
#include <x86intrin.h>
|
#include <x86intrin.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "program_icon.c"
|
||||||
|
|
||||||
#define RESOLUTION_WIDTH 960
|
#define RESOLUTION_WIDTH 960
|
||||||
#define RESOLUTION_HEIGHT 540
|
#define RESOLUTION_HEIGHT 540
|
||||||
|
|
||||||
@@ -727,12 +729,40 @@ S32 main(S32 argc, char *argv[])
|
|||||||
if(Window) {
|
if(Window) {
|
||||||
SDL_Renderer *Renderer;
|
SDL_Renderer *Renderer;
|
||||||
|
|
||||||
|
SDL_Surface* icon;
|
||||||
|
Uint32 rmask, gmask, bmask, amask;
|
||||||
|
|
||||||
SDL_DisplayMode display_mode;
|
SDL_DisplayMode display_mode;
|
||||||
SDL_GetCurrentDisplayMode(0, &display_mode);
|
SDL_GetCurrentDisplayMode(0, &display_mode);
|
||||||
|
|
||||||
Renderer = SDL_CreateRenderer(Window, -1, SDL_RENDERER_PRESENTVSYNC);
|
Renderer = SDL_CreateRenderer(Window, -1, SDL_RENDERER_PRESENTVSYNC);
|
||||||
SDL_SetWindowPosition(Window, (display_mode.w - RESOLUTION_WIDTH),
|
SDL_SetWindowPosition(Window, (display_mode.w - RESOLUTION_WIDTH),
|
||||||
(display_mode.h - RESOLUTION_HEIGHT));
|
(display_mode.h - RESOLUTION_HEIGHT));
|
||||||
|
|
||||||
|
/* Set program icon. */
|
||||||
|
#if SDL_BYTEORDER == SDL_BIG_ENDIAN
|
||||||
|
int shift = (program_icon.bytes_per_pixel == 3) ? 8 : 0;
|
||||||
|
rmask = 0xff000000 >> shift;
|
||||||
|
gmask = 0x00ff0000 >> shift;
|
||||||
|
bmask = 0x0000ff00 >> shift;
|
||||||
|
amask = 0x000000ff >> shift;
|
||||||
|
#else
|
||||||
|
rmask = 0x000000ff;
|
||||||
|
gmask = 0x0000ff00;
|
||||||
|
bmask = 0x00ff0000;
|
||||||
|
amask = (program_icon.bytes_per_pixel == 3) ? 0 : 0xff000000;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
icon = SDL_CreateRGBSurfaceFrom(
|
||||||
|
(void *)program_icon.pixel_data,
|
||||||
|
program_icon.width, program_icon.height,
|
||||||
|
program_icon.bytes_per_pixel * 8,
|
||||||
|
program_icon.bytes_per_pixel * program_icon.width,
|
||||||
|
rmask, gmask, bmask, amask);
|
||||||
|
|
||||||
|
SDL_SetWindowIcon(Window, icon);
|
||||||
|
SDL_FreeSurface(icon);
|
||||||
|
|
||||||
/* "Wayland needs an event loop and rendering or it won't function."
|
/* "Wayland needs an event loop and rendering or it won't function."
|
||||||
* https://github.com/libsdl-org/SDL/issues/7699#issuecomment-1545684792 */
|
* https://github.com/libsdl-org/SDL/issues/7699#issuecomment-1545684792 */
|
||||||
/* NOTE: This means that we need to readraw to even resize the
|
/* NOTE: This means that we need to readraw to even resize the
|
||||||
@@ -751,6 +781,7 @@ S32 main(S32 argc, char *argv[])
|
|||||||
void *BaseAddress = (void *)(0);
|
void *BaseAddress = (void *)(0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
GlobalRunning = TRUE;
|
GlobalRunning = TRUE;
|
||||||
|
|
||||||
Dimension = SDLGetWindowDimension(Window);
|
Dimension = SDLGetWindowDimension(Window);
|
||||||
|
|||||||
Reference in New Issue
Block a user