diff --git a/libstarlight/source/starlight/Application.cpp b/libstarlight/source/starlight/Application.cpp index e3758cc..c979da1 100644 --- a/libstarlight/source/starlight/Application.cpp +++ b/libstarlight/source/starlight/Application.cpp @@ -94,7 +94,7 @@ void Application::_mainLoop() { forms.sort(Form::OrderedCompare); // reconstruct ui container heirarchy - bool otouch, otop; + bool otouch = false, otop = false; formTouchScreen->RemoveAll(); formTopScreen->RemoveAll(); diff --git a/libstarlight/source/starlight/ui/Form.cpp b/libstarlight/source/starlight/ui/Form.cpp index de82983..ec100c4 100644 --- a/libstarlight/source/starlight/ui/Form.cpp +++ b/libstarlight/source/starlight/ui/Form.cpp @@ -30,6 +30,8 @@ using starlight::ui::Form; // STATIC MEMBERS // //////////////////// +unsigned int Form::nextShowCounter = 0; + bool Form::OrderedCompare(std::shared_ptr
& f1, std::shared_ptr& f2) { // acts as < operator if (!f1->IsVisible()) return true; if (f1->priority < f2->priority) return true; @@ -41,6 +43,13 @@ bool Form::OrderedCompare(std::shared_ptr& f1, std::shared_ptr& f2) // INSTANCE MEMBERS // ////////////////////// +Form::Form(bool useDefaults) { + if (useDefaults) { + touchScreen = std::make_shared(VRect(0, 0, 320, 240)); + topScreen = std::make_shared(VRect(0, 0, 400, 240)); + } +} + void Form::Open() { auto app = Application::Current(); if (app == nullptr) return; diff --git a/libstarlight/source/starlight/ui/Form.h b/libstarlight/source/starlight/ui/Form.h index 46be1db..e7a3cd6 100644 --- a/libstarlight/source/starlight/ui/Form.h +++ b/libstarlight/source/starlight/ui/Form.h @@ -24,7 +24,7 @@ namespace starlight { open = 1 << 30 }; - typedef std::underlying_type::type FormFlags_t; + //typedef std::underlying_type::type FormFlags_t; class Form; template @@ -52,19 +52,20 @@ namespace starlight { // INSTANCE MEMBERS // ////////////////////// private: - unsigned int showCounter; + unsigned int showCounter = 0; protected: // public: - int priority; - unsigned int flags; + int priority = 0; + unsigned int flags = 0; std::shared_ptr touchScreen = nullptr; std::shared_ptr topScreen = nullptr; Form() { } + Form(bool useDefaults); virtual ~Form() { } void Open(); diff --git a/testbed/source/Core.cpp b/testbed/source/Core.cpp index bad9fa5..7a51614 100644 --- a/testbed/source/Core.cpp +++ b/testbed/source/Core.cpp @@ -57,6 +57,15 @@ void Core::Init() { label->SetFont("default.12"); btn.SetText("Clicked again!\nBunch of lines!\nNow testing scrollarea fling with some extra size!\n\n\nPotato.\nCalamari sandwich on rye with a side of octagonal pimento; a jar of butter?"); btn.rect.size.y = 573; + + auto form = std::make_shared(true); + auto label = std::make_shared(VRect(0,0,320,0)); + label->autoSizeV = true; + label->SetText("This is a form, coming in and nuking the non-form UI elements. Whoops."); + form->topScreen->Add(label); + form->Open(); + form->Show(); + if (!form->GetFlag(sl::ui::FormFlags::open)) btn.SetText("fuck."); }; }; };