The Battle for Wesnoth  1.17.10+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...
 
void fill_surface_rect (surface &dst, SDL_Rect *dst_rect, const uint32_t color)
 Fill a rectangle on a given surface. 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.

◆ fill_surface_rect()

void sdl::fill_surface_rect ( surface dst,
SDL_Rect *  dst_rect,
const uint32_t  color 
)
inline

Fill a rectangle on a given surface.

Alias for SDL_FillRect.

Parameters
dstThe surface to operate on.
dst_rectThe rectangle to fill.
colorColor of the rectangle.

Definition at line 49 of file utils.hpp.

Referenced by image::get_hexed(), and image::getMinimap().

◆ 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 ( )

Returns the current mouse location in draw space.

Definition at line 54 of file input.cpp.

References get_mouse_state(), and p.

Referenced by gui2::get_mouse_position().

◆ 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 34 of file utils.cpp.

◆ 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 41 of file utils.cpp.

Referenced by sdl_bad_at_rects(), and sdl::window::window().

Variable Documentation

◆ empty_rect

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