use the new icon

This commit is contained in:
tildearrow 2022-01-07 03:29:56 -05:00
parent 0ff9eb4356
commit c6f17f1360
4 changed files with 3675 additions and 0 deletions

View File

@ -127,6 +127,7 @@ extern/imgui/backends/imgui_impl_sdl.cpp
extern/imgui/misc/cpp/imgui_stdlib.cpp
extern/igfd/ImGuiFileDialog.cpp
src/gui/icon.c
src/gui/plot_nolerp.cpp
src/gui/font_main.cpp
src/gui/font_icon.cpp

View File

@ -5,6 +5,7 @@
#include "SDL_render.h"
#include "SDL_video.h"
#include "fonts.h"
#include "icon.h"
#include "../ta-log.h"
#include "imgui.h"
#include "imgui_impl_sdl.h"
@ -2927,16 +2928,32 @@ bool FurnaceGUI::init() {
workingDir=e->getConfString("lastDir",getHomeDir());
#ifndef __APPLE__
unsigned char* furIcon=getFurnaceIcon();
SDL_Surface* icon=SDL_CreateRGBSurfaceFrom(furIcon,256,256,32,256*4,0xff,0xff00,0xff0000,0xff000000);
#endif
sdlWin=SDL_CreateWindow("Furnace",SDL_WINDOWPOS_CENTERED,SDL_WINDOWPOS_CENTERED,scrW*dpiScale,scrH*dpiScale,SDL_WINDOW_RESIZABLE|SDL_WINDOW_ALLOW_HIGHDPI);
if (sdlWin==NULL) {
logE("could not open window!\n");
return false;
}
SDL_GetDisplayDPI(SDL_GetWindowDisplayIndex(sdlWin),&dpiScaleF,NULL,NULL);
dpiScale=round(dpiScaleF/96.0f);
if (dpiScale<1) dpiScale=1;
if (dpiScale!=1) SDL_SetWindowSize(sdlWin,scrW*dpiScale,scrH*dpiScale);
#ifndef __APPLE__
if (icon!=NULL) {
SDL_SetWindowIcon(sdlWin,icon);
SDL_FreeSurface(icon);
free(furIcon);
} else {
logW("could not create icon!\n");
}
#endif
sdlRend=SDL_CreateRenderer(sdlWin,-1,SDL_RENDERER_ACCELERATED|SDL_RENDERER_PRESENTVSYNC|SDL_RENDERER_TARGETTEXTURE);
if (sdlRend==NULL) {

3650
src/gui/icon.c Normal file

File diff suppressed because it is too large Load Diff

7
src/gui/icon.h Normal file
View File

@ -0,0 +1,7 @@
#ifdef __cplusplus
extern "C" {
#endif
unsigned char* getFurnaceIcon();
#ifdef __cplusplus
}
#endif