sa2: add application icon.
Signed-off-by: Andrea Odetti <mariofutire@gmail.com>
This commit is contained in:
parent
dec8b54a9e
commit
b59e7605e9
2 changed files with 17 additions and 0 deletions
|
@ -14,17 +14,20 @@ find_package(Boost REQUIRED
|
|||
)
|
||||
|
||||
find_package(SDL2 REQUIRED)
|
||||
pkg_search_module(SDL2_IMAGE REQUIRED SDL2_image)
|
||||
|
||||
target_compile_features(sa2 PUBLIC cxx_std_17)
|
||||
|
||||
target_include_directories(sa2 PRIVATE
|
||||
${Boost_INCLUDE_DIRS}
|
||||
${SDL2_INCLUDE_DIRS}
|
||||
${SDL2_IMAGE_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
target_link_libraries(sa2 PRIVATE
|
||||
Boost::program_options
|
||||
${SDL2_LIBRARIES}
|
||||
${SDL2_IMAGE_LIBRARIES}
|
||||
appleii
|
||||
common2
|
||||
)
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#include <iostream>
|
||||
#include <SDL.h>
|
||||
#include <SDL_image.h>
|
||||
#include <memory>
|
||||
#include <iomanip>
|
||||
|
||||
|
@ -12,6 +13,7 @@
|
|||
#include "frontends/common2/utils.h"
|
||||
#include "frontends/common2/programoptions.h"
|
||||
#include "frontends/common2/timer.h"
|
||||
#include <frontends/common2/resources.h>
|
||||
#include "frontends/sa2/emulator.h"
|
||||
#include "frontends/sa2/gamepad.h"
|
||||
#include "frontends/sa2/sdirectsound.h"
|
||||
|
@ -159,6 +161,16 @@ namespace
|
|||
return interval;
|
||||
}
|
||||
|
||||
void setApplicationIcon(const std::shared_ptr<SDL_Window> & win)
|
||||
{
|
||||
const std::string path = getResourcePath() + "APPLEWIN.ICO";
|
||||
std::shared_ptr<SDL_Surface> icon(IMG_Load(path.c_str()), SDL_FreeSurface);
|
||||
if (icon)
|
||||
{
|
||||
SDL_SetWindowIcon(win.get(), icon.get());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
int MessageBox(HWND, const char * text, const char * caption, UINT type)
|
||||
|
@ -225,6 +237,8 @@ void run_sdl(int argc, const char * argv [])
|
|||
return;
|
||||
}
|
||||
|
||||
setApplicationIcon(win);
|
||||
|
||||
std::shared_ptr<SDL_Renderer> ren(SDL_CreateRenderer(win.get(), options.sdlDriver, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC), SDL_DestroyRenderer);
|
||||
if (!ren)
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue