2018-10-07 03:42:33 +00:00
|
|
|
#pragma once
|
2015-12-06 01:27:02 +00:00
|
|
|
|
2016-03-08 07:10:52 +00:00
|
|
|
#include "hecl/CVarManager.hpp"
|
2020-04-14 19:20:51 +00:00
|
|
|
#include "hecl/CVarCommons.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"
|
2015-12-11 02:37:54 +00:00
|
|
|
#include "Space.hpp"
|
2017-12-29 08:08:12 +00:00
|
|
|
#include "specter/IViewManager.hpp"
|
|
|
|
#include "specter/FontCache.hpp"
|
|
|
|
#include "specter/ViewResources.hpp"
|
2015-12-06 01:27:02 +00:00
|
|
|
|
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"
|
2016-02-18 02:42:32 +00:00
|
|
|
#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-12-08 05:30:43 +00:00
|
|
|
namespace hecl {
|
|
|
|
class PipelineConverterBase;
|
|
|
|
}
|
2018-10-07 02:59:17 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
namespace urde {
|
2015-12-13 02:27:34 +00:00
|
|
|
class SplashScreen;
|
2015-12-06 01:27:02 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
class ViewManager final : public specter::IViewManager {
|
|
|
|
friend class ProjectManager;
|
|
|
|
friend class Space;
|
|
|
|
friend class RootSpace;
|
|
|
|
friend class SplitSpace;
|
|
|
|
|
|
|
|
std::shared_ptr<boo::IWindow> m_mainWindow;
|
|
|
|
hecl::Runtime::FileStoreManager& m_fileStoreManager;
|
|
|
|
hecl::CVarManager& m_cvarManager;
|
2021-03-30 20:51:18 +00:00
|
|
|
hecl::CVarCommons m_cvarCommons;
|
2018-12-08 05:30:43 +00:00
|
|
|
ProjectManager m_projManager;
|
|
|
|
specter::FontCache m_fontCache;
|
|
|
|
specter::DefaultThemeData m_themeData;
|
|
|
|
specter::ViewResources m_viewResources;
|
2019-07-20 04:27:21 +00:00
|
|
|
locale::ELocale m_locale = locale::ELocale::en_US;
|
2018-12-08 05:30:43 +00:00
|
|
|
boo::IGraphicsDataFactory* m_mainBooFactory = nullptr;
|
|
|
|
boo::IGraphicsCommandQueue* m_mainCommandQueue = nullptr;
|
|
|
|
std::unique_ptr<hecl::PipelineConverterBase> m_pipelineConv;
|
|
|
|
boo::ObjToken<boo::ITextureR> m_renderTex;
|
|
|
|
const boo::SystemChar* m_mainPlatformName;
|
|
|
|
|
|
|
|
std::unique_ptr<specter::RootView> m_rootView;
|
|
|
|
std::unique_ptr<SplashScreen> m_splash;
|
|
|
|
std::unique_ptr<RootSpace> m_rootSpace;
|
|
|
|
specter::View* m_rootSpaceView = nullptr;
|
|
|
|
bool m_skipWait = false;
|
|
|
|
|
|
|
|
class TestGameView : public specter::View {
|
|
|
|
ViewManager& m_vm;
|
|
|
|
std::unique_ptr<specter::MultiLineTextView> m_debugText;
|
2020-12-31 22:00:10 +00:00
|
|
|
const void* m_currentRoom = nullptr;
|
|
|
|
double m_lastRoomTime = 0.f;
|
|
|
|
double m_currentRoomStart = 0.f;
|
2018-12-08 05:30:43 +00:00
|
|
|
|
|
|
|
public:
|
2020-04-14 19:20:51 +00:00
|
|
|
TestGameView(ViewManager& vm, specter::ViewResources& res, specter::View& parent, hecl::CVarManager& cvarMgr)
|
2021-03-30 20:51:18 +00:00
|
|
|
: View(res, parent), m_vm(vm) {}
|
2019-08-10 07:33:30 +00:00
|
|
|
void resized(const boo::SWindowRect& root, const boo::SWindowRect& sub) override;
|
|
|
|
void draw(boo::IGraphicsCommandQueue* gfxQ) override;
|
|
|
|
void think() override;
|
2018-12-08 05:30:43 +00:00
|
|
|
|
2019-08-10 07:33:30 +00:00
|
|
|
void mouseDown(const boo::SWindowCoord& coord, boo::EMouseButton button, boo::EModifierKey mkey) override {
|
2018-12-08 05:30:43 +00:00
|
|
|
if (MP1::CMain* m = m_vm.m_projManager.gameMain())
|
|
|
|
if (MP1::CGameArchitectureSupport* as = m->GetArchSupport())
|
|
|
|
as->mouseDown(coord, button, mkey);
|
|
|
|
}
|
2016-01-11 02:17:08 +00:00
|
|
|
|
2019-08-10 07:33:30 +00:00
|
|
|
void mouseUp(const boo::SWindowCoord& coord, boo::EMouseButton button, boo::EModifierKey mkey) override {
|
2018-12-08 05:30:43 +00:00
|
|
|
if (MP1::CMain* m = m_vm.m_projManager.gameMain())
|
|
|
|
if (MP1::CGameArchitectureSupport* as = m->GetArchSupport())
|
|
|
|
as->mouseUp(coord, button, mkey);
|
2015-12-12 00:37:32 +00:00
|
|
|
}
|
|
|
|
|
2019-08-10 07:33:30 +00:00
|
|
|
void mouseMove(const boo::SWindowCoord& coord) override {
|
2018-12-08 05:30:43 +00:00
|
|
|
if (MP1::CMain* m = m_vm.m_projManager.gameMain())
|
|
|
|
if (MP1::CGameArchitectureSupport* as = m->GetArchSupport())
|
|
|
|
as->mouseMove(coord);
|
2016-01-11 02:17:08 +00:00
|
|
|
}
|
|
|
|
|
2019-08-10 07:33:30 +00:00
|
|
|
void scroll(const boo::SWindowCoord& coord, const boo::SScrollDelta& sd) override {
|
2018-12-08 05:30:43 +00:00
|
|
|
if (MP1::CMain* m = m_vm.m_projManager.gameMain())
|
|
|
|
if (MP1::CGameArchitectureSupport* as = m->GetArchSupport())
|
|
|
|
as->scroll(coord, sd);
|
|
|
|
}
|
2016-01-02 02:27:46 +00:00
|
|
|
|
2019-08-10 07:33:30 +00:00
|
|
|
void charKeyDown(unsigned long cc, boo::EModifierKey mkey, bool repeat) override {
|
2018-12-08 05:30:43 +00:00
|
|
|
if (MP1::CMain* m = m_vm.m_projManager.gameMain())
|
|
|
|
if (MP1::CGameArchitectureSupport* as = m->GetArchSupport())
|
|
|
|
as->charKeyDown(cc, mkey, repeat);
|
|
|
|
}
|
2016-01-02 02:27:46 +00:00
|
|
|
|
2019-08-10 07:33:30 +00:00
|
|
|
void charKeyUp(unsigned long cc, boo::EModifierKey mkey) override {
|
2018-12-08 05:30:43 +00:00
|
|
|
if (MP1::CMain* m = m_vm.m_projManager.gameMain())
|
|
|
|
if (MP1::CGameArchitectureSupport* as = m->GetArchSupport())
|
|
|
|
as->charKeyUp(cc, mkey);
|
|
|
|
}
|
2017-01-23 10:13:36 +00:00
|
|
|
|
2019-08-10 07:33:30 +00:00
|
|
|
void specialKeyDown(boo::ESpecialKey skey, boo::EModifierKey mkey, bool repeat) override {
|
2018-12-08 05:30:43 +00:00
|
|
|
if (MP1::CMain* m = m_vm.m_projManager.gameMain())
|
|
|
|
if (MP1::CGameArchitectureSupport* as = m->GetArchSupport())
|
|
|
|
as->specialKeyDown(skey, mkey, repeat);
|
2015-12-06 01:27:02 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
if (skey == boo::ESpecialKey::F1)
|
|
|
|
m_vm.m_skipWait = true;
|
|
|
|
}
|
|
|
|
|
2019-08-10 07:33:30 +00:00
|
|
|
void specialKeyUp(boo::ESpecialKey skey, boo::EModifierKey mkey) override {
|
2018-12-08 05:30:43 +00:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
std::unique_ptr<TestGameView> m_testGameView;
|
|
|
|
std::unique_ptr<boo::IAudioVoiceEngine> m_voiceEngine;
|
2019-06-12 02:05:17 +00:00
|
|
|
std::optional<amuse::BooBackendVoiceAllocator> m_amuseAllocWrapper;
|
2018-12-08 05:30:43 +00:00
|
|
|
|
|
|
|
hecl::SystemString m_recentProjectsPath;
|
|
|
|
std::vector<hecl::SystemString> m_recentProjects;
|
|
|
|
hecl::SystemString m_recentFilesPath;
|
|
|
|
std::vector<hecl::SystemString> m_recentFiles;
|
|
|
|
|
|
|
|
bool m_updatePf = false;
|
|
|
|
float m_reqPf;
|
|
|
|
|
|
|
|
specter::View* BuildSpaceViews();
|
|
|
|
specter::RootView* SetupRootView();
|
|
|
|
SplashScreen* SetupSplashView();
|
|
|
|
void RootSpaceViewBuilt(specter::View* view);
|
|
|
|
void ProjectChanged(hecl::Database::Project& proj);
|
|
|
|
void SetupEditorView();
|
|
|
|
void SetupEditorView(ConfigReader& r);
|
|
|
|
void SaveEditorView(ConfigWriter& w);
|
|
|
|
|
|
|
|
bool m_showSplash = false;
|
|
|
|
void DismissSplash();
|
|
|
|
|
|
|
|
unsigned m_editorFrames = 120;
|
|
|
|
void FadeInEditors() { m_editorFrames = 0; }
|
|
|
|
|
|
|
|
void InitMP1(MP1::CMain& main);
|
|
|
|
|
|
|
|
Space* m_deferSplit = nullptr;
|
|
|
|
specter::SplitView::Axis m_deferSplitAxis;
|
|
|
|
int m_deferSplitThisSlot;
|
|
|
|
boo::SWindowCoord m_deferSplitCoord;
|
|
|
|
hecl::SystemString m_deferedProject;
|
|
|
|
bool m_noShaderWarmup = false;
|
|
|
|
|
|
|
|
public:
|
|
|
|
ViewManager(hecl::Runtime::FileStoreManager& fileMgr, hecl::CVarManager& cvarMgr);
|
|
|
|
~ViewManager();
|
|
|
|
|
|
|
|
specter::RootView& rootView() const { return *m_rootView; }
|
|
|
|
void requestPixelFactor(float pf) {
|
|
|
|
m_reqPf = pf;
|
|
|
|
m_updatePf = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
ProjectManager& projectManager() { return m_projManager; }
|
|
|
|
hecl::Database::Project* project() { return m_projManager.project(); }
|
2019-08-10 07:33:30 +00:00
|
|
|
locale::ELocale getTranslatorLocale() const override { return m_locale; }
|
2018-12-08 05:30:43 +00:00
|
|
|
|
|
|
|
void deferSpaceSplit(specter::ISpaceController* split, specter::SplitView::Axis axis, int thisSlot,
|
2019-08-10 07:33:30 +00:00
|
|
|
const boo::SWindowCoord& coord) override {
|
2018-12-08 05:30:43 +00:00
|
|
|
m_deferSplit = static_cast<Space*>(split);
|
|
|
|
m_deferSplitAxis = axis;
|
|
|
|
m_deferSplitThisSlot = thisSlot;
|
|
|
|
m_deferSplitCoord = coord;
|
|
|
|
}
|
|
|
|
|
2019-08-10 07:33:30 +00:00
|
|
|
const std::vector<hecl::SystemString>* recentProjects() const override { return &m_recentProjects; }
|
|
|
|
void pushRecentProject(hecl::SystemStringView path) override;
|
2018-12-08 05:30:43 +00:00
|
|
|
|
2019-08-10 07:33:30 +00:00
|
|
|
const std::vector<hecl::SystemString>* recentFiles() const override { return &m_recentFiles; }
|
|
|
|
void pushRecentFile(hecl::SystemStringView path) override;
|
2018-12-08 05:30:43 +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; }
|
|
|
|
};
|
2015-12-06 01:27:02 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
} // namespace urde
|