metaforce/Editor/ViewManager.hpp

207 lines
7.3 KiB
C++
Raw Normal View History

2018-10-07 03:42:33 +00:00
#pragma once
2016-03-08 07:10:52 +00:00
#include "hecl/CVarManager.hpp"
2016-03-24 00:05:56 +00:00
#include "boo/audiodev/IAudioVoiceEngine.hpp"
2016-09-14 05:54:09 +00:00
#include "amuse/BooBackend.hpp"
2015-12-13 21:01:32 +00:00
#include "ProjectManager.hpp"
#include "Space.hpp"
2017-12-29 08:08:12 +00:00
#include "specter/IViewManager.hpp"
#include "specter/FontCache.hpp"
#include "specter/ViewResources.hpp"
2016-09-10 04:50:00 +00:00
#include "Runtime/CGameHintInfo.hpp"
2016-02-16 05:50:41 +00:00
#include "Runtime/Particle/CElementGen.hpp"
#include "Runtime/Graphics/CLineRenderer.hpp"
2016-03-07 03:12:32 +00:00
#include "Runtime/Graphics/CMoviePlayer.hpp"
2016-03-31 06:18:56 +00:00
#include "Runtime/Graphics/CModel.hpp"
2016-04-03 05:25:34 +00:00
#include "Runtime/Particle/CGenDescription.hpp"
2016-04-15 03:02:21 +00:00
#include "Runtime/Character/CAssetFactory.hpp"
2016-08-20 04:22:13 +00:00
#include "Runtime/Graphics/Shaders/CColoredQuadFilter.hpp"
#include "Runtime/Graphics/Shaders/CXRayBlurFilter.hpp"
2016-08-20 18:18:44 +00:00
#include "Runtime/Graphics/Shaders/CCameraBlurFilter.hpp"
2016-12-14 01:10:17 +00:00
#include "Runtime/Audio/CStaticAudioPlayer.hpp"
2016-02-16 05:50:41 +00:00
2018-10-07 02:59:17 +00:00
namespace hecl { class PipelineConverterBase; }
2016-03-05 00:03:41 +00:00
namespace urde
{
2015-12-13 02:27:34 +00:00
class SplashScreen;
class ViewManager final : public specter::IViewManager
{
2016-01-04 05:31:02 +00:00
friend class ProjectManager;
2016-01-11 02:17:08 +00:00
friend class Space;
friend class RootSpace;
2016-02-01 01:13:45 +00:00
friend class SplitSpace;
2016-01-04 05:31:02 +00:00
2017-07-17 03:04:14 +00:00
std::shared_ptr<boo::IWindow> m_mainWindow;
2016-03-04 23:04:53 +00:00
hecl::Runtime::FileStoreManager& m_fileStoreManager;
hecl::CVarManager& m_cvarManager;
2015-12-13 21:01:32 +00:00
ProjectManager m_projManager;
2016-03-04 23:04:53 +00:00
specter::FontCache m_fontCache;
specter::DefaultThemeData m_themeData;
specter::ViewResources m_viewResources;
specter::Translator m_translator;
2016-04-15 20:42:40 +00:00
boo::IGraphicsDataFactory* m_mainBooFactory = nullptr;
boo::IGraphicsCommandQueue* m_mainCommandQueue = nullptr;
2018-10-07 02:59:17 +00:00
std::unique_ptr<hecl::PipelineConverterBase> m_pipelineConv;
boo::ObjToken<boo::ITextureR> m_renderTex;
const boo::SystemChar* m_mainPlatformName;
2016-01-04 05:31:02 +00:00
2016-03-04 23:04:53 +00:00
std::unique_ptr<specter::RootView> m_rootView;
2015-12-13 02:27:34 +00:00
std::unique_ptr<SplashScreen> m_splash;
std::unique_ptr<RootSpace> m_rootSpace;
2016-03-04 23:04:53 +00:00
specter::View* m_rootSpaceView = nullptr;
bool m_skipWait = false;
2015-12-09 01:04:50 +00:00
2017-01-22 21:26:58 +00:00
class TestGameView : public specter::View
2016-02-16 05:50:41 +00:00
{
ViewManager& m_vm;
std::unique_ptr<specter::MultiLineTextView> m_debugText;
2016-02-16 05:50:41 +00:00
public:
TestGameView(ViewManager& vm, specter::ViewResources& res, specter::View& parent)
: View(res, parent), m_vm(vm) {}
void resized(const boo::SWindowRect& root, const boo::SWindowRect& sub);
void draw(boo::IGraphicsCommandQueue* gfxQ);
void think();
2017-01-22 21:26:58 +00:00
void mouseDown(const boo::SWindowCoord& coord, boo::EMouseButton button, boo::EModifierKey mkey)
{
if (MP1::CMain* m = m_vm.m_projManager.gameMain())
if (MP1::CGameArchitectureSupport* as = m->GetArchSupport())
as->mouseDown(coord, button, mkey);
}
void mouseUp(const boo::SWindowCoord& coord, boo::EMouseButton button, boo::EModifierKey mkey)
{
if (MP1::CMain* m = m_vm.m_projManager.gameMain())
if (MP1::CGameArchitectureSupport* as = m->GetArchSupport())
as->mouseUp(coord, button, mkey);
}
void mouseMove(const boo::SWindowCoord& coord)
{
if (MP1::CMain* m = m_vm.m_projManager.gameMain())
if (MP1::CGameArchitectureSupport* as = m->GetArchSupport())
as->mouseMove(coord);
}
void scroll(const boo::SWindowCoord& coord, const boo::SScrollDelta& sd)
{
if (MP1::CMain* m = m_vm.m_projManager.gameMain())
if (MP1::CGameArchitectureSupport* as = m->GetArchSupport())
as->scroll(coord, sd);
}
void charKeyDown(unsigned long cc, boo::EModifierKey mkey, bool repeat)
{
if (MP1::CMain* m = m_vm.m_projManager.gameMain())
if (MP1::CGameArchitectureSupport* as = m->GetArchSupport())
as->charKeyDown(cc, mkey, repeat);
}
void charKeyUp(unsigned long cc, boo::EModifierKey mkey)
{
if (MP1::CMain* m = m_vm.m_projManager.gameMain())
if (MP1::CGameArchitectureSupport* as = m->GetArchSupport())
as->charKeyUp(cc, mkey);
}
void specialKeyDown(boo::ESpecialKey skey, boo::EModifierKey mkey, bool repeat)
{
if (MP1::CMain* m = m_vm.m_projManager.gameMain())
if (MP1::CGameArchitectureSupport* as = m->GetArchSupport())
as->specialKeyDown(skey, mkey, repeat);
if (skey == boo::ESpecialKey::F1)
m_vm.m_skipWait = true;
2017-01-22 21:26:58 +00:00
}
void specialKeyUp(boo::ESpecialKey skey, boo::EModifierKey mkey)
{
if (MP1::CMain* m = m_vm.m_projManager.gameMain())
if (MP1::CGameArchitectureSupport* as = m->GetArchSupport())
as->specialKeyUp(skey, mkey);
if (skey == boo::ESpecialKey::F1)
m_vm.m_skipWait = false;
2017-01-22 21:26:58 +00:00
}
2016-02-16 05:50:41 +00:00
};
2017-01-22 21:26:58 +00:00
std::unique_ptr<TestGameView> m_testGameView;
2016-03-24 00:05:56 +00:00
std::unique_ptr<boo::IAudioVoiceEngine> m_voiceEngine;
2016-03-08 07:10:52 +00:00
std::unique_ptr<boo::IAudioVoice> m_videoVoice;
2016-09-14 05:54:09 +00:00
std::experimental::optional<amuse::BooBackendVoiceAllocator> m_amuseAllocWrapper;
2016-12-14 01:10:17 +00:00
2016-03-04 23:04:53 +00:00
hecl::SystemString m_recentProjectsPath;
std::vector<hecl::SystemString> m_recentProjects;
hecl::SystemString m_recentFilesPath;
std::vector<hecl::SystemString> m_recentFiles;
2016-01-02 02:27:46 +00:00
2015-12-09 01:04:50 +00:00
bool m_updatePf = false;
float m_reqPf;
2016-03-04 23:04:53 +00:00
specter::View* BuildSpaceViews();
specter::RootView* SetupRootView();
2016-01-05 00:01:02 +00:00
SplashScreen* SetupSplashView();
2016-03-04 23:04:53 +00:00
void RootSpaceViewBuilt(specter::View* view);
2016-03-07 03:12:32 +00:00
void ProjectChanged(hecl::Database::Project& proj);
2015-12-13 02:27:34 +00:00
void SetupEditorView();
2016-01-05 00:01:02 +00:00
void SetupEditorView(ConfigReader& r);
void SaveEditorView(ConfigWriter& w);
2015-12-13 02:27:34 +00:00
bool m_showSplash = false;
2016-01-05 00:01:02 +00:00
void DismissSplash();
unsigned m_editorFrames = 120;
void FadeInEditors() {m_editorFrames = 0;}
2016-04-15 20:42:40 +00:00
void InitMP1(MP1::CMain& main);
2016-02-16 05:50:41 +00:00
2016-01-11 02:17:08 +00:00
Space* m_deferSplit = nullptr;
2016-03-04 23:04:53 +00:00
specter::SplitView::Axis m_deferSplitAxis;
2016-01-11 02:17:08 +00:00
int m_deferSplitThisSlot;
2016-01-12 00:46:27 +00:00
boo::SWindowCoord m_deferSplitCoord;
hecl::SystemString m_deferedProject;
2017-11-12 05:14:57 +00:00
bool m_noShaderWarmup = false;
2016-01-11 02:17:08 +00:00
2016-01-04 05:31:02 +00:00
public:
2016-03-04 23:04:53 +00:00
ViewManager(hecl::Runtime::FileStoreManager& fileMgr, hecl::CVarManager& cvarMgr);
2015-12-13 02:27:34 +00:00
~ViewManager();
2016-03-04 23:04:53 +00:00
specter::RootView& rootView() const {return *m_rootView;}
2016-01-03 04:06:18 +00:00
void requestPixelFactor(float pf)
{
m_reqPf = pf;
m_updatePf = true;
}
2015-12-13 21:01:32 +00:00
ProjectManager& projectManager() {return m_projManager;}
2016-03-04 23:04:53 +00:00
hecl::Database::Project* project() {return m_projManager.project();}
const specter::Translator* getTranslator() const {return &m_translator;}
2015-12-13 21:01:32 +00:00
2016-03-04 23:04:53 +00:00
void deferSpaceSplit(specter::ISpaceController* split, specter::SplitView::Axis axis, int thisSlot,
2016-01-12 00:46:27 +00:00
const boo::SWindowCoord& coord)
2016-01-11 02:17:08 +00:00
{
m_deferSplit = static_cast<Space*>(split);
m_deferSplitAxis = axis;
m_deferSplitThisSlot = thisSlot;
2016-01-12 00:46:27 +00:00
m_deferSplitCoord = coord;
2016-01-11 02:17:08 +00:00
}
2016-03-04 23:04:53 +00:00
const std::vector<hecl::SystemString>* recentProjects() const {return &m_recentProjects;}
2017-11-13 06:19:18 +00:00
void pushRecentProject(hecl::SystemStringView path);
2016-01-02 02:27:46 +00:00
2016-03-04 23:04:53 +00:00
const std::vector<hecl::SystemString>* recentFiles() const {return &m_recentFiles;}
2017-11-13 06:19:18 +00:00
void pushRecentFile(hecl::SystemStringView path);
2016-01-02 02:27:46 +00:00
void init(boo::IApplication* app);
const boo::SystemChar* platformName() { return m_mainPlatformName; }
bool proc();
void stop();
void deferOpenProject(const hecl::SystemString& path) { m_deferedProject = path; }
};
}