lot of refactor, things are sort of working but not everything yet
This commit is contained in:
+10
-10
@@ -6,7 +6,7 @@
|
||||
|
||||
using namespace std;
|
||||
|
||||
wiGUI::wiGUI(GRAPHICSTHREAD threadID) :threadID(threadID), activeWidget(nullptr), focus(false), visible(true), pointerpos(XMFLOAT2(0,0))
|
||||
wiGUI::wiGUI() : activeWidget(nullptr), focus(false), visible(true), pointerpos(XMFLOAT2(0,0))
|
||||
{
|
||||
SetDirty();
|
||||
scale_local.x = (float)wiRenderer::GetDevice()->GetScreenWidth();
|
||||
@@ -64,45 +64,45 @@ void wiGUI::Update(float dt)
|
||||
}
|
||||
}
|
||||
|
||||
void wiGUI::Render() const
|
||||
void wiGUI::Render(GRAPHICSTHREAD threadID) const
|
||||
{
|
||||
if (!visible)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
wiRenderer::GetDevice()->EventBegin("GUI", GetGraphicsThread());
|
||||
wiRenderer::GetDevice()->EventBegin("GUI", threadID);
|
||||
for (auto&x : widgets)
|
||||
{
|
||||
if (x->parent == this && x != activeWidget)
|
||||
{
|
||||
// the contained child widgets will be rendered by the containers
|
||||
x->Render(this);
|
||||
x->Render(this, threadID);
|
||||
}
|
||||
}
|
||||
if (activeWidget != nullptr)
|
||||
{
|
||||
// render the active widget on top of everything
|
||||
activeWidget->Render(this);
|
||||
activeWidget->Render(this, threadID);
|
||||
}
|
||||
|
||||
for (auto&x : widgets)
|
||||
{
|
||||
x->RenderTooltip(this);
|
||||
x->RenderTooltip(this, threadID);
|
||||
}
|
||||
|
||||
ResetScissor();
|
||||
wiRenderer::GetDevice()->EventEnd(GetGraphicsThread());
|
||||
ResetScissor(threadID);
|
||||
wiRenderer::GetDevice()->EventEnd(threadID);
|
||||
}
|
||||
|
||||
void wiGUI::ResetScissor() const
|
||||
void wiGUI::ResetScissor(GRAPHICSTHREAD threadID) const
|
||||
{
|
||||
wiGraphics::Rect scissor[1];
|
||||
scissor[0].bottom = (LONG)(wiRenderer::GetDevice()->GetScreenHeight());
|
||||
scissor[0].left = (LONG)(0);
|
||||
scissor[0].right = (LONG)(wiRenderer::GetDevice()->GetScreenWidth());
|
||||
scissor[0].top = (LONG)(0);
|
||||
wiRenderer::GetDevice()->BindScissorRects(1, scissor, GetGraphicsThread());
|
||||
wiRenderer::GetDevice()->BindScissorRects(1, scissor, threadID);
|
||||
}
|
||||
|
||||
void wiGUI::AddWidget(wiWidget* widget)
|
||||
|
||||
Reference in New Issue
Block a user