Start building mesh primitives.
This commit is contained in:
parent
a20c0183df
commit
fcd90b5db4
30 changed files with 856 additions and 97 deletions
|
@ -7,6 +7,8 @@ list(APPEND client_HEADERS
|
|||
audio_editor/AudioEditorView.h
|
||||
image_editor/ImageEditorView.h
|
||||
image_editor/ImageViewWidget.h
|
||||
canvas/CanvasView.h
|
||||
canvas/CanvasController.h
|
||||
web_client/WebClientView.h)
|
||||
|
||||
|
||||
|
@ -18,6 +20,8 @@ list(APPEND client_LIB_INCLUDES
|
|||
audio_editor/AudioEditorView.cpp
|
||||
image_editor/ImageEditorView.cpp
|
||||
image_editor/ImageViewWidget.cpp
|
||||
canvas/CanvasView.cpp
|
||||
canvas/CanvasController.cpp
|
||||
web_client/WebClientView.cpp
|
||||
MediaTool.cpp)
|
||||
|
||||
|
@ -37,6 +41,7 @@ target_include_directories(sample_gui PUBLIC
|
|||
"${CMAKE_CURRENT_SOURCE_DIR}/audio_editor"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/image_editor"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/web_client"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/canvas"
|
||||
)
|
||||
target_link_libraries(sample_gui PUBLIC client windows console core network database geometry audio web)
|
||||
set_property(TARGET sample_gui PROPERTY FOLDER apps)
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
#include "AudioEditorView.h"
|
||||
#include "ImageEditorView.h"
|
||||
#include "WebClientView.h"
|
||||
#include "CanvasView.h"
|
||||
|
||||
#include "TabbedPanelWidget.h"
|
||||
#include "TopBar.h"
|
||||
#include "TextNode.h"
|
||||
|
@ -31,9 +33,9 @@ void MediaTool::initializeViews()
|
|||
auto path = mMainApplication->getCommandLineArgs()->getLaunchPath();
|
||||
path /= "out.txt";
|
||||
textEditor->setName("TextEditor");
|
||||
textEditor->GetController()->SetSavePath(path);
|
||||
textEditor->GetController()->SetLoadPath(path);
|
||||
textEditor->Initialize();
|
||||
textEditor->getController()->SetSavePath(path);
|
||||
textEditor->getController()->SetLoadPath(path);
|
||||
textEditor->initialize();
|
||||
tabbedPanel->addPanel(std::move(textEditor), "Text Editor");
|
||||
|
||||
auto audioEditor = AudioEditorView::Create();
|
||||
|
@ -48,6 +50,10 @@ void MediaTool::initializeViews()
|
|||
webClient->setName("webClient");
|
||||
tabbedPanel->addPanel(std::move(webClient), "Web Client");
|
||||
|
||||
auto canvas = CanvasView::Create();
|
||||
canvas->setName("CanvasView");
|
||||
tabbedPanel->addPanel(std::move(canvas), "Canvas");
|
||||
|
||||
auto topBar = TopBar::Create();
|
||||
auto statusBar = StatusBar::Create();
|
||||
|
||||
|
|
6
apps/sample-gui/canvas/CanvasController.cpp
Normal file
6
apps/sample-gui/canvas/CanvasController.cpp
Normal file
|
@ -0,0 +1,6 @@
|
|||
#include "CanvasController.h"
|
||||
|
||||
std::unique_ptr<CanvasController> CanvasController::Create()
|
||||
{
|
||||
return std::make_unique<CanvasController>();
|
||||
}
|
9
apps/sample-gui/canvas/CanvasController.h
Normal file
9
apps/sample-gui/canvas/CanvasController.h
Normal file
|
@ -0,0 +1,9 @@
|
|||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
|
||||
class CanvasController
|
||||
{
|
||||
public:
|
||||
static std::unique_ptr<CanvasController> Create();
|
||||
};
|
75
apps/sample-gui/canvas/CanvasView.cpp
Normal file
75
apps/sample-gui/canvas/CanvasView.cpp
Normal file
|
@ -0,0 +1,75 @@
|
|||
#include "CanvasView.h"
|
||||
|
||||
#include "HorizontalSpacer.h"
|
||||
#include "VerticalSpacer.h"
|
||||
|
||||
#include "CanvasController.h"
|
||||
|
||||
#include "Theme.h"
|
||||
|
||||
#include "TextNode.h"
|
||||
#include "Label.h"
|
||||
#include "Button.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
CanvasView::CanvasView()
|
||||
: mController(CanvasController::Create())
|
||||
{
|
||||
initialize();
|
||||
}
|
||||
|
||||
CanvasView::~CanvasView()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
std::unique_ptr<CanvasView> CanvasView::Create()
|
||||
{
|
||||
return std::make_unique<CanvasView>();
|
||||
}
|
||||
|
||||
void CanvasView::initialize()
|
||||
{
|
||||
auto label = Label::Create();
|
||||
label->setLabel("Canvas");
|
||||
label->setBackgroundColor(Theme::getBannerBackground());
|
||||
label->setMargin(1);
|
||||
|
||||
|
||||
|
||||
auto hSpacer = HorizontalSpacer::Create();
|
||||
hSpacer->addWidgetWithScale(std::move(label), 1);
|
||||
//hSpacer->addWidgetWithScale(std::move(textBox), 14);
|
||||
|
||||
auto cache_button_spacer = initializeCacheButtons();
|
||||
hSpacer->addWidgetWithScale(std::move(cache_button_spacer), 1);
|
||||
|
||||
addWidget(std::move(hSpacer));
|
||||
}
|
||||
|
||||
std::unique_ptr<Widget> CanvasView::initializeCacheButtons()
|
||||
{
|
||||
auto saveButton = Button::Create();
|
||||
saveButton->setLabel("Save");
|
||||
saveButton->setBackgroundColor(Theme::getButtonPrimaryBackground());
|
||||
saveButton->setMargin(2);
|
||||
|
||||
auto clearButton = Button::Create();
|
||||
clearButton->setLabel("Clear");
|
||||
clearButton->setBackgroundColor(Theme::getButtonPrimaryBackground());
|
||||
clearButton->setMargin(2);
|
||||
|
||||
auto loadButton = Button::Create();
|
||||
loadButton->setLabel("Load");
|
||||
loadButton->setBackgroundColor(Theme::getButtonPrimaryBackground());
|
||||
loadButton->setMargin(2);
|
||||
|
||||
auto buttonSpacer = VerticalSpacer::Create();
|
||||
buttonSpacer->AddWidgetWithScale(std::move(saveButton), 1);
|
||||
buttonSpacer->AddWidgetWithScale(std::move(clearButton), 1);
|
||||
buttonSpacer->AddWidgetWithScale(std::move(loadButton), 1);
|
||||
|
||||
return buttonSpacer;
|
||||
}
|
||||
|
26
apps/sample-gui/canvas/CanvasView.h
Normal file
26
apps/sample-gui/canvas/CanvasView.h
Normal file
|
@ -0,0 +1,26 @@
|
|||
#pragma once
|
||||
|
||||
#include "Widget.h"
|
||||
|
||||
class CanvasController;
|
||||
|
||||
class CanvasView : public Widget
|
||||
{
|
||||
public:
|
||||
CanvasView();
|
||||
|
||||
~CanvasView();
|
||||
|
||||
static std::unique_ptr<CanvasView> Create();
|
||||
|
||||
private:
|
||||
|
||||
void initialize();
|
||||
|
||||
std::unique_ptr<Widget> initializeCacheButtons();
|
||||
|
||||
//std::unique_ptr<Widget> initializeCacheButtons();
|
||||
|
||||
std::unique_ptr<CanvasController> mController;
|
||||
};
|
||||
using CanvasViewPtr = std::unique_ptr<CanvasView>;
|
|
@ -5,10 +5,6 @@
|
|||
|
||||
class TextEditorController
|
||||
{
|
||||
TextEditorModelUPtr mModel;
|
||||
std::filesystem::path mSavePath;
|
||||
std::filesystem::path mLoadPath;
|
||||
|
||||
public:
|
||||
|
||||
TextEditorController();
|
||||
|
@ -28,6 +24,11 @@ public:
|
|||
void SetSavePath(const std::filesystem::path& path);
|
||||
|
||||
void SetLoadPath(const std::filesystem::path& path);
|
||||
|
||||
private:
|
||||
TextEditorModelUPtr mModel;
|
||||
std::filesystem::path mSavePath;
|
||||
std::filesystem::path mLoadPath;
|
||||
};
|
||||
|
||||
using TextEditorControllerUPtr = std::unique_ptr<TextEditorController>;
|
||||
|
|
|
@ -16,12 +16,12 @@ TextEditorView::TextEditorView()
|
|||
|
||||
}
|
||||
|
||||
TextEditorController* TextEditorView::GetController()
|
||||
TextEditorController* TextEditorView::getController()
|
||||
{
|
||||
return mController.get();
|
||||
}
|
||||
|
||||
void TextEditorView::Initialize()
|
||||
void TextEditorView::initialize()
|
||||
{
|
||||
auto label = Label::Create();
|
||||
label->setLabel("Text Editor");
|
||||
|
|
|
@ -5,21 +5,23 @@
|
|||
#include "Label.h"
|
||||
#include "TextBox.h"
|
||||
#include "TextEditorController.h"
|
||||
|
||||
#include <functional>
|
||||
|
||||
class TextEditorView : public Widget
|
||||
{
|
||||
TextBox* mTextBox;
|
||||
TextEditorControllerUPtr mController;
|
||||
|
||||
public:
|
||||
|
||||
TextEditorView();
|
||||
|
||||
static std::unique_ptr<TextEditorView> Create();
|
||||
|
||||
TextEditorController* GetController();
|
||||
TextEditorController* getController();
|
||||
|
||||
void Initialize();
|
||||
void initialize();
|
||||
|
||||
private:
|
||||
TextBox* mTextBox;
|
||||
TextEditorControllerUPtr mController;
|
||||
};
|
||||
using TextEditorViewUPtr = std::unique_ptr<TextEditorView>;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue