diff options
author | Chris Apers | 2005-10-12 20:19:12 +0000 |
---|---|---|
committer | Chris Apers | 2005-10-12 20:19:12 +0000 |
commit | 8ab08763adf4cb7666189f4f3dfc14048a928ed7 (patch) | |
tree | 30bb3971e0b43136506f1bafdb352c06d8c86ebb | |
parent | 625520882c7c1c7a237802923d399f4699c157cd (diff) | |
download | scummvm-rg350-8ab08763adf4cb7666189f4f3dfc14048a928ed7.tar.gz scummvm-rg350-8ab08763adf4cb7666189f4f3dfc14048a928ed7.tar.bz2 scummvm-rg350-8ab08763adf4cb7666189f4f3dfc14048a928ed7.zip |
Added battery info and 'Fight mode' OSD message
svn-id: r19043
-rwxr-xr-x | backends/PalmOS/Src/base_event.cpp | 46 |
1 files changed, 26 insertions, 20 deletions
diff --git a/backends/PalmOS/Src/base_event.cpp b/backends/PalmOS/Src/base_event.cpp index 061d1c1c7e..2636815658 100755 --- a/backends/PalmOS/Src/base_event.cpp +++ b/backends/PalmOS/Src/base_event.cpp @@ -33,29 +33,34 @@ void OSystem_PalmBase::timer_handler() { } void OSystem_PalmBase::battery_handler() { -// UInt16 voltage, warnThreshold, criticalThreshold; -// voltage = SysBatteryInfo(false, &warnThreshold, &criticalThreshold, NULL, NULL, NULL, NULL); - -/* - if (voltage <= warnThreshold) { - if (!_showBatLow) { - _showBatLow = true; - draw1BitGfx(kDrawBatLow, (getWidth() >> 1), -16, true); + // check battery level every 15secs + if ((TimGetTicks() - _batCheckLast) > _batCheckTicks) { + UInt16 voltage, warnThreshold, criticalThreshold; + voltage = SysBatteryInfoV20(false, &warnThreshold, &criticalThreshold, NULL, NULL, NULL); + + if (voltage <= warnThreshold) { + if (!_showBatLow) { + _showBatLow = true; + draw_osd(kDrawBatLow, _screenDest.w - 18, -16, true, 2); + displayMessageOnOSD("Battery low."); + } + } else { + if (_showBatLow) { + _showBatLow = false; + draw_osd(kDrawBatLow, _screenDest.w - 18, -16, false); + } } - } else { - if (_showBatLow) { - _showBatLow = false; - draw1BitGfx(kDrawBatLow, (getWidth() >> 1), -16, false); + + if (voltage <= criticalThreshold) { + ::EventType event; + event.eType = keyDownEvent; + event.data.keyDown.chr = vchrPowerOff; + event.data.keyDown.modifiers = commandKeyMask; + EvtAddEventToQueue(&event); } + + _batCheckLast = TimGetTicks(); } -*//* - if (voltage <= criticalThreshold) { - ::EventType event; - event.eType = keyDownEvent; - event.data.keyDown.chr = vchrAutoOff; - event.data.keyDown.modifiers = commandKeyMask; - EvtAddUniqueEventToQueue(&event, 0, true); - }*/ } bool OSystem_PalmBase::pollEvent(Event &event) { @@ -256,6 +261,7 @@ bool OSystem_PalmBase::pollEvent(Event &event) { } else if (key == 'n' && mask == KBD_CTRL|KBD_ALT && !_overlayVisible) { _useNumPad = !_useNumPad; draw_osd(kDrawFight, _screenDest.w - 34, _screenDest.h + 2, _useNumPad, 1); + displayMessageOnOSD(_useNumPad ? "Fight mode on." : "Fight mode off."); return false; } |