|
OpenTTD Source 20260704-master-gbf70c61fb8
|
Implementation of the SDL2 video driver. More...
#include "../stdafx.h"#include "../openttd.h"#include "../gfx_func.h"#include "../blitter/factory.hpp"#include "../thread.h"#include "../progress.h"#include "../core/math_func.hpp"#include "../core/geometry_func.hpp"#include "../core/utf8.hpp"#include "../fileio_func.h"#include "../framerate_type.h"#include "../window_func.h"#include "sdl2_v.h"#include <SDL.h>#include "../safeguards.h"Go to the source code of this file.
Data Structures | |
| struct | SDLVkMapping |
| Mapping from keycodes in the SDL world to OpenTTD's world. More... | |
Functions | |
| static void | FindResolutions () |
Find and store all possible resolutions into _resolutions. | |
| static void | GetAvailableVideoMode (uint *w, uint *h) |
| Get the best resolution given the requested width and height. | |
| static uint | FindStartupDisplay (uint startup_display) |
| Find the display we want to start OpenTTD on. | |
| static uint | ConvertSdlKeyIntoMy (SDL_Keysym *sym, char32_t *character) |
| Convert the SDL key into our WindowKeyCode and the printable character (if any). | |
| static uint | ConvertSdlKeycodeIntoMy (SDL_Keycode kc) |
| Convert a SDL_Keycode into our own key codes. | |
| static std::optional< std::string_view > | InitializeSDL () |
| Initialize the SDL backend if needed. | |
Variables | |
| static const Dimension | _default_resolutions [] |
| Set of common resolutions that can be used as default when none is provided by SDL. | |
| static constexpr SDLVkMapping | _vk_mapping [] |
| Mapping of SDL keycodes to WKC. | |
Implementation of the SDL2 video driver.
Definition in file sdl2_v.cpp.
|
static |
Convert a SDL_Keycode into our own key codes.
| kc | The SDL key code. |
Definition at line 398 of file sdl2_v.cpp.
References IsInsideBS().
Referenced by VideoDriver_SDL_Base::PollEvent().
|
static |
Convert the SDL key into our WindowKeyCode and the printable character (if any).
| sym | The keyboard event. | |
| [out] | character | The pressed character (or '\0' when no character was pressed). |
Definition at line 358 of file sdl2_v.cpp.
References IsInsideBS().
Referenced by VideoDriver_SDL_Base::PollEvent().
|
static |
Find and store all possible resolutions into _resolutions.
Definition at line 59 of file sdl2_v.cpp.
References _default_resolutions, and _resolutions.
Referenced by VideoDriver_SDL_Base::Initialize().
|
static |
Find the display we want to start OpenTTD on.
| startup_display | The user preferred display, MAX_UINT32 when not given. |
Definition at line 114 of file sdl2_v.cpp.
References Debug, and IsInsideBS().
Referenced by VideoDriver_SDL_Base::Start().
|
static |
Get the best resolution given the requested width and height.
| [in,out] | w | The requested width, updated with the best fit. |
| [in,out] | h | The requested height, updated with the best fit. |
Definition at line 87 of file sdl2_v.cpp.
References _resolutions, and Delta().
Referenced by VideoDriver_SDL_Base::CreateMainSurface().
|
static |
Initialize the SDL backend if needed.
Definition at line 573 of file sdl2_v.cpp.
Referenced by VideoDriver_SDL_Base::Initialize().
|
static |
Set of common resolutions that can be used as default when none is provided by SDL.
Definition at line 44 of file sdl2_v.cpp.
|
staticconstexpr |
Mapping of SDL keycodes to WKC.
Definition at line 299 of file sdl2_v.cpp.