The Battle for Wesnoth  1.19.7+dev
Classes | Functions | Variables
sdl Namespace Reference

Classes

struct  exception
 
class  UserEvent
 
class  window
 The wrapper class for the SDL_Window class. More...
 

Functions

static std::string create_error (const std::string &operation, const bool use_sdl_error)
 
uint32_t get_mouse_state (int *x, int *y)
 A wrapper for SDL_GetMouseState that gives coordinates in draw space. More...
 
uint32_t get_mouse_button_mask ()
 Returns the current mouse button mask. More...
 
point get_mouse_location ()
 Returns the current mouse location in draw space. More...
 
unsigned get_mods ()
 Returns a bitmask of active modifier keys (ctrl, shift, alt, gui). More...
 
version_info get_version ()
 Returns the runtime SDL version. More...
 
bool runtime_at_least (uint8_t major, uint8_t minor=0, uint8_t patch=0)
 Returns true if the runtime SDL version is at or greater than the specified version, false otherwise. More...
 

Variables

constexpr const SDL_Rect empty_rect { 0, 0, 0, 0 }
 

Function Documentation

◆ create_error()

static std::string sdl::create_error ( const std::string &  operation,
const bool  use_sdl_error 
)
static

Definition at line 23 of file exception.cpp.

◆ get_mods()

unsigned sdl::get_mods ( )

Returns a bitmask of active modifier keys (ctrl, shift, alt, gui).

Unused modifier keys (caps lock, scroll lock, num lock, AltGr) are filtered out and will always be unset.

Left and right keys are not distinguished. If either is detected, both will be set. For example if only left shift is down, both KMOD_LSHIFT and KMOD_RSHIFT will be set in the returned bitmask.

Returns
A bitmask of SDL_Keymod values representing the active state.

Definition at line 61 of file input.cpp.

Referenced by hotkey::create_hotkey(), hotkey::is_hotkeyable_event(), hotkey::hotkey_keyboard::matches_helper(), and hotkey::hotkey_mouse::matches_helper().

◆ get_mouse_button_mask()

uint32_t sdl::get_mouse_button_mask ( )

◆ get_mouse_location()

point sdl::get_mouse_location ( )

◆ get_mouse_state()

uint32_t sdl::get_mouse_state ( int *  x,
int *  y 
)

◆ get_version()

version_info sdl::get_version ( )

Returns the runtime SDL version.

Definition at line 36 of file utils.cpp.

Referenced by video::get_dpi().

◆ runtime_at_least()

bool sdl::runtime_at_least ( uint8_t  major,
uint8_t  minor = 0,
uint8_t  patch = 0 
)

Returns true if the runtime SDL version is at or greater than the specified version, false otherwise.

Definition at line 43 of file utils.cpp.

Referenced by sdl_bad_at_rects().

Variable Documentation

◆ empty_rect

constexpr const SDL_Rect sdl::empty_rect { 0, 0, 0, 0 }
constexpr