mirror of
https://github.com/aseprite/aseprite.git
synced 2025-02-21 03:40:57 +00:00
Merge all she::instance() implementations
Only she::create_system() must be provided by the platform impl.
This commit is contained in:
parent
2f987ac3c3
commit
08bb51e358
@ -66,7 +66,7 @@ int app_main(int argc, char* argv[])
|
||||
MemLeak memleak;
|
||||
base::SystemConsole systemConsole;
|
||||
app::AppOptions options(argc, const_cast<const char**>(argv));
|
||||
she::ScopedHandle<she::System> system(she::create_system());
|
||||
she::ScopedHandle<she::System> system(she::instance());
|
||||
app::App app;
|
||||
|
||||
// Change the name of the memory dump file
|
||||
|
@ -2,7 +2,8 @@
|
||||
# Copyright (C) 2012-2016 David Capello
|
||||
|
||||
set(SHE_SOURCES
|
||||
common/freetype_font.cpp)
|
||||
common/freetype_font.cpp
|
||||
system.cpp)
|
||||
|
||||
######################################################################
|
||||
# Allegro 4 backend
|
||||
|
@ -63,8 +63,6 @@
|
||||
#include "she/alleg4/mouse_poller.h"
|
||||
#endif
|
||||
|
||||
static she::System* g_instance = nullptr;
|
||||
|
||||
namespace she {
|
||||
|
||||
class Alleg4EventQueue : public EventQueue {
|
||||
@ -129,15 +127,11 @@ public:
|
||||
#ifdef USE_MOUSE_POLLER
|
||||
mouse_poller_init();
|
||||
#endif
|
||||
|
||||
g_instance = this;
|
||||
}
|
||||
|
||||
~Alleg4System() {
|
||||
remove_timer();
|
||||
allegro_exit();
|
||||
|
||||
g_instance = nullptr;
|
||||
}
|
||||
|
||||
void dispose() override {
|
||||
@ -216,15 +210,11 @@ System* create_system() {
|
||||
return new Alleg4System();
|
||||
}
|
||||
|
||||
System* instance()
|
||||
{
|
||||
return g_instance;
|
||||
}
|
||||
|
||||
void error_message(const char* msg)
|
||||
{
|
||||
if (g_instance && g_instance->logger())
|
||||
g_instance->logger()->logError(msg);
|
||||
System* sys = instance();
|
||||
if (sys && sys->logger())
|
||||
sys->logger()->logError(msg);
|
||||
|
||||
#ifdef _WIN32
|
||||
std::wstring wmsg = base::from_utf8(msg);
|
||||
|
@ -24,15 +24,8 @@
|
||||
|
||||
namespace she {
|
||||
|
||||
static System* g_instance;
|
||||
|
||||
System* create_system() {
|
||||
return g_instance = new SkiaSystem();
|
||||
}
|
||||
|
||||
System* instance()
|
||||
{
|
||||
return g_instance;
|
||||
return new SkiaSystem();
|
||||
}
|
||||
|
||||
void error_message(const char* msg)
|
||||
|
23
src/she/system.cpp
Normal file
23
src/she/system.cpp
Normal file
@ -0,0 +1,23 @@
|
||||
// SHE library
|
||||
// Copyright (C) 2016 David Capello
|
||||
//
|
||||
// This file is released under the terms of the MIT license.
|
||||
// Read LICENSE.txt for more information.
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "she/system.h"
|
||||
|
||||
namespace she {
|
||||
|
||||
System* instance()
|
||||
{
|
||||
static System* sys = nullptr;
|
||||
if (!sys)
|
||||
sys = create_system();
|
||||
return sys;
|
||||
}
|
||||
|
||||
} // namespace she
|
@ -1,5 +1,5 @@
|
||||
// Aseprite
|
||||
// Copyright (C) 2001-2015 David Capello
|
||||
// Copyright (C) 2001-2016 David Capello
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
// the End-User License Agreement for Aseprite.
|
||||
@ -38,7 +38,7 @@ int main(int argc, char* argv[])
|
||||
#ifdef TEST_GUI
|
||||
{
|
||||
// Do not create a she::System, as we don't need it for testing purposes.
|
||||
//she::ScopedHandle<she::System> system(she::create_system());
|
||||
//she::ScopedHandle<she::System> system(she::instance());
|
||||
ui::UISystem uiSystem;
|
||||
ui::Manager uiManager;
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user