UIScreen helper class, derive your newUI screens from this.

This commit is contained in:
Henrik Rydgard committed 2013-06-03 19:59:33 +02:00
1 parent 2b3e1355ad
commit c87fe2f782
5 files changed
+70

No files matched your search

+37
View File
@@ -0,0 +1,37 @@
#include "ui/ui_screen.h"
#include "ui/ui_context.h"
#include "ui/screen.h"
void UIScreen::update(InputState &input) {
if (!root_) {
CreateViews();
}
if (orientationChanged_) {
delete root_;
root_ = 0;
CreateViews();
}
UpdateViewHierarchy(input, root_);
}
void UIScreen::render() {
UI::LayoutViewHierarchy(*screenManager()->getUIContext(), root_);
screenManager()->getUIContext()->Begin();
DrawBackground();
root_->Draw(*screenManager()->getUIContext());
screenManager()->getUIContext()->End();
screenManager()->getUIContext()->Flush();
}
void UIScreen::touch(const TouchInput &touch) {
root_->Touch(touch);
}
UI::EventReturn UIScreen::OnBack(UI::EventParams &e) {
screenManager()->finishDialog(this, DR_OK);
return UI::EVENT_DONE;
}