_________ __                 __
        /   _____//  |_____________ _/  |______     ____  __ __  ______
        \_____  \\   __\_  __ \__  \\   __\__  \   / ___\|  |  \/  ___/
        /        \|  |  |  | \// __ \|  |  / __ \_/ /_/  >  |  /\___ \
       /_______  /|__|  |__|  (____  /__| (____  /\___  /|____//____  >
               \/                  \/          \//_____/            \/
    ______________________                           ______________________
                          T H E   W A R   B E G I N S
                   Stratagus - A free fantasy real time strategy game engine

Classes
video.cpp File Reference
#include "stratagus.h"
#include <vector>
#include "video.h"
#include "intern_video.h"
#include "cursor.h"
#include "font.h"
#include "iolib.h"
#include "map.h"
#include "ui.h"
#include "SDL.h"
#include "SDL_image.h"

Classes

struct  Clip
 
class  CColorCycling
 

video.cpp - The universal video functions.

CVideo Video
 Do SDL hardware unlock. More...
 
char VideoForceFullScreen
 Fullscreen or windowed set from commandline. More...
 
double NextFrameTicks
 fullscreen set from commandline More...
 
unsigned long FrameCounter
 Ticks of begin of the next frame. More...
 
unsigned long SlowFrameCounter
 Current frame number. More...
 
int ClipX1
 Profile, frames out of sync. More...
 
int ClipY1
 current clipping top left More...
 
int ClipX2
 current clipping top left More...
 
int ClipY2
 current clipping bottom right More...
 
static std::vector< ClipClips
 current clipping bottom right More...
 
int VideoSyncSpeed = 100
 
int SkipFrames
 0 disable interrupts More...
 
Uint32 ColorBlack
 Skip this frames. More...
 
Uint32 ColorDarkGreen
 
Uint32 ColorLightBlue
 
Uint32 ColorBlue
 
Uint32 ColorOrange
 
Uint32 ColorWhite
 
Uint32 ColorLightGray
 
Uint32 ColorGray
 
Uint32 ColorDarkGray
 
Uint32 ColorRed
 
Uint32 ColorGreen
 
Uint32 ColorYellow
 
static unsigned int ColorCycleSpeed = CYCLES_PER_SECOND
 
void InitVideoSdl ()
 
void SdlLockScreen ()
 Init SDL video hardware driver. More...
 
void SdlUnlockScreen ()
 Do SDL hardware lock. More...
 
void SetClipping (int left, int top, int right, int bottom)
 
void PushClipping ()
 Push current clipping. More...
 
void PopClipping ()
 Pop current clipping. More...
 
unsigned long GetTicks ()
 Returns the ticks in ms since start. 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...
 
static int CclSetVideoSyncSpeed (lua_State *l)
 
void VideoCclRegister ()
 register lua function More...
 
void BlitSurfaceAlphaBlending_32bpp (const SDL_Surface *srcSurface, const SDL_Rect *srcRect, SDL_Surface *dstSurface, const SDL_Rect *dstRect, const bool enableMT)
 Blit a surface into another with alpha blending. More...
 
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 ColorCycleSurface (SDL_Surface &surface)
 
static void ColorCycleSurface_Reverse (SDL_Surface &surface, unsigned int count)
 
void ColorCycle ()
 Does ColorCycling.. More...
 
void RestoreColorCyclingSurface ()
 

Function Documentation

◆ AddColorCyclingRange()

void AddColorCyclingRange ( unsigned int  begin,
unsigned int  end 
)

◆ BlitSurfaceAlphaBlending_32bpp()

void BlitSurfaceAlphaBlending_32bpp ( const SDL_Surface *  srcSurface,
const SDL_Rect *  srcRect,
SDL_Surface *  dstSurface,
const SDL_Rect *  dstRect,
const bool  enableMT 
)

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

◆ CclSetVideoSyncSpeed()

static int CclSetVideoSyncSpeed ( lua_State *  l)
static

Set the video sync speed

Parameters
lLua state.

◆ ClearAllColorCyclingRange()

void ClearAllColorCyclingRange ( )

◆ ColorCycle()

void ColorCycle ( )

Does ColorCycling..

Color cycle.

MACRO defines speed of colorcycling FIXME: should be made configurable

◆ ColorCycleSurface()

void ColorCycleSurface ( SDL_Surface &  surface)

Color Cycle for particular surface

◆ ColorCycleSurface_Reverse()

static void ColorCycleSurface_Reverse ( SDL_Surface &  surface,
unsigned int  count 
)
static

Undo Color Cycle for particular surface

Note
function may be optimized.

◆ DeInitImageLoaders()

void DeInitImageLoaders ( )

deinitialize the image loaders

◆ DeInitVideo()

void DeInitVideo ( )

deinitliaize the video part

◆ GetTicks()

unsigned long GetTicks ( )

Returns the ticks in ms since start.

Return ticks in ms since start.

◆ InitImageLoaders()

void InitImageLoaders ( )

initialize the image loaders part

◆ InitVideo()

void InitVideo ( )

initialize the video part

Video initialize.

◆ InitVideoSdl()

void InitVideoSdl ( )

Initialize the video part for SDL.

◆ PopClipping()

void PopClipping ( )

Pop current clipping.

Pop current clipping.

◆ PushClipping()

void PushClipping ( )

Push current clipping.

Push current clipping.

◆ RestoreColorCyclingSurface()

void RestoreColorCyclingSurface ( )

◆ SdlLockScreen()

void SdlLockScreen ( )

Init SDL video hardware driver.

Lock the screen for write access.

◆ SdlUnlockScreen()

void SdlUnlockScreen ( )

Do SDL hardware lock.

Unlock the screen for write access.

◆ SetClipping()

void SetClipping ( int  left,
int  top,
int  right,
int  bottom 
)

Set clipping for graphic routines.

Parameters
leftLeft X screen coordinate.
topTop Y screen coordinate.
rightRight X screen coordinate.
bottomBottom Y screen coordinate.

◆ SetColorCycleAll()

void SetColorCycleAll ( bool  value)

◆ SetColorCycleSpeed()

unsigned int SetColorCycleSpeed ( unsigned int  speed)

Set the Color Cycle speed.

Returns
the previous speed

◆ VideoCclRegister()

void VideoCclRegister ( )

register lua function

◆ VideoPaletteListAdd()

void VideoPaletteListAdd ( SDL_Surface *  surface)

Add a surface to the palette list, used for color cycling

Parameters
surfaceThe SDL surface to add to the list to cycle.

◆ VideoPaletteListRemove()

void VideoPaletteListRemove ( SDL_Surface *  surface)

Remove a surface to the palette list, used for color cycling

Parameters
surfaceThe SDL surface to add to the list to cycle.

Variable Documentation

◆ Clips

std::vector<Clip> Clips
static

current clipping bottom right

◆ ClipX1

int ClipX1

Profile, frames out of sync.

◆ ClipX2

int ClipX2

current clipping top left

◆ ClipY1

int ClipY1

current clipping top left

◆ ClipY2

int ClipY2

current clipping bottom right

◆ ColorBlack

Uint32 ColorBlack

Skip this frames.

Editor callbacks.

◆ ColorBlue

Uint32 ColorBlue

◆ ColorCycleSpeed

unsigned int ColorCycleSpeed = CYCLES_PER_SECOND
static

◆ ColorDarkGray

Uint32 ColorDarkGray

◆ ColorDarkGreen

Uint32 ColorDarkGreen

◆ ColorGray

Uint32 ColorGray

◆ ColorGreen

Uint32 ColorGreen

◆ ColorLightBlue

Uint32 ColorLightBlue

◆ ColorLightGray

Uint32 ColorLightGray

◆ ColorOrange

Uint32 ColorOrange

◆ ColorRed

Uint32 ColorRed

◆ ColorWhite

Uint32 ColorWhite

◆ ColorYellow

Uint32 ColorYellow

◆ FrameCounter

unsigned long FrameCounter

Ticks of begin of the next frame.

Counts frames.

◆ NextFrameTicks

double NextFrameTicks

fullscreen set from commandline

Next frame ticks.

◆ SkipFrames

int SkipFrames

0 disable interrupts

◆ SlowFrameCounter

unsigned long SlowFrameCounter

Current frame number.

Counts quantity of slow frames.

◆ Video

CVideo Video

Do SDL hardware unlock.

◆ VideoForceFullScreen

char VideoForceFullScreen

Fullscreen or windowed set from commandline.

◆ VideoSyncSpeed

int VideoSyncSpeed = 100

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.

See also
CYCLES_PER_SECOND
(C) Copyright 1998-2012 by The Stratagus Project under the GNU General Public License.
All trademarks and copyrights on this page are owned by their respective owners.