97 lines
1.8 KiB
C++
97 lines
1.8 KiB
C++
|
#include "MainLvl.h"
|
||
|
|
||
|
#include <lwe/systems/GuiSystem.h>
|
||
|
#include <lwe/gpu/GpuFontAtlas.h>
|
||
|
#include <lwe/gui/ButtonGui.h>
|
||
|
#include <lwe/gui/TextFieldGui.h>
|
||
|
#include <lwe/gui/LabelGui.h>
|
||
|
|
||
|
MainLvl::~MainLvl()
|
||
|
{
|
||
|
}
|
||
|
|
||
|
MainLvl::MainLvl()
|
||
|
: Level("Main")
|
||
|
{
|
||
|
}
|
||
|
|
||
|
MainLvl::MainLvl(MainLvl &&lvl) noexcept
|
||
|
: Level((Level &&) lvl)
|
||
|
{
|
||
|
}
|
||
|
|
||
|
MainLvl::MainLvl(const MainLvl &lvl)
|
||
|
: Level(lvl)
|
||
|
{
|
||
|
}
|
||
|
|
||
|
MainLvl &MainLvl::operator=(MainLvl &&lvl) noexcept
|
||
|
{
|
||
|
if (this == &lvl)
|
||
|
return *this;
|
||
|
|
||
|
Level::operator=((Level &&) lvl);
|
||
|
|
||
|
return *this;
|
||
|
}
|
||
|
|
||
|
MainLvl &MainLvl::operator=(const MainLvl &lvl)
|
||
|
{
|
||
|
if (this == &lvl)
|
||
|
return *this;
|
||
|
|
||
|
Level::operator=(lvl);
|
||
|
|
||
|
return *this;
|
||
|
}
|
||
|
|
||
|
void MainLvl::SetupResources(lwe::GpuInterface *inf)
|
||
|
{
|
||
|
Level::SetupResources(inf);
|
||
|
|
||
|
//Your resource setup code here.
|
||
|
}
|
||
|
|
||
|
void MainLvl::Setup(lwe::GpuInterface *inf)
|
||
|
{
|
||
|
Level::Setup(inf);
|
||
|
|
||
|
//Your setup code here.
|
||
|
|
||
|
lwe::GuiSystem *guiSys = new lwe::GuiSystem();
|
||
|
AddSystem(guiSys);
|
||
|
|
||
|
//Add Resources
|
||
|
lwe::GpuFontAtlas *arial_24 = new lwe::GpuFontAtlas("resources/fonts/Arial_24.ehf", inf);
|
||
|
guiSys->AddResource(arial_24);
|
||
|
|
||
|
//Add Gui
|
||
|
lwe::LabelGui *dirLabel = new lwe::LabelGui("DirLabel", "Arial_24", "Directory:");
|
||
|
guiSys->AddGui(dirLabel);
|
||
|
|
||
|
lwe::TextFieldGui *dirField = new lwe::TextFieldGui("DirField", "Test");
|
||
|
dirField->SetPosition({arial_24->CalculateWidth(dirLabel->GetText()), 0.0f, 0.0f});
|
||
|
dirField->SetScale({200.0f, (float)arial_24->GetGlyphScale() + 10.0f});
|
||
|
guiSys->AddGui(dirField);
|
||
|
}
|
||
|
|
||
|
void MainLvl::PostInitialize(lwe::GpuCmdBuffer *cmdBuffer)
|
||
|
{
|
||
|
Level::PostInitialize(cmdBuffer);
|
||
|
|
||
|
//Your post-initialize code here.
|
||
|
}
|
||
|
|
||
|
void MainLvl::OnUpdate(lwe::RenderWindow *win, ehs::Input *input, const float delta)
|
||
|
{
|
||
|
Level::OnUpdate(win, input, delta);
|
||
|
|
||
|
//Your on-update code here.
|
||
|
}
|
||
|
|
||
|
void MainLvl::PreRender(lwe::GpuCmdBuffer *cmdBuffer)
|
||
|
{
|
||
|
Level::PreRender(cmdBuffer);
|
||
|
|
||
|
//Your pre-render code here.
|
||
|
}
|