Is there any form of battery monitor built in? If not, how much work would it be to add such a feature. I know it's not a major feature, but still nice to be able to say in an application "Your battery is low, please save and quit, or find the nearest power source."
android automatic notify drawing over a confirmation window!
Is the feature available on PC's (laptops)
this API is probably available everywhere, I think SDL has it:
https://wiki.libsdl.org/SDL_GetPowerInfo
so if if anyone wants to port this code to Godot be welcome.
Could be functions added to OS
WINDOWS AND OSX TESTERS NEEDED PLEASE ! SEE LIST BELOW.
This feature is currently in development on this fork branch : https://github.com/StraToN/godot/tree/314-battery-notification
Current status:
server : not done (is that a platform?? what is the difference between this and X11??)
Technically, yes. server is designed for running on headless GNU/Linux (and BSD) operating systems, without requiring any X11 dependency. It can also be faster in many cases. That makes it suitable for dedicated game servers, running scripts like asset conversion…
"javascript" is html5, I don't know if there's apis to expose the battery
status to a website
On 29 April 2016 at 06:50, Calinou [email protected] wrote:
server : not done (is that a platform?? what is the difference between
this and X11??)Technically, yes. server is designed for running on headless GNU/Linux
(and BSD) operating systems, without requiring any X11 dependency. It can
also be faster in many cases. That makes it suitable for dedicated game
servers, running scripts like asset conversion…—
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub
https://github.com/godotengine/godot/issues/314#issuecomment-215672627
@punto- : there is a new javascript Battery Status Web API, but it is still a W3C Proposed Recommendation. It is mainly available on Firefox and Chrome (on Android and PC)
https://developer.mozilla.org/en-US/docs/Web/API/Battery_Status_API
https://w3c.github.io/battery/
@Calinou OK, so server would actually work the exact same way as X11. I suppose that, of course a server should never run on battery, but hey, people mind their own business ;)
@punto- @SuperUserNameMan I guess we should then simply wait for this one. Keeping it warm.
Oh, also I edited my last post. Tests were not driven for *BSD, I updated the status list.
I'll test this for Windows.
@StraToN first, there's an error on line 13 of the SCsub file for Windows. It is now 'power_windows.cpp", when it should be "power_windows.cpp" (without comma at the end).
Even after this fix I can't compile though. Got a bunch of errors:
c:\users\george\workspace\godot\godot-src\platform\windows\os_windows.h(133) : e
rror C2143: syntax error : missing ';' before '*'
c:\users\george\workspace\godot\godot-src\platform\windows\os_windows.h(133) : e
rror C2143: syntax error : missing ';' before '*'
c:\users\george\workspace\godot\godot-src\platform\windows\os_windows.h(133) : e
rror C4430: missing type specifier - int assumed. Note: C++ does not support def
ault-intc:\users\george\workspace\godot\godot-src\platform\windows\os_windows.h(
133) : error C4430: missing type specifier - int assumed. Note: C++ does not sup
port default-int
platform\windows\power_windows.cpp(34) : error C2065: 'SYSTEM_POWER_STATUS' : un
declared identifier
platform\windows\power_windows.cpp(34) : error C2146: syntax error : missing ';'
before identifier 'status'
platform\windows\power_windows.cpp(34) : error C2065: 'status' : undeclared iden
tifier
platform\windows\power_windows.cpp(35) : error C2065: 'FALSE' : undeclared ident
ifier
platform\windows\power_windows.cpp(38) : error C2065: 'status' : undeclared iden
tifier
scons: *** [platform\windows\godot_win.windows.opt.tools.32.obj] Error 2
platform\windows\power_windows.cpp(38) : error C3861: 'GetSystemPowerStatus': id
entifier not found
platform\windows\power_windows.cpp(42) : error C2065: 'status' : undeclared iden
tifier
platform\windows\power_windows.cpp(42) : error C2228: left of '.BatteryFlag' mus
t have class/struct/union
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\xlocale(337) : wa
rning C4530: C++ exception handler used, but unwind semantics are not enabled. S
pecify /EHsc
type is 'unknown-type'
platform\windows\power_windows.cpp(44) : error C2065: 'status' : undeclared iden
tifier
platform\windows\power_windows.cpp(44) : error C2228: left of '.BatteryFlag' mus
t have class/struct/union
type is 'unknown-type'
platform\windows\power_windows.cpp(45) : error C2100: illegal indirection
platform\windows\power_windows.cpp(46) : error C2065: 'status' : undeclared iden
tifier
platform\windows\power_windows.cpp(46) : error C2228: left of '.BatteryFlag' mus
t have class/struct/union
type is 'unknown-type'
platform\windows\power_windows.cpp(47) : error C2100: illegal indirection
platform\windows\power_windows.cpp(48) : error C2065: 'TRUE' : undeclared identi
fier
platform\windows\power_windows.cpp(49) : error C2065: 'status' : undeclared iden
tifier
platform\windows\power_windows.cpp(49) : error C2228: left of '.ACLineStatus' mu
st have class/struct/union
type is 'unknown-type'
platform\windows\power_windows.cpp(50) : error C2100: illegal indirection
platform\windows\power_windows.cpp(51) : error C2065: 'TRUE' : undeclared identi
fier
platform\windows\power_windows.cpp(53) : error C2100: illegal indirection
platform\windows\power_windows.cpp(54) : error C2065: 'TRUE' : undeclared identi
fier
platform\windows\power_windows.cpp(60) : error C2065: 'status' : undeclared iden
tifier
platform\windows\power_windows.cpp(60) : error C2228: left of '.BatteryLifePerce
nt' must have class/struct/union
type is 'unknown-type'
platform\windows\power_windows.cpp(61) : error C2065: 'status' : undeclared iden
tifier
platform\windows\power_windows.cpp(61) : error C2228: left of '.BatteryLifeTime'
must have class/struct/union
type is 'unknown-type'
platform\windows\power_windows.cpp(71) : error C2065: 'TRUE' : undeclared identi
fier
scons: *** [platform\windows\power_windows.windows.opt.tools.32.obj] Error 2
c:\users\george\workspace\godot\godot-src\platform\windows\os_windows.h(133) : e
rror C2143: syntax error : missing ';' before '*'
c:\users\george\workspace\godot\godot-src\platform\windows\os_windows.h(133) : e
rror C4430: missing type specifier - int assumed. Note: C++ does not support def
ault-int
scons: *** [platform\windows\joystick.windows.opt.tools.32.obj] Error 2
platform\windows\os_windows.cpp(989) : error C2065: 'power_manager' : undeclared
identifier
platform\windows\os_windows.cpp(989) : error C2061: syntax error : identifier 'P
owerWindows'
scons: *** [platform\windows\os_windows.windows.opt.tools.32.obj] Error 2
scons: building terminated because of errors.
Tested on X11, it seems to work fine. Like @StraToN reported, I also get -1 for get_power_seconds_left, I'll see if I have more luck with the SDL API directly and/or if they have a bug report about it.
With the cable plugged in and the battery fully charged, I got POWERSTATE_UNKNOWN instead of POWERSTATE_CHARGED. I'm now charging it fully again to see if I can reproduce it.
Also the enums in the help are sorted alphabetically instead of by value, it would be nice to fix that.
@vnen Thanks a lot for your tests ! There was a missing include (I forgot windows.h). This is corrected now, please pull and try again.
@akien-mga You just need to compile libsdl and run make in src/tests. There lies a test program for power management testing.
@StraToN still missing the platform/windows/SCsub correction. Other than that it seems to be working perfectly. Unfortunately, my Windows laptop is not showing the remaining battery time (only percentage), so I can't tell if OS.get_power_seconds_left() is working as intended (I'm always getting -1, since the OS is not calculating it).
As a note, it shows the power state as NO_BATTERY on my desktop, which I guess is intended behavior.
@vnen Ah, I see the error now. My eyes were closing yesterday, I didn't see it. I'll correct this ASAP.
edit : done.
Concerning get_power_seconds_left(), I invite you to compile SDL as well as demo programs it features, to see if it succeeds.
Other than that, no PR until most platorms are tested and compile. We can't merge code thats breaks Godot. Looking at OSX users here in particular 😊
ping
Still needing OSX testers.
@trollworkout uses OSX, I believe.
ah I have a mac now, i could test..
On Wed, Jun 15, 2016 at 12:16 PM, George Marques [email protected]
wrote:
@trollworkout https://github.com/trollworkout uses OSX, I believe.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/godotengine/godot/issues/314#issuecomment-226219921,
or mute the thread
https://github.com/notifications/unsubscribe/AF-Z2xZXM33o-tS8kZxIvpFHKnzOIkd4ks5qMBdngaJpZM4B0TAL
.
I got OSX. I'm looking above see how I can test this.
@StraToN I'd suggest your cleanup your branch (merge some of the commits together, 16 commits is too much for this feature), rebase on top of master HEAD and make a pull request. Right now your work is kind of hidden, and forgotten.
Was the PR merged in the end?
I never ended up checking this :D
@bojidar-bg no, still open: #5871
The last comment on #5871 seems to indicate that it was merged. Maybe this one can be closed?
It still needs to be implemented on various platforms. @StraToN, I leave it up to you to either update this issue with the current implementation status, or maybe close it and open a new one for that, as it might be clearer.
@akien-mga I'll create a new issue with the current implementation status & what's missing. That's cleaner this way ;)
Most helpful comment
@StraToN I'd suggest your cleanup your branch (merge some of the commits together, 16 commits is too much for this feature), rebase on top of master HEAD and make a pull request. Right now your work is kind of hidden, and forgotten.