-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SUTK] Added HPaneTest (HPANE) and enabled C++20 in SGE
- Loading branch information
Showing
7 changed files
with
155 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#pragma once | ||
|
||
#include <sutk/Container.hpp> | ||
#include <sutk/InputEventHandlerObject.hpp> | ||
|
||
namespace SUTK | ||
{ | ||
class RenderRectFill; | ||
|
||
class HPaneContainer : public Container, | ||
public MouseClickHandlerObject, | ||
public MouseMoveHandlerObject | ||
{ | ||
private: | ||
bool m_isGrabbed; | ||
std::vector<RenderRectFill*> m_handleRects; | ||
std::vector<Container*> m_externalChilds; | ||
protected: | ||
virtual void onMouseClick(MouseButton button, KeyEvent action) override; | ||
virtual void onMouseMove(Vec2Df position) override; | ||
|
||
virtual void onAddChild(Container* child) override; | ||
virtual void onRemoveChild(Container* child) override; | ||
public: | ||
HPaneContainer(UIDriver& driver, Container* parent = NULL) noexcept; | ||
virtual ~HPaneContainer() noexcept = default; | ||
|
||
std::vector<Container*>& getExternChilds() noexcept { return m_externalChilds; } | ||
const std::vector<Container*>& getExternChilds() const noexcept { return m_externalChilds; } | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#pragma once | ||
|
||
#include <sutk/ITest.hpp> | ||
|
||
#include <sge-cpp/sge.hpp> | ||
|
||
#include <sutk/UIDriver.hpp> | ||
|
||
namespace SUTK | ||
{ | ||
class IGfxDriver; | ||
|
||
class HPaneContainer; | ||
|
||
class HPaneTest : public ITest | ||
{ | ||
private: | ||
UIDriver* m_uiDriver; | ||
IGfxDriver* m_gfxDriver; | ||
HPaneContainer* m_hPaneContainer; | ||
|
||
public: | ||
HPaneTest() : m_uiDriver(NULL), m_gfxDriver(NULL) { } | ||
|
||
DriverInitializationData getInitializationData() override; | ||
|
||
void initialize(SGE::Driver& driver) override; | ||
|
||
void terminate(SGE::Driver& driver) override; | ||
|
||
void render(SGE::Driver& driver) override; | ||
|
||
void update(SGE::Driver& driver, float deltaTime) override; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#include <sutk/HPaneContainer.hpp> | ||
#include <sutk/RenderRectFill.hpp> | ||
|
||
#define HANDLE_HIGHLIGHT_COLOR Color4::grey(0.5f) | ||
|
||
namespace SUTK | ||
{ | ||
HPaneContainer::HPaneContainer(UIDriver& driver, Container* parent) noexcept : Container(driver, parent), | ||
MouseClickHandlerObject(driver, this), | ||
MouseMoveHandlerObject(driver, this) | ||
{ | ||
} | ||
|
||
void HPaneContainer::onMouseClick(MouseButton button, KeyEvent action) | ||
{ | ||
// if((m_handleRect == NULL) || (button != MouseButton::Left)) | ||
// return; | ||
|
||
// if(action == KeyEvent::Press) | ||
// { | ||
// Vec2Df pos = getInputDriver().getMousePosition(); | ||
// if(m_handleRect->containsGlobalCoords(pos)) | ||
// m_isGrabbed = true; | ||
// } | ||
// else | ||
// m_isGrabbed = false; | ||
} | ||
|
||
void HPaneContainer::onMouseMove(Vec2Df position) | ||
{ | ||
} | ||
|
||
void HPaneContainer::onAddChild(Container* child) | ||
{ | ||
m_externalChilds.push_back(child); | ||
} | ||
|
||
void HPaneContainer::onRemoveChild(Container* child) | ||
{ | ||
bool result = com::find_erase(m_externalChilds, child); | ||
_com_assert(result); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#include <sutk/tests/HPaneTest.hpp> | ||
|
||
#include <sutk/SGEGfxDriver.hpp> | ||
#include <sutk/HPaneContainer.hpp> | ||
#include <sutk/FullWindowContainer.hpp> | ||
|
||
namespace SUTK | ||
{ | ||
DriverInitializationData HPaneTest::getInitializationData() | ||
{ | ||
auto data = ITest::getInitializationData(); | ||
data.title = "Horizontal Pane Container Test"; | ||
return data; | ||
} | ||
|
||
void HPaneTest::initialize(SGE::Driver& driver) | ||
{ | ||
m_gfxDriver = new SGEGfxDriver(driver); | ||
m_uiDriver = new UIDriver(*m_gfxDriver); | ||
FullWindowContainer* rootContainer = m_uiDriver->createContainer<FullWindowContainer>(NULL); | ||
m_hPaneContainer = m_uiDriver->createContainer<HPaneContainer>(rootContainer); | ||
m_hPaneContainer->alwaysFitInParent(); | ||
m_hPaneContainer->enableDebug(); | ||
} | ||
|
||
void HPaneTest::terminate(SGE::Driver& driver) | ||
{ | ||
delete m_uiDriver; | ||
delete m_gfxDriver; | ||
} | ||
|
||
void HPaneTest::render(SGE::Driver& driver) | ||
{ | ||
// SUTK::UIDriver::render() should only be called when there is an update in the UI or screen resize | ||
m_uiDriver->render(); | ||
} | ||
|
||
void HPaneTest::update(SGE::Driver& driver, float deltaTime) | ||
{ | ||
} | ||
} |