The Battle for Wesnoth  1.19.5+dev
Namespaces | Macros | Functions | Variables
video.cpp File Reference
#include "video.hpp"
#include "draw_manager.hpp"
#include "font/text.hpp"
#include "log.hpp"
#include "picture.hpp"
#include "preferences/preferences.hpp"
#include "sdl/point.hpp"
#include "sdl/texture.hpp"
#include "sdl/utils.hpp"
#include "sdl/window.hpp"
#include <SDL2/SDL_render.h>
#include <cassert>
#include <vector>
Include dependency graph for video.cpp:

Go to the source code of this file.

Namespaces

 video
 

Macros

#define LOG_DP   LOG_STREAM(info, log_display)
 
#define ERR_DP   LOG_STREAM(err, log_display)
 
#define WRN_DP   LOG_STREAM(warn, log_display)
 
#define DBG_DP   LOG_STREAM(debug, log_display)
 

Functions

void video::render_screen ()
 
static void video::init_window (bool hidden=false)
 
static void video::init_test_window ()
 
static void video::init_fake ()
 
static void video::init_test ()
 
static bool video::update_framebuffer ()
 
static bool video::update_test_framebuffer ()
 Returns true if the buffer was changed. More...
 
static point video::draw_offset ()
 
void video::init (fake fake_type=fake::none)
 Initialize the video subsystem. More...
 
void video::deinit ()
 Deinitialize the video subsystem. More...
 
bool video::headless ()
 The game is running headless. More...
 
bool video::testing ()
 The game is running unit tests. More...
 
bool video::has_window ()
 Whether the game has set up a window to render into. More...
 
point video::output_size ()
 Returns the size of the final render target. More...
 
point video::window_size ()
 Returns the size of the window in display units / screen coordinates. More...
 
rect video::game_canvas ()
 The game canvas area, in drawing coordinates. More...
 
point video::game_canvas_size ()
 The size of the game canvas, in drawing coordinates / game pixels. More...
 
point video::draw_size ()
 The size of the current render target in drawing coordinates. More...
 
rect video::draw_area ()
 The current drawable area. More...
 
rect video::output_area ()
 {0, 0, output_size().x, output_size().y} More...
 
rect video::to_output (const rect &draw_space_rect)
 Convert coordinates in draw space to coordinates in render space. More...
 
rect video::input_area ()
 Returns the input area of the window, in display coordinates. More...
 
int video::get_pixel_scale ()
 Get the current active pixel scale multiplier. More...
 
int video::current_refresh_rate ()
 The refresh rate of the screen. More...
 
void video::force_render_target (const texture &t)
 Set the render target, without any provided way of setting it back. More...
 
void video::clear_render_target ()
 Reset the render target to the main window / screen. More...
 
void video::reset_render_target ()
 Reset the render target to the primary render buffer. More...
 
texture video::get_render_target ()
 Get the current render target. More...
 
surface video::read_pixels (SDL_Rect *r=nullptr)
 Copy back a portion of the render target that is already drawn. More...
 
surface video::read_pixels_low_res (SDL_Rect *r=nullptr)
 The same as read_pixels, but returns a low-resolution surface suitable for use with the old drawing system. More...
 
void video::set_window_title (const std::string &title)
 Sets the title of the main window. More...
 
void video::set_window_icon (surface &icon)
 Sets the icon of the main window. More...
 
SDL_Renderer * video::get_renderer ()
 
SDL_Window * video::get_window ()
 
std::string video::current_driver ()
 The current video driver in use, or else "<not initialized>". More...
 
std::vector< std::string > video::enumerate_drivers ()
 A list of available video drivers. More...
 
static bool video::window_has_flags (uint32_t flags)
 Tests whether the given flags are currently set on the SDL window. More...
 
bool video::window_is_visible ()
 True iff the window is not hidden. More...
 
bool video::window_has_focus ()
 True iff the window has mouse or input focus. More...
 
bool video::window_has_mouse_focus ()
 True iff the window has mouse focus. More...
 
std::vector< pointvideo::get_available_resolutions (bool include_current=false)
 Returns the list of available screen resolutions. More...
 
point video::current_resolution ()
 The current window size in desktop coordinates. More...
 
bool video::is_fullscreen ()
 Whether we are currently in fullscreen mode. More...
 
void video::set_fullscreen (bool)
 Set the fullscreen state. More...
 
void video::toggle_fullscreen ()
 Toggle fullscreen mode. More...
 
bool video::set_resolution (const point &resolution)
 Set the window resolution. More...
 
void video::update_buffers (bool autoupdate=true)
 Update buffers to match current resolution and pixel scale settings. More...
 
std::pair< float, float > video::get_dpi ()
 Retrieves the current game screen DPI for the build_info API. More...
 
std::vector< std::pair< std::string, std::string > > video::renderer_report ()
 Provides diagnostic information about the current renderer for the build_info API. More...
 

Variables

static lg::log_domain log_display ("display")
 

Macro Definition Documentation

◆ DBG_DP

#define DBG_DP   LOG_STREAM(debug, log_display)

Definition at line 42 of file video.cpp.

◆ ERR_DP

#define ERR_DP   LOG_STREAM(err, log_display)

Definition at line 40 of file video.cpp.

◆ LOG_DP

#define LOG_DP   LOG_STREAM(info, log_display)

Definition at line 39 of file video.cpp.

◆ WRN_DP

#define WRN_DP   LOG_STREAM(warn, log_display)

Definition at line 41 of file video.cpp.

Variable Documentation

◆ log_display

lg::log_domain log_display("display") ( "display"  )
static