#ifndef URDE_VIEW_MANAGER_HPP #define URDE_VIEW_MANAGER_HPP #include "hecl/CVarManager.hpp" #include "boo/audiodev/IAudioVoiceAllocator.hpp" #include "boo/audiodev/AudioMatrix.hpp" #include "ProjectManager.hpp" #include "Space.hpp" #include "Runtime/Particle/CElementGen.hpp" #include "Runtime/Graphics/CLineRenderer.hpp" #include "Runtime/Graphics/CMoviePlayer.hpp" namespace urde { class SplashScreen; class ViewManager : public specter::IViewManager { friend class ProjectManager; friend class Space; friend class RootSpace; friend class SplitSpace; 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; specter::Translator m_translator; std::unique_ptr m_mainWindow; 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; public: ParticleView(ViewManager& vm, specter::ViewResources& res, specter::View& parent) : View(res, parent), m_vm(vm) {commitResources(res);} void resized(const boo::SWindowRect& root, const boo::SWindowRect& sub); void draw(boo::IGraphicsCommandQueue* gfxQ); }; std::unique_ptr m_particleView; urde::TLockedToken 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_voiceAllocator; boo::AudioChannelSet m_audioSet = boo::AudioChannelSet::Unknown; std::unique_ptr m_videoVoice; boo::AudioMatrixStereo m_stereoMatrix; struct AudioVoiceCallback : boo::IAudioVoiceCallback { ViewManager& m_vm; std::vector m_stereoBuf; void needsNextBuffer(boo::IAudioVoice& voice, size_t frames) { m_stereoBuf.clear(); m_stereoBuf.resize(frames * 2); if (m_vm.m_moviePlayer) m_vm.m_moviePlayer->MixAudio(m_stereoBuf.data(), nullptr, frames); CMoviePlayer::MixStaticAudio(m_stereoBuf.data(), m_stereoBuf.data(), frames); m_vm.m_stereoMatrix.bufferStereoSampleData(voice, m_stereoBuf.data(), 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); 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); bool proc(); void stop(); }; } #endif // URDE_VIEW_MANAGER_HPP