-
-
Notifications
You must be signed in to change notification settings - Fork 21k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add power battery% access #5871
Conversation
904b5c8
to
29228a6
Compare
BTW, I wouldn't bother (for now) about WinRT. Right now it does not even compile. |
@@ -154,6 +155,8 @@ class OS_Android : public OS_Unix { | |||
VideoPauseFunc video_pause_func; | |||
VideoStopFunc video_stop_func; | |||
SetKeepScreenOnFunc set_keep_screen_on_func; | |||
|
|||
power_android power_manager; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be power_android *power_manager;
, right? This is what breaks the build for Android.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's corrected. I just pushed the fix, but I can't affirm android will build, I'm almost certain there are other problems, especially in platform/android/power_android.cpp
's method int Android_JNI_GetPowerInfo(int* plugged, int* charged, int* battery, int* seconds, int* percent)
663b2e4
to
7944b97
Compare
It fails building on OSX and Android: https://travis-ci.org/godotengine/godot/builds/146963962 |
@akien-mga Yes, I don't have a Mac to test, nor I have an Android environment. |
Yes but you can check the build logs and see what are the issues :) For Android you'd likely have to setup a build environment to test properly though, as there seem to be various issues: https://travis-ci.org/godotengine/godot/jobs/146963965 |
Adding |
7944b97
to
4ed666a
Compare
@vnen I think it's possible to implement WinRT pretty easily using the Battery class documented here http://msdn.microsoft.com/library/windowsphone/develop/jj207231, according to SDL comment left in @GungnirInd Thanks a lot, it worked :) |
I need to test this for Android. It'd be nice to merge this before 2.2. Since now I'm fixing the WinRT port, it can be added too for such platform. |
@vnen I'll try to get it to compile with Android now, even though I am not an Android developer. I suppose some includes are missing. |
What's the status of this one? |
@reduz Still missing Android development by converting SDL code to Godot. I am not competent on this one yet 😕 |
you can ask @RandomShaper for help I guess |
@StraToN The PR has conflicts, could you have a look at rebasing? |
@akien-mga Will do ASAP. |
aca95f3
to
49a9ef6
Compare
Rebased. |
Looking at the commit history, there's still something fishy though.. :/ |
Indeed, looks like I left 2 useless commits . Will correct it tonight |
49a9ef6
to
9232bb7
Compare
@akien-mga Corrected. Do you validate? :) |
Looks good commit-wise from a quick glance :) |
@@ -0,0 +1,78 @@ | |||
/*************************************************************************/ | |||
/* power_winrt.h */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Forgot to change the file name here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Corrected. Thanks !
9232bb7
to
a421522
Compare
@StraToN You have some rebase work ahead :) |
Done: - X11, server (tested) - Windows (developed, would be nice to retest) - OSX (not tested) Prepared (not developed): - Android (code is here, but may not compile) - iphone - winrt - bb10 - haiku - javascript
a421522
to
27cfdee
Compare
27cfdee
to
917ce78
Compare
@akien-mga Done ;) Ping @vnen for winrt and Mux213 on IRC for osx |
int percent_left; | ||
PowerState power_state; | ||
void checkps(CFDictionaryRef dict, bool * have_ac, bool * have_battery, bool * charging); | ||
bool GetPowerInfo_MacOSX(/*PowerState * state, int *seconds, int *percent*/); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I should kick this comment with parameters out.
Merged manually in 94103c0. Please open a new issue to keep track of the state of this feature on all platforms (implemented/working) so that we make sure it's all good for 3.0. |
It was initially implemented in godotengine#5871 for Godot 3.0, but never really completed or thoroughly tested for most platforms. It then stayed in limbo and nobody seems really keen to finish it, so it's better to remove it in 4.0, and re-add eventually (possibly with a different API) if there's demand and an implementation confirmed working on all platforms. Closes godotengine#8770.
(repost of #5869 which was broken)
Only tested X11 and Windows by @vnen. Sorry I don't have a mac.
JOB IS NOT FINISHED FOR ALL PLATFORMS! DON'T MERGE BEFORE ALL PLATFORMS ARE TESTED !!
NEED TESTERS for iOS, OSX, WinRT and Android (may not compile for these).
Thanks