mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-16 14:50:17 +00:00
ZVISION: Implement functions for system messaging.
This commit is contained in:
parent
bbaebdf680
commit
b9103b8d19
@ -729,6 +729,21 @@ uint16 RenderManager::createSubArea(const Common::Rect &area) {
|
||||
return _subid;
|
||||
}
|
||||
|
||||
uint16 RenderManager::createSubArea() {
|
||||
_subid++;
|
||||
|
||||
oneSub sub;
|
||||
sub.redraw = false;
|
||||
sub.timer = -1;
|
||||
sub.todelete = false;
|
||||
sub._r = Common::Rect(_subWndRect.left, _subWndRect.top, _subWndRect.right, _subWndRect.bottom);
|
||||
sub._r.translate(-_workingWindow.left, -_workingWindow.top);
|
||||
|
||||
_subsList[_subid] = sub;
|
||||
|
||||
return _subid;
|
||||
}
|
||||
|
||||
void RenderManager::deleteSubArea(uint16 id) {
|
||||
if (_subsList.contains(id))
|
||||
_subsList[id].todelete = true;
|
||||
|
@ -233,6 +233,7 @@ public:
|
||||
void blitSurfaceToMenu(const Graphics::Surface &src, int x, int y, uint32 colorkey);
|
||||
|
||||
uint16 createSubArea(const Common::Rect &area);
|
||||
uint16 createSubArea();
|
||||
void deleteSubArea(uint16 id);
|
||||
void deleteSubArea(uint16 id, int16 delay);
|
||||
void updateSubArea(uint16 id, const Common::String &txt);
|
||||
|
@ -212,6 +212,71 @@ Common::Error ZVision::run() {
|
||||
return Common::kNoError;
|
||||
}
|
||||
|
||||
bool ZVision::askQuestion(const Common::String &str) {
|
||||
uint16 msgid = _renderManager->createSubArea();
|
||||
_renderManager->updateSubArea(msgid, str);
|
||||
_renderManager->processSubs(0);
|
||||
_renderManager->renderBackbufferToScreen();
|
||||
_clock.stop();
|
||||
|
||||
int result = 0;
|
||||
|
||||
while (result == 0) {
|
||||
Common::Event evnt;
|
||||
while (_eventMan->pollEvent(evnt)) {
|
||||
if (evnt.type == Common::EVENT_KEYDOWN) {
|
||||
switch (evnt.kbd.keycode) {
|
||||
case Common::KEYCODE_y:
|
||||
result = 2;
|
||||
break;
|
||||
case Common::KEYCODE_n:
|
||||
result = 1;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
_system->updateScreen();
|
||||
_system->delayMillis(66);
|
||||
}
|
||||
_renderManager->deleteSubArea(msgid);
|
||||
_clock.start();
|
||||
return result == 2;
|
||||
}
|
||||
|
||||
void ZVision::delayedMessage(const Common::String &str, uint16 milsecs) {
|
||||
uint16 msgid = _renderManager->createSubArea();
|
||||
_renderManager->updateSubArea(msgid, str);
|
||||
_renderManager->processSubs(0);
|
||||
_renderManager->renderBackbufferToScreen();
|
||||
_clock.stop();
|
||||
|
||||
uint32 stop_time = _system->getMillis() + milsecs;
|
||||
while (_system->getMillis() < stop_time) {
|
||||
Common::Event evnt;
|
||||
while (_eventMan->pollEvent(evnt)) {
|
||||
if (evnt.type == Common::EVENT_KEYDOWN &&
|
||||
(evnt.kbd.keycode == Common::KEYCODE_SPACE ||
|
||||
evnt.kbd.keycode == Common::KEYCODE_RETURN ||
|
||||
evnt.kbd.keycode == Common::KEYCODE_ESCAPE))
|
||||
break;
|
||||
}
|
||||
_system->updateScreen();
|
||||
_system->delayMillis(66);
|
||||
}
|
||||
_renderManager->deleteSubArea(msgid);
|
||||
_clock.start();
|
||||
}
|
||||
|
||||
void ZVision::timedMessage(const Common::String &str, uint16 milsecs) {
|
||||
uint16 msgid = _renderManager->createSubArea();
|
||||
_renderManager->updateSubArea(msgid, str);
|
||||
_renderManager->processSubs(0);
|
||||
_renderManager->renderBackbufferToScreen();
|
||||
_renderManager->deleteSubArea(msgid, milsecs);
|
||||
}
|
||||
|
||||
void ZVision::pauseEngineIntern(bool pause) {
|
||||
_mixer->pauseAll(pause);
|
||||
|
||||
|
@ -167,6 +167,10 @@ public:
|
||||
Common::String generateSaveFileName(uint slot);
|
||||
Common::String generateAutoSaveFileName();
|
||||
|
||||
bool askQuestion(const Common::String &str);
|
||||
void delayedMessage(const Common::String &str, uint16 milsecs);
|
||||
void timedMessage(const Common::String &str, uint16 milsecs);
|
||||
|
||||
void setRenderDelay(uint);
|
||||
bool canRender();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user