The Battle for Wesnoth  1.15.2+dev
Namespaces | Functions | Variables
rect.hpp File Reference

Contains the SDL_Rect helper code. More...

#include "utils.hpp"
#include <SDL2/SDL_rect.h>
Include dependency graph for rect.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

 sdl
 

Functions

SDL_Rect sdl::create_rect (const int x, const int y, const int w, const int h)
 Creates an SDL_Rect with the given dimensions. More...
 
bool sdl::point_in_rect (int x, int y, const SDL_Rect &rect)
 Tests whether a point is inside a rectangle. More...
 
bool sdl::point_in_rect (const point &point, const SDL_Rect &rect)
 
bool sdl::rects_overlap (const SDL_Rect &rect1, const SDL_Rect &rect2)
 Tests whether two rectangles overlap. More...
 
SDL_Rect sdl::intersect_rects (const SDL_Rect &rect1, const SDL_Rect &rect2)
 Calculates the intersection of two rectangles. More...
 
SDL_Rect sdl::union_rects (const SDL_Rect &rect1, const SDL_Rect &rect2)
 Calculates the union of two rectangles. More...
 
void sdl::draw_rectangle (const SDL_Rect &rect, const color_t &color)
 Draw a rectangle outline. More...
 
void sdl::fill_rectangle (const SDL_Rect &rect, const color_t &color)
 Draws a filled rectangle. More...
 
void sdl::fill_surface_rect (surface &dst, SDL_Rect *dst_rect, const uint32_t color)
 Fill a rectangle on a given surface. More...
 
bool operator== (const SDL_Rect &a, const SDL_Rect &b)
 
bool operator!= (const SDL_Rect &a, const SDL_Rect &b)
 
std::ostream & operator<< (std::ostream &s, const SDL_Rect &rect)
 

Variables

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

Detailed Description

Contains the SDL_Rect helper code.

Definition in file rect.hpp.

Function Documentation

◆ operator!=()

bool operator!= ( const SDL_Rect &  a,
const SDL_Rect &  b 
)

Definition at line 80 of file rect.cpp.

References operator==().

Referenced by sdl::fill_surface_rect().

◆ operator<<()

std::ostream& operator<< ( std::ostream &  s,
const SDL_Rect &  rect 
)

Definition at line 85 of file rect.cpp.

References s.

Referenced by sdl::fill_surface_rect().

◆ operator==()

bool operator== ( const SDL_Rect &  a,
const SDL_Rect &  b 
)

Definition at line 75 of file rect.cpp.

Referenced by sdl::fill_surface_rect(), and operator!=().