MM: MM1: Introduced focused view display

This commit is contained in:
Paul Gilbert 2022-05-20 22:27:06 -07:00 committed by Eugene Sandulenko
parent 2aaceda632
commit 3718284f6f
No known key found for this signature in database
GPG Key ID: 014D387312D34F08
3 changed files with 22 additions and 4 deletions

View File

@ -65,6 +65,7 @@ public:
class Events : public UIElement {
private:
Graphics::Screen *_screen = nullptr;
UIElement *_focusedElement;
protected:
/**
* Process an event
@ -79,9 +80,26 @@ public:
*/
void runGame();
/**
* Sets the focus to a new view
*/
void focusElement(UIElement *ui) {
_focusedElement = ui;
}
Graphics::Screen *getScreen() const override {
return _screen;
}
void draw() override {
if (_focusedElement)
_focusedElement->draw();
}
bool tick() override {
return _focusedElement ? _focusedElement->tick() : false;
}
};
} // namespace MM1

View File

@ -51,8 +51,7 @@ void GFX::setEgaPalette(int palNum) {
g_system->getPaletteManager()->setPalette(pal, 0, 16);
uint32 c = 0xffffffff;
for (int i = 1; i < 256; ++i)
g_system->getPaletteManager()->setPalette((const byte *)&c, i, 1);
g_system->getPaletteManager()->setPalette((const byte *)&c, 255, 1);
}
} // namespace Gfx

View File

@ -54,8 +54,9 @@ Common::Error MM1Engine::run() {
return Common::kNoError;
// Run the game
// Views::TitleView view1(this);
Views::AreYouReady view1(this);
Views::TitleView view1(this);
Views::AreYouReady view2(this);
focusElement(&view2);
runGame();
return Common::kNoError;