_________ __ __ / _____// |_____________ _/ |______ ____ __ __ ______ \_____ \\ __\_ __ \__ \\ __\__ \ / ___\| | \/ ___/ / \| | | | \// __ \| | / __ \_/ /_/ > | /\___ \ /_______ /|__| |__| (____ /__| (____ /\___ /|____//____ > \/ \/ \//_____/ \/ ______________________ ______________________ T H E W A R B E G I N S Stratagus - A free fantasy real time strategy game engine
#include "SDL.h"
#include "shaders.h"
#include "guichan.h"
#include "color.h"
#include "vec2i.h"
#include <libmng.h>
Go to the source code of this file.
Classes | |
class | PixelModifier |
Class for modifiers for custom pixel manipulations. More... | |
class | CGraphic |
struct | CGraphic::frame_pos_t |
class | CPlayerColorGraphic |
class | Mng |
struct | EventCallback |
class | CVideo |
video.h - The video headerfile. | |
#define | RSHIFT 16 |
#define | GSHIFT 8 |
#define | BSHIFT 0 |
#define | ASHIFT 24 |
#define | RMASK 0x00ff0000 |
#define | GMASK 0x0000ff00 |
#define | BMASK 0x000000ff |
#define | AMASK 0xff000000 |
using | pixelModifier = uint32_t(*)(const uint32_t, const uint32_t, const uint32_t) |
SDL_Window * | TheWindow |
The SDL screen. More... | |
SDL_Renderer * | TheRenderer |
Internal screen. More... | |
SDL_Surface * | TheScreen |
Internal screen. More... | |
SDL_Texture * | TheTexture |
Internal screen. More... | |
CVideo | Video |
Do SDL hardware unlock. More... | |
int | VideoSyncSpeed |
int | SkipFrames |
0 disable interrupts More... | |
char | VideoForceFullScreen |
Fullscreen or windowed set from commandline. More... | |
double | NextFrameTicks |
Next frame ticks. More... | |
unsigned long | FrameCounter |
Counts frames. More... | |
unsigned long | SlowFrameCounter |
Counts quantity of slow frames. More... | |
EventCallback | GameCallbacks |
EventCallback | EditorCallbacks |
Game callbacks. More... | |
Uint32 | ColorBlack |
Editor callbacks. More... | |
Uint32 | ColorDarkGreen |
Uint32 | ColorLightBlue |
Uint32 | ColorBlue |
Uint32 | ColorOrange |
Uint32 | ColorWhite |
Uint32 | ColorLightGray |
Uint32 | ColorGray |
Uint32 | ColorDarkGray |
Uint32 | ColorRed |
Uint32 | ColorGreen |
Uint32 | ColorYellow |
static const char * | ColorNames [] |
void | SetPlayersPalette () |
void | VideoCclRegister () |
register lua function More... | |
void | InitImageLoaders () |
initialize the image loaders part More... | |
void | DeInitImageLoaders () |
deinitialize the image loaders More... | |
void | InitVideo () |
initialize the video part More... | |
void | DeInitVideo () |
deinitliaize the video part More... | |
int | VideoValidResolution (int w, int h) |
Check if a resolution is valid. More... | |
void | SetVideoSync () |
Initializes video synchronization. More... | |
void | InitLineDraw () |
Init line draw. More... | |
void | Invalidate () |
Simply invalidates whole window or screen. More... | |
void | InvalidateArea (int x, int y, int w, int h) |
void | SetClipping (int left, int top, int right, int bottom) |
void | RealizeVideoMemory () |
Realize video memory. More... | |
void | SaveScreenshotPNG (const char *name) |
Save a screenshot to a PNG file. More... | |
void | SaveMapPNG (const char *name) |
Save a screenshot to a PNG file. More... | |
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... | |
void | ToggleFullScreen () |
Toggle full screen mode. More... | |
void | PushClipping () |
Push current clipping. More... | |
void | PopClipping () |
Pop current clipping. More... | |
unsigned long | GetTicks () |
Returns the ticks in ms since start. More... | |
const char * | SdlKey2Str (int key) |
Convert a SDLKey to a string. More... | |
bool | SdlGetGrabMouse () |
Check if the mouse is grabbed. More... | |
void | ToggleGrabMouse (int mode) |
Toggle mouse grab mode. More... | |
Uint32 | IndexToColor (unsigned int index) |
int | GetColorIndexByName (const char *colorName) |
void | FreeGraphics () |
void | VideoPaletteListAdd (SDL_Surface *surface) |
void | VideoPaletteListRemove (SDL_Surface *surface) |
void | ClearAllColorCyclingRange () |
void | AddColorCyclingRange (unsigned int begin, unsigned int end) |
unsigned int | SetColorCycleSpeed (unsigned int speed) |
void | SetColorCycleAll (bool value) |
void | RestoreColorCyclingSurface () |
void | ColorCycle () |
Does ColorCycling.. More... | |
void | BlitSurfaceAlphaBlending_32bpp (const SDL_Surface *srcSurface, const SDL_Rect *srcRect, SDL_Surface *dstSurface, const SDL_Rect *dstRect, const bool enableMT=true) |
Blit a surface into another with alpha blending. More... | |
#define AMASK 0xff000000 |
#define ASHIFT 24 |
#define BMASK 0x000000ff |
#define BSHIFT 0 |
#define GMASK 0x0000ff00 |
#define GSHIFT 8 |
#define RMASK 0x00ff0000 |
#define RSHIFT 16 |
using pixelModifier = uint32_t(*)(const uint32_t, const uint32_t, const uint32_t) |
void AddColorCyclingRange | ( | unsigned int | begin, |
unsigned int | end | ||
) |
void BlitSurfaceAlphaBlending_32bpp | ( | const SDL_Surface * | srcSurface, |
const SDL_Rect * | srcRect, | ||
SDL_Surface * | dstSurface, | ||
const SDL_Rect * | dstRect, | ||
const bool | enableMT = true |
||
) |
Blit a surface into another with alpha blending.
This implementation of blittind doesn't scale
Crop rectangles if necessary
Alpha blending of the src texture into the dst
TODO: change numOfThreads for small rectangles to prevent False Sharing
pragma omp parallel
void ClearAllColorCyclingRange | ( | ) |
void ColorCycle | ( | ) |
Does ColorCycling..
Color cycle.
MACRO defines speed of colorcycling FIXME: should be made configurable
void DeInitImageLoaders | ( | ) |
deinitialize the image loaders
void DeInitVideo | ( | ) |
deinitliaize the video part
void FreeGraphics | ( | ) |
const EventCallback* GetCallbacks | ( | ) |
Get the current callbacks.
Get the current callbacks
|
inline |
unsigned long GetTicks | ( | ) |
Returns the ticks in ms since start.
Return ticks in ms since start.
|
inline |
void InitImageLoaders | ( | ) |
initialize the image loaders part
void InitLineDraw | ( | ) |
Init line draw.
Initialize line draw
void InitVideo | ( | ) |
initialize the video part
Video initialize.
void Invalidate | ( | ) |
Simply invalidates whole window or screen.
Invalidate whole window
void InvalidateArea | ( | int | x, |
int | y, | ||
int | w, | ||
int | h | ||
) |
Invalidates selected area on window or screen. Use for accurate redrawing. in so
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. |
void PopClipping | ( | ) |
Pop current clipping.
Pop current clipping.
void PushClipping | ( | ) |
Push current clipping.
Push current clipping.
void RealizeVideoMemory | ( | ) |
Realize video memory.
void RestoreColorCyclingSurface | ( | ) |
void SaveMapPNG | ( | const char * | name | ) |
Save a screenshot to a PNG file.
Save a whole map to a PNG file.
name | PNG filename to save. |
void SaveScreenshotPNG | ( | const char * | name | ) |
Save a screenshot to a PNG file.
Save a screenshot to a PNG file.
name | PNG filename to save. |
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 SetCallbacks | ( | const EventCallback * | callbacks | ) |
Set the current callbacks.
Set the current callbacks
void SetClipping | ( | int | left, |
int | top, | ||
int | right, | ||
int | bottom | ||
) |
Set clipping for nearly all vector primitives. Functions which support clipping will be marked Clip. Set the system-wide clipping rectangle.
Set clipping for graphic routines.
left | Left X screen coordinate. |
top | Top Y screen coordinate. |
right | Right X screen coordinate. |
bottom | Bottom Y screen coordinate. |
void SetColorCycleAll | ( | bool | value | ) |
unsigned int SetColorCycleSpeed | ( | unsigned int | speed | ) |
Set the Color Cycle speed.
void SetPlayersPalette | ( | ) |
Initialize Pixels[] for all players. (bring Players[] in sync with Pixels[])
Setup the player colors for the current palette.
void SetVideoSync | ( | ) |
Initializes video synchronization.
Initialise video sync. Calculate the length of video frame and any simulation skips.
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. |
void VideoCclRegister | ( | ) |
register lua function
void VideoPaletteListAdd | ( | SDL_Surface * | surface | ) |
Add a surface to the palette list, used for color cycling
surface | The SDL surface to add to the list to cycle. |
void VideoPaletteListRemove | ( | SDL_Surface * | surface | ) |
Remove a surface to the palette list, used for color cycling
surface | The SDL surface to add to the list to cycle. |
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.
Uint32 ColorBlack |
Editor callbacks.
Editor callbacks.
Uint32 ColorBlue |
Uint32 ColorDarkGray |
Uint32 ColorDarkGreen |
Uint32 ColorGray |
Uint32 ColorGreen |
Uint32 ColorLightBlue |
Uint32 ColorLightGray |
|
static |
Uint32 ColorOrange |
Uint32 ColorRed |
Uint32 ColorWhite |
Uint32 ColorYellow |
EventCallback EditorCallbacks |
Game callbacks.
unsigned long FrameCounter |
Counts frames.
Counts frames.
EventCallback GameCallbacks |
double NextFrameTicks |
Next frame ticks.
Next frame ticks.
int SkipFrames |
0 disable interrupts
unsigned long SlowFrameCounter |
Counts quantity of slow frames.
Counts quantity of slow frames.
SDL_Renderer* TheRenderer |
Internal screen.
SDL_Surface* TheScreen |
Internal screen.
SDL_Texture* TheTexture |
Internal screen.
SDL_Window* TheWindow |
The SDL screen.
CVideo Video |
Do SDL hardware unlock.
char VideoForceFullScreen |
Fullscreen or windowed set from commandline.
int VideoSyncSpeed |
Video synchronization speed. Synchronization time in percent. If =0, video framerate is not synchronized. 100 is exact CYCLES_PER_SECOND (30). Game will try to redraw screen within intervals of VideoSyncSpeed, not more, not less.