SDL_power.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /*
  2. Simple DirectMedia Layer
  3. Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org>
  4. This software is provided 'as-is', without any express or implied
  5. warranty. In no event will the authors be held liable for any damages
  6. arising from the use of this software.
  7. Permission is granted to anyone to use this software for any purpose,
  8. including commercial applications, and to alter it and redistribute it
  9. freely, subject to the following restrictions:
  10. 1. The origin of this software must not be misrepresented; you must not
  11. claim that you wrote the original software. If you use this software
  12. in a product, an acknowledgment in the product documentation would be
  13. appreciated but is not required.
  14. 2. Altered source versions must be plainly marked as such, and must not be
  15. misrepresented as being the original software.
  16. 3. This notice may not be removed or altered from any source distribution.
  17. */
  18. #ifndef _SDL_power_h
  19. #define _SDL_power_h
  20. /**
  21. * \file SDL_power.h
  22. *
  23. * Header for the SDL power management routines.
  24. */
  25. #include "SDL_stdinc.h"
  26. #include "begin_code.h"
  27. /* Set up for C function definitions, even when using C++ */
  28. #ifdef __cplusplus
  29. extern "C" {
  30. #endif
  31. /**
  32. * \brief The basic state for the system's power supply.
  33. */
  34. typedef enum
  35. {
  36. SDL_POWERSTATE_UNKNOWN, /**< cannot determine power status */
  37. SDL_POWERSTATE_ON_BATTERY, /**< Not plugged in, running on the battery */
  38. SDL_POWERSTATE_NO_BATTERY, /**< Plugged in, no battery available */
  39. SDL_POWERSTATE_CHARGING, /**< Plugged in, charging battery */
  40. SDL_POWERSTATE_CHARGED /**< Plugged in, battery charged */
  41. } SDL_PowerState;
  42. /**
  43. * \brief Get the current power supply details.
  44. *
  45. * \param secs Seconds of battery life left. You can pass a NULL here if
  46. * you don't care. Will return -1 if we can't determine a
  47. * value, or we're not running on a battery.
  48. *
  49. * \param pct Percentage of battery life left, between 0 and 100. You can
  50. * pass a NULL here if you don't care. Will return -1 if we
  51. * can't determine a value, or we're not running on a battery.
  52. *
  53. * \return The state of the battery (if any).
  54. */
  55. extern DECLSPEC SDL_PowerState SDLCALL SDL_GetPowerInfo(int *secs, int *pct);
  56. /* Ends C function definitions when using C++ */
  57. #ifdef __cplusplus
  58. }
  59. #endif
  60. #include "close_code.h"
  61. #endif /* _SDL_power_h */
  62. /* vi: set ts=4 sw=4 expandtab: */