$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

src/video/sdl.cpp File Reference

#include "stratagus.h"
#include <map>
#include <string>
#include <vector>
#include <limits.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include "SDL.h"
#include "SDL_gles.h"
#include "GLES/gl.h"
#include <sys/socket.h>
#include "net_lowlevel.h"
#include "SDL_syswm.h"
#include <shellapi.h>
#include "maemo.h"
#include "editor.h"
#include "font.h"
#include "game.h"
#include "interface.h"
#include "minimap.h"
#include "network.h"
#include "sound.h"
#include "sound_server.h"
#include "translate.h"
#include "ui.h"
#include "video.h"
#include "widgets.h"

sdl.cpp - SDL video support.

SDL_Surface * TheScreen
 The SDL screen.
static SDL_Rect Rects [100]
 Internal screen.
static int NumRects
GLint GLMaxTextureSize
 Max texture size supported on the video card.
GLint GLMaxTextureSizeOverride
 Max texture size supported on the video card.
bool GLTextureCompressionSupported
 User-specified limit for GLMaxTextureSize.
bool UseGLTextureCompression
 Is OpenGL texture compression supported.
static std::map< int, std::string > Key2Str
 Use OpenGL texture compression.
static std::map< std::string, int > Str2Key
static int FrameTicks
static int FrameRemainder
 Frame length in ms.
static int FrameFraction
 Frame remainder 0.1 ms.
const EventCallbackCallbacks
 Frame fractional term.
static bool RegenerateScreen = false
bool IsSDLWindowVisible = true
 Flag telling if the SDL window is visible.
void SetVideoSync ()
 Initializes video synchronization.
static void InitOpenGLExtensions ()
static void InitOpenGL ()
void ReloadOpenGL ()
 Reload OpenGL.
static void InitKey2Str ()
void InitVideoSdl ()
int VideoValidResolution (int w, int h)
 Check if a resolution is valid.
void InvalidateArea (int x, int y, int w, int h)
void Invalidate ()
 Simply invalidates whole window or screen.
static void SdlDoEvent (const EventCallback &callbacks, const SDL_Event &event)
void ValidateOpenGLScreen ()
 Regenerate Window screen if needed.
void SetCallbacks (const EventCallback *callbacks)
 Set the current callbacks.
const EventCallbackGetCallbacks ()
 Get the current callbacks.
void WaitEventsOneFrame ()
 Process all system events. Returns if the time for a frame is over.
void RealizeVideoMemory ()
 Realize video memory.
void SdlLockScreen ()
 Init SDL video hardware driver.
void SdlUnlockScreen ()
 Do SDL hardware lock.
const char * SdlKey2Str (int key)
 Convert a SDLKey to a string.
int Str2SdlKey (const char *str)
bool SdlGetGrabMouse ()
 Check if the mouse is grabbed.
void ToggleGrabMouse (int mode)
 Toggle mouse grab mode.
void ToggleFullScreen ()
 Toggle full screen mode.

Function Documentation

const EventCallback* GetCallbacks (  ) 

Get the current callbacks.

Get the current callbacks

static void InitKey2Str (  )  [static]

Initialize SDLKey to string map

static void InitOpenGL (  )  [static]

Initialize OpenGL

static void InitOpenGLExtensions (  )  [static]

Initialize OpenGL extensions

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

Parameters:
x screen pixel X position.
y screen pixel Y position.
w width of rectangle in pixels.
h height of rectangle in pixels.

void RealizeVideoMemory (  ) 

Realize video memory.

Realize video memory.

void ReloadOpenGL (  ) 

Reload OpenGL.

static void SdlDoEvent ( const EventCallback callbacks,
const SDL_Event &  event 
) [static]

Handle interactive input event.

Parameters:
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

void SetVideoSync (  ) 

Initializes video synchronization.

Initialise video sync. Calculate the length of video frame and any simulation skips.

See also:
VideoSyncSpeed

SkipFrames

FrameTicks

FrameRemainder

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.

Parameters:
mode Wanted mode, 1 grab, -1 not grab, 0 toggle.

void ValidateOpenGLScreen (  ) 

Regenerate Window screen if needed.

int VideoValidResolution ( int  w,
int  h 
)

Check if a resolution is valid.

Check if a resolution is valid

Parameters:
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.


Variable Documentation

Frame fractional term.

int FrameFraction [static]

Frame remainder 0.1 ms.

int FrameRemainder [static]

Frame length in ms.

int FrameTicks [static]

Max texture size supported on the video card.

Max texture size supported on the video card.

User-specified limit for GLMaxTextureSize.

User-specified limit for GLMaxTextureSize.

Is OpenGL texture compression supported.

bool IsSDLWindowVisible = true

Flag telling if the SDL window is visible.

std::map<int, std::string> Key2Str [static]

Use OpenGL texture compression.

int NumRects [static]

SDL_Rect Rects[100] [static]

Internal screen.

bool RegenerateScreen = false [static]

std::map<std::string, int> Str2Key [static]

SDL_Surface* TheScreen

The SDL screen.

Is OpenGL texture compression supported.

Use OpenGL texture compression.

(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.