2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-08 17:04:55 +00:00

Merge branch 'master' into urde-tags

This commit is contained in:
Jack Andersen
2016-03-04 14:03:41 -10:00
337 changed files with 2998 additions and 3016 deletions

View File

@@ -1,51 +1,51 @@
#ifndef URDE_SPLASH_SCREEN_HPP
#define URDE_SPLASH_SCREEN_HPP
#include <Specter/View.hpp>
#include <Specter/ModalWindow.hpp>
#include <Specter/MultiLineTextView.hpp>
#include <Specter/FileBrowser.hpp>
#include <Specter/Menu.hpp>
#include <specter/View.hpp>
#include <specter/ModalWindow.hpp>
#include <specter/MultiLineTextView.hpp>
#include <specter/FileBrowser.hpp>
#include <specter/Menu.hpp>
#include "ViewManager.hpp"
namespace URDE
namespace urde
{
static LogVisor::LogModule Log("Specter::SplashScreen");
static logvisor::Module Log("specter::SplashScreen");
class SplashScreen : public Specter::ModalWindow
class SplashScreen : public specter::ModalWindow
{
ViewManager& m_vm;
Zeus::CColor m_textColor;
Zeus::CColor m_textColorClear;
zeus::CColor m_textColor;
zeus::CColor m_textColorClear;
std::unique_ptr<Specter::TextView> m_title;
std::unique_ptr<specter::TextView> m_title;
std::string m_buildInfoStr;
std::unique_ptr<Specter::MultiLineTextView> m_buildInfo;
std::unique_ptr<specter::MultiLineTextView> m_buildInfo;
std::string m_newString;
Specter::ViewChild<std::unique_ptr<Specter::Button>> m_newButt;
specter::ViewChild<std::unique_ptr<specter::Button>> m_newButt;
std::string m_openString;
Specter::ViewChild<std::unique_ptr<Specter::Button>> m_openButt;
specter::ViewChild<std::unique_ptr<specter::Button>> m_openButt;
std::string m_extractString;
Specter::ViewChild<std::unique_ptr<Specter::Button>> m_extractButt;
specter::ViewChild<std::unique_ptr<specter::Button>> m_extractButt;
Specter::ViewChild<std::unique_ptr<Specter::FileBrowser>> m_fileBrowser;
specter::ViewChild<std::unique_ptr<specter::FileBrowser>> m_fileBrowser;
struct NewProjBinding : Specter::IButtonBinding
struct NewProjBinding : specter::IButtonBinding
{
SplashScreen& m_splash;
HECL::SystemString m_deferPath;
hecl::SystemString m_deferPath;
NewProjBinding(SplashScreen& splash) : m_splash(splash) {}
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)
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)
{
m_splash.m_fileBrowser.m_view.reset(
new Specter::FileBrowser(m_splash.rootView().viewRes(),
new specter::FileBrowser(m_splash.rootView().viewRes(),
m_splash, m_splash.m_newString,
Specter::FileBrowser::Type::NewHECLProject,
[&](bool ok, const HECL::SystemString& path)
specter::FileBrowser::Type::NewHECLProject,
[&](bool ok, const hecl::SystemString& path)
{
if (ok)
m_deferPath = path;
@@ -55,20 +55,20 @@ class SplashScreen : public Specter::ModalWindow
}
} m_newProjBind;
struct OpenProjBinding : Specter::IButtonBinding
struct OpenProjBinding : specter::IButtonBinding
{
SplashScreen& m_splash;
HECL::SystemString m_deferPath;
hecl::SystemString m_deferPath;
OpenProjBinding(SplashScreen& splash) : m_splash(splash), m_openRecentMenuRoot(*this) {}
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)
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)
{
m_splash.m_fileBrowser.m_view.reset(
new Specter::FileBrowser(m_splash.rootView().viewRes(),
new specter::FileBrowser(m_splash.rootView().viewRes(),
m_splash, m_splash.m_openString,
Specter::FileBrowser::Type::OpenHECLProject,
[&](bool ok, const HECL::SystemString& path)
specter::FileBrowser::Type::OpenHECLProject,
[&](bool ok, const hecl::SystemString& path)
{
if (ok)
m_deferPath = path;
@@ -77,7 +77,7 @@ class SplashScreen : public Specter::ModalWindow
m_splash.m_openButt.mouseLeave(coord);
}
struct OpenRecentMenuRoot : Specter::IMenuNode
struct OpenRecentMenuRoot : specter::IMenuNode
{
OpenProjBinding& m_openProjBind;
OpenRecentMenuRoot(OpenProjBinding& openProjBind) : m_openProjBind(openProjBind) {}
@@ -85,11 +85,11 @@ class SplashScreen : public Specter::ModalWindow
std::string m_text;
const std::string* text() const {return &m_text;}
struct OpenRecentMenuItem : Specter::IMenuNode
struct OpenRecentMenuItem : specter::IMenuNode
{
OpenRecentMenuRoot& m_parent;
HECL::SystemString m_path;
hecl::SystemString m_path;
std::string m_text;
const std::string* text() const {return &m_text;}
@@ -99,54 +99,54 @@ class SplashScreen : public Specter::ModalWindow
m_parent.m_openProjBind.m_splash.m_openButt.m_view->closeMenu(coord);
}
OpenRecentMenuItem(OpenRecentMenuRoot& parent, const HECL::SystemString& path)
OpenRecentMenuItem(OpenRecentMenuRoot& parent, const hecl::SystemString& path)
: m_parent(parent), m_path(path)
{
std::vector<HECL::SystemString> pathComps = Specter::FileBrowser::PathComponents(path);
std::vector<hecl::SystemString> pathComps = specter::FileBrowser::PathComponents(path);
if (pathComps.size())
m_text = HECL::SystemUTF8View(pathComps.back()).str();
m_text = hecl::SystemUTF8View(pathComps.back()).str();
}
};
std::vector<OpenRecentMenuItem> m_items;
size_t subNodeCount() const {return m_items.size();}
Specter::IMenuNode* subNode(size_t idx) {return &m_items[idx];}
specter::IMenuNode* subNode(size_t idx) {return &m_items[idx];}
void buildNodes(const std::vector<HECL::SystemString>* recentProjects)
void buildNodes(const std::vector<hecl::SystemString>* recentProjects)
{
m_items.clear();
if (recentProjects)
{
m_items.reserve(recentProjects->size());
for (const HECL::SystemString& path : *recentProjects)
for (const hecl::SystemString& path : *recentProjects)
m_items.emplace_back(*this, path);
}
}
} m_openRecentMenuRoot;
MenuStyle menuStyle(const Specter::Button* button) const {return MenuStyle::Auxiliary;}
std::unique_ptr<View> buildMenu(const Specter::Button* button)
MenuStyle menuStyle(const specter::Button* button) const {return MenuStyle::Auxiliary;}
std::unique_ptr<View> buildMenu(const specter::Button* button)
{
m_openRecentMenuRoot.buildNodes(m_splash.m_vm.recentProjects());
return std::unique_ptr<View>(new Specter::Menu(m_splash.rootView().viewRes(),
return std::unique_ptr<View>(new specter::Menu(m_splash.rootView().viewRes(),
m_splash, &m_openRecentMenuRoot));
}
} m_openProjBind;
struct ExtractProjBinding : Specter::IButtonBinding
struct ExtractProjBinding : specter::IButtonBinding
{
SplashScreen& m_splash;
HECL::SystemString m_deferPath;
hecl::SystemString m_deferPath;
ExtractProjBinding(SplashScreen& splash) : m_splash(splash) {}
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)
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)
{
m_splash.m_fileBrowser.m_view.reset(
new Specter::FileBrowser(m_splash.rootView().viewRes(),
new specter::FileBrowser(m_splash.rootView().viewRes(),
m_splash, m_splash.m_extractString,
Specter::FileBrowser::Type::OpenFile,
[&](bool ok, const HECL::SystemString& path)
specter::FileBrowser::Type::OpenFile,
[&](bool ok, const hecl::SystemString& path)
{
if (ok)
m_deferPath = path;
@@ -157,7 +157,7 @@ class SplashScreen : public Specter::ModalWindow
} m_extractProjBind;
public:
SplashScreen(ViewManager& vm, Specter::ViewResources& res);
SplashScreen(ViewManager& vm, specter::ViewResources& res);
void think();
void updateContentOpacity(float opacity);