mirror of
https://github.com/4jcraft/4jcraft.git
synced 2026-04-27 22:53:39 +00:00
Add minecraft icon :3
This commit is contained in:
parent
4b4cda41f4
commit
339f8e898f
|
|
@ -104,6 +104,7 @@ void C4JRender::Initialise() {
|
|||
|
||||
Uint32 winFlags = SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE;
|
||||
if (s_fullscreen) winFlags |= SDL_WINDOW_FULLSCREEN_DESKTOP;
|
||||
|
||||
s_window = SDL_CreateWindow("Minecraft Console Edition",
|
||||
SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
|
||||
s_windowWidth, s_windowHeight, winFlags);
|
||||
|
|
@ -124,6 +125,23 @@ void C4JRender::Initialise() {
|
|||
return;
|
||||
}
|
||||
|
||||
int w, h, channels;
|
||||
unsigned char* data = stbi_load("Common/Media/Graphics/MinecraftIcon.png", &w, &h, &channels, 4);
|
||||
if (!data) {
|
||||
SDL_Log("Failed to load icon: %s", SDL_GetError());
|
||||
} else {
|
||||
SDL_Surface* icon = SDL_CreateRGBSurfaceFrom(
|
||||
data, w, h, 32, w * 4,
|
||||
0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000
|
||||
);
|
||||
if (!icon) {
|
||||
SDL_Log("Failed to load icon: %s", SDL_GetError());
|
||||
} else {
|
||||
SDL_SetWindowIcon(s_window, icon);
|
||||
SDL_FreeSurface(icon);
|
||||
}
|
||||
}
|
||||
|
||||
// 4JCraft VSync/V-Sync
|
||||
#ifdef ENABLE_VSYNC
|
||||
SDL_GL_SetSwapInterval(1); // V-Sync On Please.
|
||||
|
|
|
|||
Loading…
Reference in a new issue