#ifndef URDE_VIEW_MANAGER_HPP #define URDE_VIEW_MANAGER_HPP #include "hecl/CVarManager.hpp" #include "boo/audiodev/IAudioVoiceEngine.hpp" #include "ProjectManager.hpp" #include "Space.hpp" #include "Runtime/Particle/CElementGen.hpp" #include "Runtime/Graphics/CLineRenderer.hpp" #include "Runtime/Graphics/CMoviePlayer.hpp" #include "Runtime/Graphics/CModel.hpp" #include "Runtime/Particle/CGenDescription.hpp" #include "Runtime/Character/CAssetFactory.hpp" namespace urde { class SplashScreen; class ViewManager : public specter::IViewManager { friend class ProjectManager; friend class Space; friend class RootSpace; friend class SplitSpace; std::unique_ptr m_mainWindow; hecl::Runtime::FileStoreManager& m_fileStoreManager; hecl::CVarManager& m_cvarManager; ProjectManager m_projManager; specter::FontCache m_fontCache; specter::DefaultThemeData m_themeData; specter::ViewResources m_viewResources; boo::GraphicsDataToken m_iconsToken; boo::GraphicsDataToken m_badgeToken; specter::Translator m_translator; boo::IGraphicsDataFactory* m_mainBooFactory = nullptr; boo::IGraphicsCommandQueue* m_mainCommandQueue = nullptr; boo::ITextureR* m_renderTex = nullptr; const boo::SystemChar* m_mainPlatformName; std::unique_ptr m_rootView; std::unique_ptr m_splash; std::unique_ptr m_rootSpace; specter::View* m_rootSpaceView = nullptr; class ParticleView : public specter::View { ViewManager& m_vm; CSpaceWarpFilter m_spaceWarpFilter; CRandom16 m_random; float m_theta = 0.f; public: ParticleView(ViewManager& vm, specter::ViewResources& res, specter::View& parent) : View(res, parent), m_vm(vm), m_random(20) {} void resized(const boo::SWindowRect& root, const boo::SWindowRect& sub); void draw(boo::IGraphicsCommandQueue* gfxQ); }; std::unique_ptr m_particleView; urde::TCachedToken m_modelTest; urde::TCachedToken m_partGenDesc; std::unique_ptr m_partGen; std::unique_ptr m_lineRenderer; std::unique_ptr m_moviePlayer; std::unique_ptr m_rsfBuf; std::unique_ptr m_voiceEngine; std::unique_ptr m_videoVoice; struct AudioVoiceCallback : boo::IAudioVoiceCallback { ViewManager& m_vm; void preSupplyAudio(boo::IAudioVoice&, double) {} size_t supplyAudio(boo::IAudioVoice& voice, size_t frames, int16_t* data) { if (m_vm.m_moviePlayer) m_vm.m_moviePlayer->MixAudio(data, nullptr, frames); CMoviePlayer::MixStaticAudio(data, data, frames); return frames; } AudioVoiceCallback(ViewManager& vm) : m_vm(vm) {} } m_voiceCallback; hecl::SystemString m_recentProjectsPath; std::vector m_recentProjects; hecl::SystemString m_recentFilesPath; std::vector 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 BuildTestPART(urde::IObjectStore& objStore); void InitMP1(MP1::CMain& main); Space* m_deferSplit = nullptr; specter::SplitView::Axis m_deferSplitAxis; int m_deferSplitThisSlot; boo::SWindowCoord m_deferSplitCoord; 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();} const specter::Translator* getTranslator() const {return &m_translator;} void deferSpaceSplit(specter::ISpaceController* split, specter::SplitView::Axis axis, int thisSlot, const boo::SWindowCoord& coord) { m_deferSplit = static_cast(split); m_deferSplitAxis = axis; m_deferSplitThisSlot = thisSlot; m_deferSplitCoord = coord; } const std::vector* recentProjects() const {return &m_recentProjects;} void pushRecentProject(const hecl::SystemString& path); const std::vector* recentFiles() const {return &m_recentFiles;} void pushRecentFile(const hecl::SystemString& path); void init(boo::IApplication* app); const boo::SystemChar* platformName() { return m_mainPlatformName; } bool proc(); void stop(); }; } #endif // URDE_VIEW_MANAGER_HPP