_________ __ __ / _____// |_____________ _/ |______ ____ __ __ ______ \_____ \\ __\_ __ \__ \\ __\__ \ / ___\| | \/ ___/ / \| | | | \// __ \| | / __ \_/ /_/ > | /\___ \ /_______ /|__| |__| (____ /__| (____ /\___ /|____//____ > \/ \/ \//_____/ \/ ______________________ ______________________ T H E W A R B E G I N S Stratagus - A free fantasy real time strategy game engine
#include "stratagus.h"
#include "online_service.h"
#include <map>
#include <string>
#include <vector>
#include <limits.h>
#include <math.h>
#include "SDL.h"
#include "SDL_syswm.h"
#include <sys/socket.h>
#include <shellapi.h>
#include "editor.h"
#include "font.h"
#include "game.h"
#include "interface.h"
#include "minimap.h"
#include "network.h"
#include "parameters.h"
#include "sound.h"
#include "sound_server.h"
#include "translate.h"
#include "ui.h"
#include "unit.h"
#include "video.h"
#include "widgets.h"
sdl.cpp - SDL video support. | |
enum | PROCESS_DPI_AWARENESS { PROCESS_DPI_UNAWARE = 0, PROCESS_SYSTEM_DPI_AWARE = 1, PROCESS_PER_MONITOR_DPI_AWARE = 2 } |
typedef enum PROCESS_DPI_AWARENESS | PROCESS_DPI_AWARENESS |
SDL_Window * | TheWindow |
The SDL screen. More... | |
SDL_Renderer * | TheRenderer = NULL |
Internal screen. More... | |
SDL_Texture * | TheTexture |
Internal screen. More... | |
SDL_Surface * | TheScreen |
Internal screen. More... | |
static SDL_Rect | Rects [100] |
Internal screen. More... | |
static int | NumRects |
static std::map< int, std::string > | Key2Str |
static std::map< std::string, int > | Str2Key |
double | FrameTicks |
const EventCallback * | Callbacks |
Frame length in ms. More... | |
bool | IsSDLWindowVisible = true |
Flag telling if the SDL window is visible. More... | |
uint8_t | SizeChangeCounter = 0 |
Just a counter to cache window data on in other places when the size changes. More... | |
static bool | dummyRenderer = false |
uint32_t | SDL_CUSTOM_KEY_UP |
static Uint32 | LastTick = 0 |
static int | RefreshRate = 0 |
void | SetVideoSync () |
Initializes video synchronization. More... | |
static void | InitKey2Str () |
static void | setDpiAware () |
void | InitVideoSdl () |
int | VideoValidResolution (int w, int h) |
Check if a resolution is valid. More... | |
void | InvalidateArea (int x, int y, int w, int h) |
void | Invalidate () |
Simply invalidates whole window or screen. More... | |
static bool | isTextInput (int key) |
static void | SdlDoEvent (const EventCallback &callbacks, SDL_Event &event) |
void | SetCallbacks (const EventCallback *callbacks) |
Set the current callbacks. More... | |
const EventCallback * | GetCallbacks () |
Get the current callbacks. More... | |
void | WaitEventsOneFrame () |
Process all system events. Returns if the time for a frame is over. More... | |
static void | RenderBenchmarkOverlay () |
void | RealizeVideoMemory () |
Realize video memory. More... | |
void | SdlLockScreen () |
Init SDL video hardware driver. More... | |
void | SdlUnlockScreen () |
Do SDL hardware lock. More... | |
const char * | SdlKey2Str (int key) |
Convert a SDLKey to a string. More... | |
int | Str2SdlKey (const char *str) |
bool | SdlGetGrabMouse () |
Check if the mouse is grabbed. More... | |
void | ToggleGrabMouse (int mode) |
Toggle mouse grab mode. More... | |
void | ToggleFullScreen () |
Toggle full screen mode. More... | |
typedef enum PROCESS_DPI_AWARENESS PROCESS_DPI_AWARENESS |
const EventCallback* GetCallbacks | ( | ) |
Get the current callbacks.
Get the current callbacks
|
static |
Initialize SDLKey to string map
void InitVideoSdl | ( | ) |
Initialize the video part for SDL.
void Invalidate | ( | ) |
Simply invalidates whole window or screen.
Invalidate whole window
void InvalidateArea | ( | int | x, |
int | y, | ||
int | w, | ||
int | h | ||
) |
Invalidate some area
x | screen pixel X position. |
y | screen pixel Y position. |
w | width of rectangle in pixels. |
h | height of rectangle in pixels. |
|
static |
void RealizeVideoMemory | ( | ) |
Realize video memory.
|
static |
|
static |
Handle interactive input event.
callbacks | Callback structure for events. |
event | SDL event structure pointer. |
bool SdlGetGrabMouse | ( | ) |
Check if the mouse is grabbed.
Check if the mouse is grabbed
const char* SdlKey2Str | ( | int | key | ) |
Convert a SDLKey to a string.
Convert a SDLKey to a string
void SdlLockScreen | ( | ) |
Init SDL video hardware driver.
Lock the screen for write access.
void SdlUnlockScreen | ( | ) |
Do SDL hardware lock.
Unlock the screen for write access.
void SetCallbacks | ( | const EventCallback * | callbacks | ) |
Set the current callbacks.
Set the current callbacks
|
static |
void SetVideoSync | ( | ) |
Initializes video synchronization.
Initialise video sync. Calculate the length of video frame and any simulation skips.
int Str2SdlKey | ( | const char * | str | ) |
Convert a string to SDLKey
void ToggleFullScreen | ( | ) |
Toggle full screen mode.
Toggle full screen mode.
void ToggleGrabMouse | ( | int | mode | ) |
Toggle mouse grab mode.
Toggle grab mouse.
mode | Wanted mode, 1 grab, -1 not grab, 0 toggle. |
int VideoValidResolution | ( | int | w, |
int | h | ||
) |
Check if a resolution is valid.
Check if a resolution is valid
w | Width |
h | Height |
void WaitEventsOneFrame | ( | ) |
Process all system events. Returns if the time for a frame is over.
Wait for interactive input event for one frame.
Handles system events, joystick, keyboard, mouse. Handles the network messages. Handles the sound queue.
All events available are fetched. Sound and network only if available. Returns if the time for one frame is over.
const EventCallback* Callbacks |
Frame length in ms.
|
static |
double FrameTicks |
bool IsSDLWindowVisible = true |
Flag telling if the SDL window is visible.
|
static |
|
static |
Realize video memory.
|
static |
|
static |
Internal screen.
|
static |
uint32_t SDL_CUSTOM_KEY_UP |
uint8_t SizeChangeCounter = 0 |
Just a counter to cache window data on in other places when the size changes.
|
static |
SDL_Renderer* TheRenderer = NULL |
Internal screen.
SDL_Surface* TheScreen |
Internal screen.
SDL_Texture* TheTexture |
Internal screen.
SDL_Window* TheWindow |
The SDL screen.