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

Contains the SDL_Rect helper code. More...

#include "sdl/point.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.




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...
SDL_Rect sdl::create_rect (const point &origin, const point &size)
 Creates a rectangle. 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...
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)


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 67 of file rect.cpp.

References operator==().

Referenced by sdl::create_rect().

◆ operator<<()

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

Definition at line 72 of file rect.cpp.

References s.

Referenced by sdl::create_rect().

◆ operator==()

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

Definition at line 62 of file rect.cpp.

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