$treeview $search $mathjax
Stratagus
2.2.7
$projectbrief
|
$projectbrief
|
$searchbox |
_________ __ __ / _____// |_____________ _/ |______ ____ __ __ ______ \_____ \\ __\_ __ \__ \\ __\__ \ / ___\| | \/ ___/ / \| | | | \// __ \| | / __ \_/ /_/ > | /\___ \ /_______ /|__| |__| (____ /__| (____ /\___ /|____//____ > \/ \/ \//_____/ \/ ______________________ ______________________ 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 "SDL_gles.h"
#include "GLES/gl.h"
#include "guichan.h"
#include "color.h"
#include "vec2i.h"
#include <libmng.h>
Go to the source code of this file.
Classes | |
class | CGraphic |
struct | CGraphic::frame_pos_t |
class | CPlayerColorGraphic |
class | Mng |
struct | EventCallback |
class | CVideo |
video.h - The video headerfile. | |
#define | RSHIFT 0 |
#define | GSHIFT 8 |
#define | BSHIFT 16 |
#define | ASHIFT 24 |
#define | RMASK 0x000000ff |
#define | GMASK 0x0000ff00 |
#define | BMASK 0x00ff0000 |
#define | AMASK 0xff000000 |
char | ForceUseOpenGL |
bool | UseOpenGL |
CVideo | Video |
Do SDL hardware unlock. | |
int | VideoSyncSpeed |
int | SkipFrames |
0 disable interrupts | |
char | VideoForceFullScreen |
Fullscreen or windowed set from commandline. | |
unsigned long | NextFrameTicks |
Next frame ticks. | |
unsigned long | FrameCounter |
Counts frames. | |
int | SlowFrameCounter |
Counts quantity of slow frames. | |
SDL_Surface * | TheScreen |
The SDL screen. | |
GLint | GLMaxTextureSize |
Max texture size supported on the video card. | |
GLint | GLMaxTextureSizeOverride |
User-specified limit for GLMaxTextureSize. | |
bool | GLTextureCompressionSupported |
Is OpenGL texture compression supported. | |
bool | UseGLTextureCompression |
Use OpenGL texture compression. | |
EventCallback | GameCallbacks |
EventCallback | EditorCallbacks |
Game callbacks. | |
Uint32 | ColorBlack |
Editor callbacks. | |
Uint32 | ColorDarkGreen |
Uint32 | ColorBlue |
Uint32 | ColorOrange |
Uint32 | ColorWhite |
Uint32 | ColorGray |
Uint32 | ColorRed |
Uint32 | ColorGreen |
Uint32 | ColorYellow |
void | SetPlayersPalette () |
void | VideoCclRegister () |
register lua function | |
void | InitVideo () |
initialize the video part | |
void | DeInitVideo () |
deinitliaize the video part | |
int | VideoValidResolution (int w, int h) |
Check if a resolution is valid. | |
int | LoadGraphicPNG (CGraphic *g) |
Load graphic from PNG file. | |
void | MakeTexture (CGraphic *graphic) |
Make an OpenGL texture. | |
void | MakePlayerColorTexture (CPlayerColorGraphic *graphic, int player) |
Make an OpenGL texture of the player color pixels only. | |
void | ValidateOpenGLScreen () |
Regenerate Window screen if needed. | |
void | FreeOpenGLGraphics () |
Free OpenGL graphics. | |
void | ReloadGraphics () |
Reload OpenGL graphics. | |
void | ReloadOpenGL () |
Reload OpenGL. | |
void | SetVideoSync () |
Initializes video synchronization. | |
void | InitLineDraw () |
Init line draw. | |
void | Invalidate () |
Simply invalidates whole window or screen. | |
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. | |
void | SaveScreenshotPNG (const char *name) |
Save a screenshot to a PNG file. | |
void | SetCallbacks (const EventCallback *callbacks) |
Set the current callbacks. | |
const EventCallback * | GetCallbacks () |
Get the current callbacks. | |
void | WaitEventsOneFrame () |
Process all system events. Returns if the time for a frame is over. | |
void | ToggleFullScreen () |
Toggle full screen mode. | |
void | PushClipping () |
Push current clipping. | |
void | PopClipping () |
Pop current clipping. | |
unsigned long | GetTicks () |
Returns the ticks in ms since start. | |
const char * | SdlKey2Str (int key) |
Convert a SDLKey to a string. | |
bool | SdlGetGrabMouse () |
Check if the mouse is grabbed. | |
void | ToggleGrabMouse (int mode) |
Toggle mouse grab mode. | |
void | DrawTexture (const CGraphic *g, GLuint *textures, int sx, int sy, int ex, int ey, int x, int y, int flip) |
void | VideoPaletteListAdd (SDL_Surface *surface) |
void | VideoPaletteListRemove (SDL_Surface *surface) |
void | ClearAllColorCyclingRange () |
void | AddColorCyclingRange (unsigned int begin, unsigned int end) |
void | SetColorCycleAll (bool value) |
void | ColorCycle () |
Does ColorCycling.. |
#define AMASK 0xff000000 |
#define ASHIFT 24 |
#define BMASK 0x00ff0000 |
#define BSHIFT 16 |
#define GMASK 0x0000ff00 |
#define GSHIFT 8 |
#define RMASK 0x000000ff |
#define RSHIFT 0 |
void AddColorCyclingRange | ( | unsigned int | begin, | |
unsigned int | end | |||
) |
void ClearAllColorCyclingRange | ( | ) |
void ColorCycle | ( | ) |
Does ColorCycling..
Color cycle.
MACRO defines speed of colorcycling FIXME: should be made configurable
void DeInitVideo | ( | ) |
deinitliaize the video part
void DrawTexture | ( | const CGraphic * | g, | |
GLuint * | textures, | |||
int | gx_beg, | |||
int | gy_beg, | |||
int | gx_end, | |||
int | gy_end, | |||
int | sx_beg, | |||
int | sy_beg, | |||
int | flip | |||
) |
Draw a rectangular part of a CGraphic to the screen.
This function does not attempt to clip the CGraphic based on the screen coordinates. If the caller wants clipping, it can set the parameters accordingly, or perhaps configure OpenGL to clip the output.
g | The graphic to be drawn. It may consist of multiple OpenGL textures if it is too large to fit in one texture. | |
textures | The OpenGL textures to be drawn. There must be g->NumTextures elements in the array. These textures may be the same as g->Textures, or perhaps variants of them with different colors for a specific player. | |
gx_beg | X coordinate of the left side of the rectangle to be drawn from *g. | |
gy_beg | Y coordinate of the top of the rectangle to be drawn from *g. | |
gx_end | X coordinate of the right side of the rectangle to be drawn from *g. | |
gy_end | Y coordinate of the bottom of the rectangle to be drawn from *g. | |
sx_beg | X coordinate of the left side of the graphic on the screen. | |
sy_beg | Y coordinate of the top of the graphic on the screen. | |
flip | Whether to flip the graphic in the X direction. In any case, the graphic will extend from sx_beg to (gx_end - gx_beg + sx_beg) on the screen. Flipping controls which of those values corresponds to gx_beg and which one to gx_end. |
void FreeOpenGLGraphics | ( | ) |
Free OpenGL graphics.
Free OpenGL graphics
const EventCallback* GetCallbacks | ( | ) |
Get the current callbacks.
Get the current callbacks
unsigned long GetTicks | ( | ) |
Returns the ticks in ms since start.
Return ticks in ms since start.
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. |
int LoadGraphicPNG | ( | CGraphic * | g | ) |
Load graphic from PNG file.
Load a png graphic file. Modified function from SDL_Image
g | graphic to load. |
void MakePlayerColorTexture | ( | CPlayerColorGraphic * | g, | |
int | player | |||
) |
Make an OpenGL texture of the player color pixels only.
Make an OpenGL texture with the player colors.
g | The graphic to texture with player colors. | |
player | Player number to make textures for. |
void MakeTexture | ( | CGraphic * | g | ) |
Make an OpenGL texture.
Make an OpenGL texture or textures out of a graphic object.
g | The graphic object. |
void PopClipping | ( | ) |
Pop current clipping.
Pop current clipping.
void PushClipping | ( | ) |
Push current clipping.
Push current clipping.
void RealizeVideoMemory | ( | ) |
Realize video memory.
Realize video memory.
void ReloadGraphics | ( | ) |
Reload OpenGL graphics.
Reload OpenGL graphics
void ReloadOpenGL | ( | ) |
Reload OpenGL.
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 | ) |
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 ValidateOpenGLScreen | ( | ) |
Regenerate Window screen if needed.
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.
Uint32 ColorBlue |
Uint32 ColorDarkGreen |
Uint32 ColorGray |
Uint32 ColorGreen |
Uint32 ColorOrange |
Uint32 ColorRed |
Uint32 ColorWhite |
Uint32 ColorYellow |
Game callbacks.
char ForceUseOpenGL |
unsigned long FrameCounter |
Counts frames.
GLint GLMaxTextureSize |
Max texture size supported on the video card.
GLint GLMaxTextureSizeOverride |
User-specified limit for GLMaxTextureSize.
Is OpenGL texture compression supported.
unsigned long NextFrameTicks |
Next frame ticks.
int SkipFrames |
0 disable interrupts
int SlowFrameCounter |
Counts quantity of slow frames.
SDL_Surface* TheScreen |
The SDL screen.
Use OpenGL texture compression.
bool UseOpenGL |
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.