[Scummvm-cvs-logs] CVS: scummvm/backends/PalmOS/Src base_event.cpp,1.1,1.2
Chris Apers
chrilith at users.sourceforge.net
Wed Oct 12 13:21:14 CEST 2005
Update of /cvsroot/scummvm/scummvm/backends/PalmOS/Src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30395
Modified Files:
base_event.cpp
Log Message:
Added battery info and 'Fight mode' OSD message
Index: base_event.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/PalmOS/Src/base_event.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- base_event.cpp 8 Oct 2005 22:18:29 -0000 1.1
+++ base_event.cpp 12 Oct 2005 20:19:12 -0000 1.2
@@ -33,29 +33,34 @@
}
void OSystem_PalmBase::battery_handler() {
-// UInt16 voltage, warnThreshold, criticalThreshold;
-// voltage = SysBatteryInfo(false, &warnThreshold, &criticalThreshold, NULL, NULL, NULL, NULL);
+ // 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;
- draw1BitGfx(kDrawBatLow, (getWidth() >> 1), -16, true);
+ 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 @@
} 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;
}
More information about the Scummvm-git-logs
mailing list