Created
February 11, 2023 01:39
-
-
Save chadcatlett/0366fef70bb526b6c36518a82398c7f6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "pch.h" | |
#include <winrt/Windows.Gaming.Input.h> | |
#include <winrt/Windows.Devices.Power.h> | |
using namespace winrt; | |
using namespace Windows::Gaming::Input; | |
int main() | |
{ | |
init_apartment(); | |
printf("Attempting to enumerate all gamepads\n"); | |
for (auto const& gamepad : Gamepad::Gamepads()) { | |
auto bat = gamepad.TryGetBatteryReport(); | |
auto currentCharge = bat.RemainingCapacityInMilliwattHours(); | |
if (currentCharge != nullptr) { | |
printf("remaining charge: %i\n", currentCharge.GetInt32()); | |
} | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment