include/SDL_hints.h
changeset 7432 58908b180ebd
parent 7328 bbfc72c803df
child 7577 709056f2580a
     1.1 --- a/include/SDL_hints.h	Sat Jul 13 11:06:34 2013 +0800
     1.2 +++ b/include/SDL_hints.h	Sat Jul 13 03:13:41 2013 -0700
     1.3 @@ -218,13 +218,13 @@
     1.4  /**
     1.5   *  \brief  A variable that lets you enable joystick (and gamecontroller) events even when your app is in the background.
     1.6   *
     1.7 - * The default value is "0".
     1.8 - *
     1.9   *  The variable can be set to the following values:
    1.10   *    "0"       - Disable joystick & gamecontroller input events when the
    1.11   *                application is in the background.
    1.12   *    "1"       - Enable joystick & gamecontroller input events when the
    1.13   *                application is in the backgroumd.
    1.14 + *
    1.15 + *  The default value is "0".  This hint may be set at any time.
    1.16   */
    1.17  #define SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS "SDL_JOYSTICK_ALLOW_BACKGROUND_EVENTS"
    1.18  
    1.19 @@ -240,6 +240,23 @@
    1.20  #define SDL_HINT_ALLOW_TOPMOST "SDL_ALLOW_TOPMOST"
    1.21  
    1.22  
    1.23 +/**
    1.24 + *  \brief A variable that controls the timer resolution, in milliseconds.
    1.25 + *
    1.26 + *  The higher resolution the timer, the more frequently the CPU services
    1.27 + *  timer interrupts, and the more precise delays are, but this takes up
    1.28 + *  power and CPU time.  This hint is only used on Windows 7 and earlier.
    1.29 + *
    1.30 + *  See this blog post for more information:
    1.31 + *  http://randomascii.wordpress.com/2013/07/08/windows-timer-resolution-megawatts-wasted/
    1.32 + *
    1.33 + *  If this variable is set to "0", the system timer resolution is not set.
    1.34 + *
    1.35 + *  The default value is "1". This hint may be set at any time.
    1.36 + */
    1.37 +#define SDL_HINT_TIMER_RESOLUTION "SDL_TIMER_RESOLUTION"
    1.38 +
    1.39 +
    1.40  
    1.41  /**
    1.42   *  \brief  An enumeration of hint priorities
    1.43 @@ -273,7 +290,6 @@
    1.44  extern DECLSPEC SDL_bool SDLCALL SDL_SetHint(const char *name,
    1.45                                               const char *value);
    1.46  
    1.47 -
    1.48  /**
    1.49   *  \brief Get a hint
    1.50   *
    1.51 @@ -282,6 +298,29 @@
    1.52  extern DECLSPEC const char * SDLCALL SDL_GetHint(const char *name);
    1.53  
    1.54  /**
    1.55 + *  \brief Add a function to watch a particular hint
    1.56 + *
    1.57 + *  \param name The hint to watch
    1.58 + *  \param callback The function to call when the hint value changes
    1.59 + *  \param userdata A pointer to pass to the callback function
    1.60 + */
    1.61 +typedef void (*SDL_HintCallback)(void *userdata, const char *name, const char *oldValue, const char *newValue);
    1.62 +extern DECLSPEC void SDLCALL SDL_AddHintCallback(const char *name,
    1.63 +                                                 SDL_HintCallback callback,
    1.64 +                                                 void *userdata);
    1.65 +
    1.66 +/**
    1.67 + *  \brief Remove a function watching a particular hint
    1.68 + *
    1.69 + *  \param name The hint being watched
    1.70 + *  \param callback The function being called when the hint value changes
    1.71 + *  \param userdata A pointer being passed to the callback function
    1.72 + */
    1.73 +extern DECLSPEC void SDLCALL SDL_DelHintCallback(const char *name,
    1.74 +                                                 SDL_HintCallback callback,
    1.75 +                                                 void *userdata);
    1.76 +
    1.77 +/**
    1.78   *  \brief  Clear all hints
    1.79   *
    1.80   *  This function is called during SDL_Quit() to free stored hints.