OpenTTD Source 20241224-master-gee860a5c8e
sdl_v.cpp File Reference

Implementation of the SDL video driver. More...

#include "../stdafx.h"
#include "../openttd.h"
#include "../error_func.h"
#include "../gfx_func.h"
#include "../blitter/factory.hpp"
#include "../thread.h"
#include "../progress.h"
#include "../core/random_func.hpp"
#include "../core/math_func.hpp"
#include "../fileio_func.h"
#include "../framerate_type.h"
#include "../window_func.h"
#include "sdl_v.h"
#include <SDL.h>
#include "../safeguards.h"

Go to the source code of this file.

Data Structures

struct  SDLVkMapping
 

Macros

#define MAX_DIRTY_RECTS   100
 
#define AS(x, z)   {x, x, z, z}
 
#define AM(x, y, z, w)   {x, y, z, w}
 

Functions

static void UpdatePalette (bool init=false)
 
static void InitPalette ()
 
static void GetVideoModes ()
 
static void GetAvailableVideoMode (uint *w, uint *h)
 
static uint ConvertSdlKeyIntoMy (SDL_keysym *sym, char32_t *character)
 

Variables

static FVideoDriver_SDL iFVideoDriver_SDL
 
static SDL_Surface * _sdl_surface
 
static SDL_Surface * _sdl_realscreen
 
static bool _all_modes
 
static Palette _local_palette
 
static SDL_Rect _dirty_rects [MAX_DIRTY_RECTS]
 
static int _num_dirty_rects
 
static int _use_hwpalette
 
static int _requested_hwpalette
 
static const Dimension _default_resolutions []
 
static constexpr SDLVkMapping _vk_mapping []
 

Detailed Description

Implementation of the SDL video driver.

Definition in file sdl_v.cpp.

Macro Definition Documentation

◆ AM

#define AM (   x,
  y,
  z,
 
)    {x, y, z, w}

Definition at line 388 of file sdl_v.cpp.

◆ AS

#define AS (   x,
 
)    {x, x, z, z}

Definition at line 387 of file sdl_v.cpp.

◆ MAX_DIRTY_RECTS

#define MAX_DIRTY_RECTS   100

Definition at line 37 of file sdl_v.cpp.

Function Documentation

◆ ConvertSdlKeyIntoMy()

static uint ConvertSdlKeyIntoMy ( SDL_keysym *  sym,
char32_t *  character 
)
static

Definition at line 442 of file sdl_v.cpp.

◆ GetAvailableVideoMode()

static void GetAvailableVideoMode ( uint *  w,
uint *  h 
)
static

Definition at line 203 of file sdl_v.cpp.

◆ GetVideoModes()

static void GetVideoModes ( )
static

Definition at line 176 of file sdl_v.cpp.

◆ InitPalette()

static void InitPalette ( )
static

Definition at line 107 of file sdl_v.cpp.

◆ UpdatePalette()

static void UpdatePalette ( bool  init = false)
static

Definition at line 54 of file sdl_v.cpp.

Variable Documentation

◆ _all_modes

bool _all_modes
static

Definition at line 33 of file sdl_v.cpp.

◆ _default_resolutions

const Dimension _default_resolutions[]
static
Initial value:
= {
{ 640, 480},
{ 800, 600},
{1024, 768},
{1152, 864},
{1280, 800},
{1280, 960},
{1280, 1024},
{1400, 1050},
{1600, 1200},
{1680, 1050},
{1920, 1200}
}

Definition at line 162 of file sdl_v.cpp.

◆ _dirty_rects

SDL_Rect _dirty_rects[MAX_DIRTY_RECTS]
static

Definition at line 38 of file sdl_v.cpp.

◆ _local_palette

Palette _local_palette
static

Definition at line 35 of file sdl_v.cpp.

◆ _num_dirty_rects

int _num_dirty_rects
static

Definition at line 39 of file sdl_v.cpp.

◆ _requested_hwpalette

int _requested_hwpalette
static

Definition at line 41 of file sdl_v.cpp.

◆ _sdl_realscreen

SDL_Surface* _sdl_realscreen
static

Definition at line 32 of file sdl_v.cpp.

◆ _sdl_surface

SDL_Surface* _sdl_surface
static

Definition at line 31 of file sdl_v.cpp.

◆ _use_hwpalette

int _use_hwpalette
static

Definition at line 40 of file sdl_v.cpp.

◆ _vk_mapping

constexpr SDLVkMapping _vk_mapping[]
staticconstexpr

Definition at line 390 of file sdl_v.cpp.

◆ iFVideoDriver_SDL

FVideoDriver_SDL iFVideoDriver_SDL
static

Definition at line 29 of file sdl_v.cpp.