diff --git a/Editor/CMakeLists.txt b/Editor/CMakeLists.txt index 34a7b1719..60f546f56 100644 --- a/Editor/CMakeLists.txt +++ b/Editor/CMakeLists.txt @@ -1,7 +1,15 @@ +include_directories(${CMAKE_CURRENT_SOURCE_DIR}) add_subdirectory(locale) +set(SPACE_HEADERS + ResourceOutliner/ResourceOutliner.hpp) + +set(SPACE_SOURCES + ResourceOutliner/ResourceOutliner.cpp) + add_executable(rude WIN32 - main.cpp + main.cpp ISpace.hpp + ${SPACE_HEADERS} ${SPACE_SOURCES} ViewManager.hpp ViewManager.cpp) target_link_libraries(rude diff --git a/Editor/ISpace.hpp b/Editor/ISpace.hpp new file mode 100644 index 000000000..c09ea4bd8 --- /dev/null +++ b/Editor/ISpace.hpp @@ -0,0 +1,13 @@ +#ifndef RUDE_ISPACE_HPP +#define RUDE_ISPACE_HPP + +namespace RUDE +{ + +class ISpace +{ +}; + +} + +#endif // RUDE_ISPACE_HPP diff --git a/Editor/ResourceOutliner/ResourceOutliner.cpp b/Editor/ResourceOutliner/ResourceOutliner.cpp new file mode 100644 index 000000000..3631a4503 --- /dev/null +++ b/Editor/ResourceOutliner/ResourceOutliner.cpp @@ -0,0 +1 @@ +#include "ResourceOutliner.hpp" diff --git a/Editor/ResourceOutliner/ResourceOutliner.hpp b/Editor/ResourceOutliner/ResourceOutliner.hpp new file mode 100644 index 000000000..68ff8a47d --- /dev/null +++ b/Editor/ResourceOutliner/ResourceOutliner.hpp @@ -0,0 +1,15 @@ +#ifndef RUDE_RESOURCE_OUTLINER_HPP +#define RUDE_RESOURCE_OUTLINER_HPP + +#include "ISpace.hpp" + +namespace RUDE +{ + +class ResourceOutliner : public ISpace +{ +}; + +} + +#endif // RUDE_RESOURCE_OUTLINER_HPP diff --git a/Editor/ViewManager.cpp b/Editor/ViewManager.cpp index b781616b6..ef3040895 100644 --- a/Editor/ViewManager.cpp +++ b/Editor/ViewManager.cpp @@ -4,66 +4,38 @@ namespace RUDE { -struct SetTo1 : Specter::IButtonBinding -{ - ViewManager& m_vm; - std::string m_name = "SetTo1"; - std::string m_help = "Sets scale factor to 1.0"; - SetTo1(ViewManager& vm) : m_vm(vm) {} - - const std::string& name() const {return m_name;} - const std::string& help() const {return m_help;} - void pressed(const boo::SWindowCoord& coord) - { - m_vm.RequestPixelFactor(1.0); - } -}; - -struct SetTo2 : Specter::IButtonBinding -{ - ViewManager& m_vm; - std::string m_name = "SetTo2"; - std::string m_help = "Sets scale factor to 2.0"; - SetTo2(ViewManager& vm) : m_vm(vm) {} - - const std::string& name() const {return m_name;} - const std::string& help() const {return m_help;} - void pressed(const boo::SWindowCoord& coord) - { - m_vm.RequestPixelFactor(2.0); - } -}; - void ViewManager::SetupRootView() { m_rootView.reset(new Specter::RootView(*this, m_viewResources, m_mainWindow.get())); - Specter::SplitView* splitView = new Specter::SplitView(m_viewResources, *m_rootView, Specter::SplitView::Axis::Horizontal); - m_rootView->setContentView(std::unique_ptr(splitView)); + m_splitView.reset(new Specter::SplitView(m_viewResources, *m_rootView, Specter::SplitView::Axis::Horizontal)); + m_rootView->setContentView(m_splitView.get()); - m_space1 = new Specter::Space(m_viewResources, *splitView, Specter::Toolbar::Position::Top); - m_space1->toolbar().push_back(std::make_unique(m_viewResources, m_space1->toolbar(), - std::make_unique(*this), "Hello Button")); + m_space1.reset(new Specter::Space(m_viewResources, *m_splitView, Specter::Toolbar::Position::Top)); + m_butt1.reset(new Specter::Button(m_viewResources, m_space1->toolbar(), + &m_setTo1, "Hello Button")); + m_space1->toolbar().push_back(m_butt1.get()); - m_space2 = new Specter::Space(m_viewResources, *splitView, Specter::Toolbar::Position::Bottom); - m_space2->toolbar().push_back(std::make_unique(m_viewResources, m_space2->toolbar(), - std::make_unique(*this), "こんにちはボタン")); + m_space2.reset(new Specter::Space(m_viewResources, *m_splitView, Specter::Toolbar::Position::Bottom)); + m_butt2.reset(new Specter::Button(m_viewResources, m_space2->toolbar(), + &m_setTo2, "こんにちはボタン")); + m_space2->toolbar().push_back(m_butt2.get()); - splitView->setContentView(0, std::unique_ptr(m_space1)); - splitView->setContentView(1, std::unique_ptr(m_space2)); + m_splitView->setContentView(0, m_space1.get()); + m_splitView->setContentView(1, m_space2.get()); m_rootView->setBackground(Zeus::CColor::skGrey); - Specter::MultiLineTextView* textView1 = new Specter::MultiLineTextView(m_viewResources, *m_space1, m_viewResources.m_heading18); - m_space1->setContentView(std::unique_ptr(textView1)); + m_textView1.reset(new Specter::MultiLineTextView(m_viewResources, *m_space1, m_viewResources.m_heading18)); + m_space1->setContentView(m_textView1.get()); - Specter::MultiLineTextView* textView2 = new Specter::MultiLineTextView(m_viewResources, *m_space2, m_viewResources.m_heading18); - m_space2->setContentView(std::unique_ptr(textView2)); + m_textView2.reset(new Specter::MultiLineTextView(m_viewResources, *m_space2, m_viewResources.m_heading18)); + m_space2->setContentView(m_textView2.get()); - textView1->typesetGlyphs("Hello, World!\n\n", m_viewResources.themeData().uiText()); - textView2->typesetGlyphs("こんにちは世界!\n\n", m_viewResources.themeData().uiText()); + m_textView1->typesetGlyphs("Hello, World!\n\n", m_viewResources.themeData().uiText()); + m_textView2->typesetGlyphs("こんにちは世界!\n\n", m_viewResources.themeData().uiText()); - textView1->setBackground(m_viewResources.themeData().viewportBackground()); - textView2->setBackground(m_viewResources.themeData().viewportBackground()); + m_textView1->setBackground(m_viewResources.themeData().viewportBackground()); + m_textView2->setBackground(m_viewResources.themeData().viewportBackground()); m_rootView->updateSize(); } diff --git a/Editor/ViewManager.hpp b/Editor/ViewManager.hpp index da45acf35..5692fb880 100644 --- a/Editor/ViewManager.hpp +++ b/Editor/ViewManager.hpp @@ -14,9 +14,14 @@ class ViewManager : Specter::IViewManager Specter::ViewResources m_viewResources; std::unique_ptr m_mainWindow; std::unique_ptr m_rootView; + std::unique_ptr m_splitView; - Specter::Space* m_space1; - Specter::Space* m_space2; + std::unique_ptr m_space1; + std::unique_ptr m_butt1; + std::unique_ptr m_textView1; + std::unique_ptr m_space2; + std::unique_ptr m_butt2; + std::unique_ptr m_textView2; HECL::CVar* m_cvPixelFactor; @@ -26,7 +31,7 @@ class ViewManager : Specter::IViewManager void SetupRootView(); public: ViewManager(HECL::Runtime::FileStoreManager& fileMgr, HECL::CVarManager& cvarMgr) - : m_cvarManager(cvarMgr), m_fontCache(fileMgr) {} + : m_cvarManager(cvarMgr), m_fontCache(fileMgr), m_setTo1(*this), m_setTo2(*this) {} Specter::RootView& rootView() const {return *m_rootView;} void RequestPixelFactor(float pf) @@ -38,6 +43,38 @@ public: void init(boo::IApplication* app); bool proc(); void stop(); + + struct SetTo1 : Specter::IButtonBinding + { + ViewManager& m_vm; + std::string m_name = "SetTo1"; + std::string m_help = "Sets scale factor to 1.0"; + SetTo1(ViewManager& vm) : m_vm(vm) {} + + const std::string& name() const {return m_name;} + const std::string& help() const {return m_help;} + void pressed(const boo::SWindowCoord& coord) + { + m_vm.RequestPixelFactor(1.0); + } + }; + SetTo1 m_setTo1; + + struct SetTo2 : Specter::IButtonBinding + { + ViewManager& m_vm; + std::string m_name = "SetTo2"; + std::string m_help = "Sets scale factor to 2.0"; + SetTo2(ViewManager& vm) : m_vm(vm) {} + + const std::string& name() const {return m_name;} + const std::string& help() const {return m_help;} + void pressed(const boo::SWindowCoord& coord) + { + m_vm.RequestPixelFactor(2.0); + } + }; + SetTo2 m_setTo2; }; } diff --git a/libSpecter b/libSpecter index 4d8e33e98..409855bc1 160000 --- a/libSpecter +++ b/libSpecter @@ -1 +1 @@ -Subproject commit 4d8e33e98170fa66907c829457893c800c3082dc +Subproject commit 409855bc1b8085beb0a739efdf31ee53a7a8d305