mirror of
https://github.com/celisej567/mcpe.git
synced 2026-09-11 20:11:18 +03:00
* Fix big bad init bug in regards to window icons.
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
#include "common/Utils.hpp"
|
||||
|
||||
AppPlatform_sdl::AppPlatform_sdl(std::string storageDir, SDL_Window *window)
|
||||
: AppPlatform_sdlbase(storageDir, window, loadTexture("gui/default_world.png"))
|
||||
: AppPlatform_sdlbase(storageDir, window)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -26,14 +26,13 @@ void AppPlatform_sdlbase::_init(std::string storageDir, SDL_Window *window)
|
||||
ensureDirectoryExists(_storageDir.c_str());
|
||||
}
|
||||
|
||||
void AppPlatform_sdlbase::_init(std::string storageDir, SDL_Window *window, const Texture& icon)
|
||||
void AppPlatform_sdlbase::setIcon(const Texture& icon)
|
||||
{
|
||||
_init(storageDir, window);
|
||||
|
||||
_iconTexture = new Texture(icon);
|
||||
_icon = getSurfaceForTexture(_iconTexture);
|
||||
|
||||
if (_icon)
|
||||
SDL_SetWindowIcon(window, _icon);
|
||||
SDL_SetWindowIcon(_window, _icon);
|
||||
}
|
||||
|
||||
AppPlatform_sdlbase::~AppPlatform_sdlbase()
|
||||
|
||||
@@ -12,14 +12,9 @@ class AppPlatform_sdlbase : public AppPlatform
|
||||
{
|
||||
public:
|
||||
void _init(std::string storageDir, SDL_Window *window);
|
||||
void _init(std::string storageDir, SDL_Window *window, const Texture& icon);
|
||||
AppPlatform_sdlbase(std::string storageDir, SDL_Window *window)
|
||||
{
|
||||
_init(storageDir, window);
|
||||
}
|
||||
AppPlatform_sdlbase(std::string storageDir, SDL_Window *window, const Texture& icon)
|
||||
{
|
||||
_init(storageDir, window, icon);
|
||||
}
|
||||
~AppPlatform_sdlbase();
|
||||
|
||||
@@ -59,4 +54,6 @@ protected:
|
||||
std::string _storageDir;
|
||||
|
||||
virtual void ensureDirectoryExists(const char* path) { }
|
||||
|
||||
void setIcon(const Texture& icon); // note: this takes ownership of the texture, so no memory leaks!
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user