metaforce/Editor/SplashScreen.hpp

128 lines
5.2 KiB
C++
Raw Normal View History

2016-01-05 01:53:16 -08:00
#ifndef URDE_SPLASH_SCREEN_HPP
#define URDE_SPLASH_SCREEN_HPP
2015-12-12 18:27:34 -08:00
#include <Specter/View.hpp>
2015-12-15 13:56:40 -08:00
#include <Specter/ModalWindow.hpp>
2015-12-12 18:27:34 -08:00
#include <Specter/MultiLineTextView.hpp>
2015-12-15 13:56:40 -08:00
#include <Specter/FileBrowser.hpp>
2015-12-12 18:27:34 -08:00
#include "ViewManager.hpp"
2016-01-05 01:53:16 -08:00
namespace URDE
2015-12-12 18:27:34 -08:00
{
2016-01-01 18:27:46 -08:00
static LogVisor::LogModule Log("Specter::SplashScreen");
2015-12-15 13:56:40 -08:00
class SplashScreen : public Specter::ModalWindow
2015-12-12 18:27:34 -08:00
{
ViewManager& m_vm;
Zeus::CColor m_textColor;
Zeus::CColor m_textColorClear;
std::unique_ptr<Specter::TextView> m_title;
2015-12-30 19:20:52 -08:00
std::string m_buildInfoStr;
2015-12-13 13:01:32 -08:00
std::unique_ptr<Specter::MultiLineTextView> m_buildInfo;
2015-12-30 19:20:52 -08:00
std::string m_newString;
2015-12-20 14:00:07 -08:00
Specter::ViewChild<std::unique_ptr<Specter::Button>> m_newButt;
2015-12-30 19:20:52 -08:00
std::string m_openString;
2015-12-20 14:00:07 -08:00
Specter::ViewChild<std::unique_ptr<Specter::Button>> m_openButt;
2015-12-30 19:20:52 -08:00
std::string m_extractString;
2015-12-20 14:00:07 -08:00
Specter::ViewChild<std::unique_ptr<Specter::Button>> m_extractButt;
2015-12-12 18:27:34 -08:00
2015-12-20 14:00:07 -08:00
Specter::ViewChild<std::unique_ptr<Specter::FileBrowser>> m_fileBrowser;
2015-12-13 13:01:32 -08:00
struct NewProjBinding : Specter::IButtonBinding
{
2015-12-15 13:56:40 -08:00
SplashScreen& m_splash;
2016-01-07 21:54:00 -08:00
HECL::SystemString m_deferPath;
2015-12-15 13:56:40 -08:00
NewProjBinding(SplashScreen& splash) : m_splash(splash) {}
2016-01-06 16:40:27 -08:00
const char* name(const Specter::Control* control) const {return m_splash.m_newString.c_str();}
const char* help(const Specter::Control* control) const {return "Creates an empty project at selected path";}
void activated(const Specter::Button* button, const boo::SWindowCoord& coord)
2015-12-13 13:01:32 -08:00
{
2015-12-30 14:05:17 -08:00
m_splash.m_fileBrowser.m_view.reset(
new Specter::FileBrowser(m_splash.rootView().viewRes(),
2015-12-30 19:20:52 -08:00
m_splash, m_splash.m_newString,
Specter::FileBrowser::Type::NewHECLProject,
2016-01-03 21:31:02 -08:00
[&](bool ok, const HECL::SystemString& path)
2016-01-01 18:27:46 -08:00
{
2016-01-02 20:06:18 -08:00
if (ok)
2016-01-07 21:54:00 -08:00
m_deferPath = path;
2016-01-01 18:27:46 -08:00
}));
2015-12-15 13:56:40 -08:00
m_splash.updateSize();
m_splash.m_newButt.mouseLeave(coord);
2015-12-13 13:01:32 -08:00
}
} m_newProjBind;
struct OpenProjBinding : Specter::IButtonBinding
{
2015-12-15 13:56:40 -08:00
SplashScreen& m_splash;
2016-01-07 21:54:00 -08:00
HECL::SystemString m_deferPath;
2015-12-15 13:56:40 -08:00
OpenProjBinding(SplashScreen& splash) : m_splash(splash) {}
2016-01-06 16:40:27 -08:00
const char* name(const Specter::Control* control) const {return m_splash.m_openString.c_str();}
const char* help(const Specter::Control* control) const {return "Opens an existing project at selected path";}
void activated(const Specter::Button* button, const boo::SWindowCoord& coord)
2015-12-13 13:01:32 -08:00
{
2015-12-30 14:05:17 -08:00
m_splash.m_fileBrowser.m_view.reset(
new Specter::FileBrowser(m_splash.rootView().viewRes(),
2015-12-30 19:20:52 -08:00
m_splash, m_splash.m_openString,
2016-01-01 18:27:46 -08:00
Specter::FileBrowser::Type::OpenHECLProject,
2016-01-03 21:31:02 -08:00
[&](bool ok, const HECL::SystemString& path)
2016-01-01 18:27:46 -08:00
{
2016-01-02 20:06:18 -08:00
if (ok)
2016-01-07 21:54:00 -08:00
m_deferPath = path;
2016-01-01 18:27:46 -08:00
}));
2015-12-15 13:56:40 -08:00
m_splash.updateSize();
m_splash.m_openButt.mouseLeave(coord);
2015-12-13 13:01:32 -08:00
}
} m_openProjBind;
struct ExtractProjBinding : Specter::IButtonBinding
{
2015-12-15 13:56:40 -08:00
SplashScreen& m_splash;
2016-01-07 21:54:00 -08:00
HECL::SystemString m_deferPath;
2015-12-15 13:56:40 -08:00
ExtractProjBinding(SplashScreen& splash) : m_splash(splash) {}
2016-01-06 16:40:27 -08:00
const char* name(const Specter::Control* control) const {return m_splash.m_extractString.c_str();}
const char* help(const Specter::Control* control) const {return "Extracts game image as project at selected path";}
void activated(const Specter::Button* button, const boo::SWindowCoord& coord)
2015-12-13 13:01:32 -08:00
{
2015-12-30 14:05:17 -08:00
m_splash.m_fileBrowser.m_view.reset(
new Specter::FileBrowser(m_splash.rootView().viewRes(),
2015-12-30 19:20:52 -08:00
m_splash, m_splash.m_extractString,
2016-01-01 18:27:46 -08:00
Specter::FileBrowser::Type::OpenFile,
2016-01-03 21:31:02 -08:00
[&](bool ok, const HECL::SystemString& path)
2016-01-01 18:27:46 -08:00
{
2016-01-02 20:06:18 -08:00
if (ok)
2016-01-07 21:54:00 -08:00
m_deferPath = path;
2016-01-01 18:27:46 -08:00
}));
2015-12-15 13:56:40 -08:00
m_splash.updateSize();
m_splash.m_extractButt.mouseLeave(coord);
2015-12-13 13:01:32 -08:00
}
} m_extractProjBind;
2015-12-12 18:27:34 -08:00
public:
SplashScreen(ViewManager& vm, Specter::ViewResources& res);
void think();
2015-12-15 13:56:40 -08:00
void updateContentOpacity(float opacity);
2015-12-12 18:27:34 -08:00
2015-12-13 13:01:32 -08:00
void mouseDown(const boo::SWindowCoord&, boo::EMouseButton, boo::EModifierKey);
void mouseUp(const boo::SWindowCoord&, boo::EMouseButton, boo::EModifierKey);
void mouseMove(const boo::SWindowCoord&);
void mouseEnter(const boo::SWindowCoord&);
void mouseLeave(const boo::SWindowCoord&);
2015-12-20 11:20:07 -08:00
void scroll(const boo::SWindowCoord&, const boo::SScrollDelta&);
void touchDown(const boo::STouchCoord&, uintptr_t);
void touchUp(const boo::STouchCoord&, uintptr_t);
void touchMove(const boo::STouchCoord&, uintptr_t);
void charKeyDown(unsigned long, boo::EModifierKey, bool);
2016-01-01 18:27:46 -08:00
void specialKeyDown(boo::ESpecialKey, boo::EModifierKey, bool);
2015-12-20 11:20:07 -08:00
2015-12-12 18:27:34 -08:00
void resized(const boo::SWindowRect& root, const boo::SWindowRect& sub);
void draw(boo::IGraphicsCommandQueue* gfxQ);
};
}
2016-01-05 01:53:16 -08:00
#endif // URDE_SPLASH_SCREEN_HPP