____                _       __
    / __ )____  _____   | |     / /___ ___________
   / __  / __ \/ ___/   | | /| / / __ `/ ___/ ___/
  / /_/ / /_/ (__  )    | |/ |/ / /_/ / /  (__  )
 /_____/\____/____/     |__/|__/\__,_/_/  /____/

       A futuristic real-time strategy game.
          This file is part of Bos Wars.
(C) Copyright 2001-2007 by the Bos Wars and Stratagus Project. Distributed under the "GNU General Public License"

video.cpp File Reference

The universal video functions. More...

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "stratagus.h"
#include <vector>
#include "video.h"
#include "font.h"
#include "ui.h"
#include "cursor.h"
#include "iolib.h"
#include "intern_video.h"
#include "SDL.h"

Go to the source code of this file.

Classes

struct  Clip

Functions

void InitVideoSdl (void)
 Init SDL video hardware driver.
void SdlLockScreen (void)
 Do SDL hardware lock.
void SdlUnlockScreen (void)
 Do SDL hardware unlock.
void SetClipping (int left, int top, int right, int bottom)
 Realize video memory.
void PushClipping (void)
 Pop current clipping.
void PopClipping (void)
 Returns the ticks in ms since start.
unsigned long GetTicks (void)
 Convert a SDLKey to a string.
void InitVideo (void)
 Check if a resolution is valid.

Variables

CVideo Video
bool UseOpenGL
 Use OpenGL.
char VideoForceFullScreen
 fullscreen set from commandline
unsigned long NextFrameTicks
 Ticks of begin of the next frame.
unsigned long FrameCounter
 Current frame number.
int SlowFrameCounter
 Profile, frames out of sync.
int ClipX1
 current clipping top left
int ClipY1
 current clipping top left
int ClipX2
 current clipping bottom right
int ClipY2
 current clipping bottom right
static std::vector< ClipClips
int VideoSyncSpeed = 100
 0 disable interrupts
int SkipFrames
 Skip this frames.
Uint32 ColorBlack
Uint32 ColorDarkGreen
Uint32 ColorBlue
Uint32 ColorOrange
Uint32 ColorWhite
Uint32 ColorGray
Uint32 ColorRed
Uint32 ColorGreen
Uint32 ColorYellow


Detailed Description

The universal video functions.

Definition in file video.cpp.


Function Documentation

unsigned long GetTicks ( void   ) 

Convert a SDLKey to a string.

Return ticks in ms since start.

Definition at line 261 of file video.cpp.

Referenced by MessagesDisplay::AddMessage(), DoScroll(), NetworkInitClientConnect(), NetworkSendRateLimitedClientMessage(), CParticleManager::update(), and MessagesDisplay::UpdateMessages().

void InitVideo ( void   ) 

Check if a resolution is valid.

Video initialize.

Definition at line 269 of file video.cpp.

References InitLineDraw(), and InitVideoSdl().

Referenced by tolua_stratagus_InitVideo00().

void InitVideoSdl ( void   ) 

void PopClipping ( void   ) 

void PushClipping ( void   ) 

void SdlLockScreen ( void   ) 

Do SDL hardware lock.

Lock the screen for write access.

Definition at line 753 of file sdl.cpp.

References TheScreen, and UseOpenGL.

Referenced by CVideo::LockScreen().

void SdlUnlockScreen ( void   ) 

Do SDL hardware unlock.

Unlock the screen for write access.

Definition at line 765 of file sdl.cpp.

References TheScreen, and UseOpenGL.

Referenced by CVideo::UnlockScreen().

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

Realize video memory.

Set clipping for graphic routines.

Parameters:
left Left X screen coordinate.
top Top Y screen coordinate.
right Right X screen coordinate.
bottom Bottom Y screen coordinate.

Definition at line 170 of file video.cpp.

References Assert, ClipX1, ClipX2, ClipY1, ClipY2, CVideo::Height, and CVideo::Width.

Referenced by CViewport::Draw(), CStatusLine::Draw(), DrawBuildingCursor(), MyOpenGLGraphics::drawImage(), DrawMapCursor(), MessagesDisplay::DrawMessages(), DrawPieMenu(), DrawStartLocations(), CFont::drawString(), main1(), and CVideo::ResizeScreen().


Variable Documentation

std::vector<Clip> Clips [static]

Definition at line 142 of file video.cpp.

Referenced by PopClipping(), and PushClipping().

int ClipX1

int ClipX2

int ClipY1

int ClipY2

Uint32 ColorBlack

Uint32 ColorBlue

Definition at line 149 of file video.cpp.

Referenced by DrawIcons(), DrawInformations(), InitVideoSdl(), ShowSingleOrder(), and UiDrawManaBar().

Definition at line 148 of file video.cpp.

Referenced by InitVideoSdl(), and UiDrawLifeBar().

Uint32 ColorGray

Uint32 ColorGreen

Uint32 ColorOrange

Definition at line 150 of file video.cpp.

Referenced by CViewport::DrawBorder(), InitVideoSdl(), and UiDrawLifeBar().

Uint32 ColorRed

Uint32 ColorWhite

Uint32 ColorYellow

Definition at line 155 of file video.cpp.

Referenced by DrawUnitSelection(), InitVideoSdl(), ShowSingleOrder(), and UiDrawLifeBar().

unsigned long FrameCounter

unsigned long NextFrameTicks

Ticks of begin of the next frame.

Counts frames.

Definition at line 133 of file video.cpp.

Referenced by WaitEventsOneFrame().

Skip this frames.

Fullscreen or windowed set from commandline.

Definition at line 145 of file video.cpp.

Referenced by DoScrollArea(), SetVideoSync(), and WaitEventsOneFrame().

Profile, frames out of sync.

Initialize Pixels[] for all players. (bring Players[] in sync with Pixels[])

Definition at line 135 of file video.cpp.

Referenced by Exit(), and WaitEventsOneFrame().

bool UseOpenGL

Use OpenGL.

Definition at line 129 of file video.cpp.

Referenced by CMap::CleanFogOfWar(), CleanFonts(), ClearMinimap(), CopyMinimapTerrain(), CMinimap::Create(), CMinimap::Destroy(), DoDrawText(), CMinimap::Draw(), CVideo::DrawCircle(), CVideo::DrawCircleClip(), DrawCursor(), DrawFogOfWarTile(), CGraphic::DrawFrame(), CGraphic::DrawFrameClip(), CGraphic::DrawFrameClipTrans(), CGraphic::DrawFrameClipTransX(), CGraphic::DrawFrameClipX(), CGraphic::DrawFrameTrans(), CGraphic::DrawFrameTransX(), CGraphic::DrawFrameX(), DrawGuichanWidgets(), CVideo::DrawHLine(), CVideo::DrawHLineClip(), CVideo::DrawLine(), CVideo::DrawLineClip(), CVideo::DrawPixelClip(), CPlayerColorGraphic::DrawPlayerColorFrameClip(), CPlayerColorGraphic::DrawPlayerColorFrameClipX(), CVideo::DrawRectangle(), CVideo::DrawRectangleClip(), CGraphic::DrawSub(), CGraphic::DrawSubTrans(), CVideo::DrawTransCircle(), CVideo::DrawTransCircleClip(), CVideo::DrawTransHLine(), CVideo::DrawTransHLineClip(), CVideo::DrawTransLine(), CVideo::DrawTransLineClip(), CVideo::DrawTransPixelClip(), CVideo::DrawTransRectangle(), CVideo::DrawTransRectangleClip(), CVideo::DrawTransVLine(), CVideo::DrawTransVLineClip(), CVideo::DrawVLine(), CVideo::DrawVLineClip(), CVideo::FillCircle(), CVideo::FillCircleClip(), CVideo::FillRectangle(), CVideo::FillRectangleClip(), CVideo::FillTransCircle(), CVideo::FillTransCircleClip(), CVideo::FillTransRectangle(), CVideo::FillTransRectangleClip(), CGraphic::Flip(), CGraphic::Free(), CVideo::GetRGB(), CVideo::GetRGBA(), HideCursor(), initGuichan(), InitLineDraw(), InitVideoSdl(), Invalidate(), InvalidateArea(), CGraphic::Load(), LoadFonts(), CGraphic::MakeShadow(), CVideo::MapRGB(), CVideo::MapRGBA(), RealizeVideoMemory(), CGraphic::Resize(), CVideo::ResizeScreen(), SaveScreenshotPNG(), SdlDoEvent(), SdlLockScreen(), SdlUnlockScreen(), SetMinimapPixel(), SetMinimapTerrainPixel(), ToggleFullScreen(), tolua_get_UseOpenGL(), tolua_set_UseOpenGL(), CMinimap::Update(), CMinimap::UpdateTerrain(), CGraphic::UseDisplayFormat(), VideoDrawChar(), VideoDrawOnlyFog(), and WaitEventsOneFrame().

Definition at line 127 of file video.cpp.

Referenced by MyOpenGLGraphics::_beginDraw(), CclGetVideoFullScreen(), CclGetVideoResolution(), CclPlayer(), CclSetVideoFullScreen(), CclSetVideoResolution(), CreateGame(), DoScroll(), CStatusLine::Draw(), CChunkParticle::draw(), CViewport::DrawBorder(), DrawBuildingCursor(), linedraw_sdl::DrawCircle(), linedraw_sdl::DrawCircleClip(), DrawCoordinates(), DrawCosts(), CMinimap::DrawCursor(), DrawEvents(), DrawGrids(), linedraw_gl::DrawHLine(), linedraw_sdl::DrawHLine(), DrawIcons(), MyOpenGLGraphics::drawImage(), DrawInfoPanelNoneSelected(), DrawInformations(), MyOpenGLGraphics::drawLine(), linedraw_gl::DrawLine(), linedraw_sdl::DrawLine(), linedraw_sdl::DrawLineClip(), CViewport::DrawMapBackgroundInViewport(), DrawMapCursor(), CViewport::DrawMapFogOfWar(), DrawMenuButton(), MessagesDisplay::DrawMessages(), DrawPatchIcons(), linedraw_gl::DrawPixel(), linedraw_sdl::DrawPixelClip(), DrawPlayers(), MyOpenGLGraphics::drawPoint(), DrawPopup(), MyOpenGLGraphics::drawRectangle(), linedraw_gl::DrawRectangle(), DrawSelection(), CFont::drawString(), linedraw_gl::DrawTransCircle(), linedraw_sdl::DrawTransCircle(), linedraw_gl::DrawTransCircleClip(), linedraw_sdl::DrawTransCircleClip(), linedraw_gl::DrawTransHLine(), linedraw_sdl::DrawTransHLine(), linedraw_gl::DrawTransHLineClip(), linedraw_sdl::DrawTransHLineClip(), linedraw_gl::DrawTransPixel(), linedraw_gl::DrawTransPixelClip(), linedraw_sdl::DrawTransPixelClip(), linedraw_gl::DrawTransRectangle(), linedraw_gl::DrawTransRectangleClip(), linedraw_gl::DrawTransVLine(), linedraw_sdl::DrawTransVLine(), linedraw_gl::DrawTransVLineClip(), linedraw_sdl::DrawTransVLineClip(), DrawUnitIcons(), DrawUnitOn(), DrawVisibleRectangleCursor(), linedraw_gl::DrawVLine(), linedraw_sdl::DrawVLine(), EditorMainLoop(), MyOpenGLGraphics::fillRectangle(), gcn::SDLGraphics::fillRectangle(), linedraw_gl::FillRectangle(), linedraw_gl::FillTransCircle(), linedraw_gl::FillTransCircleClip(), linedraw_gl::FillTransRectangle(), linedraw_sdl::FillTransRectangle(), linedraw_gl::FillTransRectangleClip(), HandleCursorMove(), HandleMouseExit(), CEditor::Init(), linedraw_sdl::InitLineDraw(), InitOpenGL(), InitPlayers(), InitUserInterface(), InitVideoSdl(), Invalidate(), InvalidateArea(), main(), main1(), MenuLoop(), MenuScreen::MenuScreen(), PatchEditorCallbackMouse(), PatchEditorMainLoop(), PatchEditorUpdateDisplay(), PatchLoadIcons(), PlayMovie(), SaveScreenshotPNG(), SdlDoEvent(), SetMinimapTerrainPixel(), ShowLoadProgress(), ShowSingleOrder(), ShowTitleImage(), ShowTitleScreens(), StartEditor(), StartMap(), ToggleFullScreen(), tolua_get_Video(), tolua_set_Video(), UiDrawLifeBar(), UiDrawManaBar(), UiToggleBigMap(), linedraw_sdl::VideoDoDrawPixel16(), linedraw_sdl::VideoDoDrawPixel32(), linedraw_sdl::VideoDoDrawTransPixel16(), linedraw_sdl::VideoDoDrawTransPixel32(), VideoDrawOnlyFog(), linedraw_sdl::VideoDrawPixel16(), linedraw_sdl::VideoDrawPixel32(), linedraw_sdl::VideoDrawTransPixel16(), linedraw_sdl::VideoDrawTransPixel32(), and WaitEventsOneFrame().

fullscreen set from commandline

Next frame ticks.

Definition at line 131 of file video.cpp.

Referenced by CclSetVideoFullScreen(), and main().

int VideoSyncSpeed = 100

0 disable interrupts

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

Definition at line 144 of file video.cpp.

Referenced by DoScrollArea(), DrawInfoPanelNoneSelected(), GetGameSpeed(), main(), NetworkRecover(), SetGameSpeed(), SetVideoSync(), UiDecreaseGameSpeed(), and UiIncreaseGameSpeed().


Generated on Sat Feb 21 00:28:22 2009 for Bos Wars by  doxygen 1.5.6