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

       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"

mainloop.cpp File Reference

The main game loop. More...

#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include "stratagus.h"
#include "video.h"
#include "map.h"
#include "font.h"
#include "sound.h"
#include "sound_server.h"
#include "unitsound.h"
#include "unittype.h"
#include "player.h"
#include "unit.h"
#include "cursor.h"
#include "minimap.h"
#include "actions.h"
#include "missile.h"
#include "interface.h"
#include "menus.h"
#include "network.h"
#include "ui.h"
#include "trigger.h"
#include "results.h"
#include "settings.h"
#include "replay.h"
#include "pathfinder.h"
#include "editor.h"
#include "script.h"
#include "particle.h"
#include <guichan.h>

Go to the source code of this file.

Functions

void DrawGuichanWidgets ()
void DoScrollArea (int state, bool fast)
void DrawMapArea (void)
 Draw the map area.
void UpdateDisplay (void)
 Game display update.
static void InitGameCallbacks (void)
void GameMainLoop (void)
 Game main loop.

Variables

int KeyScrollState = ScrollNone
 < variable set when we are scrolling via keyboard
int MouseScrollState = ScrollNone
 current key state
EventCallback GameCallbacks
 Game callbacks.
EventCallback EditorCallbacks
 Editor callbacks.


Detailed Description

The main game loop.

Definition in file mainloop.cpp.


Function Documentation

void DoScrollArea ( int  state,
bool  fast 
)

Handle scrolling area.

Parameters:
state Scroll direction/state.
fast Flag scroll faster.
Todo:
Support dynamic acceleration of scroll speed.
Todo:
If the scroll key is longer pressed the area is scrolled faster.

Definition at line 100 of file mainloop.cpp.

References CursorX, CursorY, FRAMES_PER_SECOND, HandleMouseMove(), CViewport::MapHeight, CViewport::MapWidth, CViewport::MapX, CViewport::MapY, CViewport::OffsetX, CViewport::OffsetY, ScrollDown, ScrollLeft, ScrollNone, ScrollRight, ScrollUp, CUserInterface::SelectedViewport, CViewport::Set(), SkipFrames, TileSizeX, TileSizeY, UI, and VideoSyncSpeed.

Referenced by EditorMainLoop(), and GameMainLoop().

void DrawGuichanWidgets (  ) 

void DrawMapArea ( void   ) 

Draw the map area.

Draw map area

Definition at line 162 of file mainloop.cpp.

References NoUnitP, CUserInterface::NumViewports, TileSizeX, TileSizeY, UI, UnitActionDie, and CUserInterface::Viewports.

Referenced by EditorUpdateDisplay(), and UpdateDisplay().

void GameMainLoop ( void   ) 

static void InitGameCallbacks ( void   )  [static]

void UpdateDisplay ( void   ) 


Variable Documentation

Editor callbacks.

Definition at line 85 of file mainloop.cpp.

Referenced by EditorMainLoop(), CEditor::Init(), and MenuScreen::stop().

Game callbacks.

Definition at line 84 of file mainloop.cpp.

Referenced by MenuScreen::stop().

int KeyScrollState = ScrollNone

< variable set when we are scrolling via keyboard

current scroll state of mouse

variable set when we are scrolling via mouse

Definition at line 79 of file mainloop.cpp.

Referenced by CommandKey(), DoScroll(), EditorCallbackKeyDown(), EditorCallbackKeyUp(), EditorMainLoop(), GameMainLoop(), HandleKeyUp(), HandleMouseExit(), PatchEditorCallbackKeyDown(), and PatchEditorCallbackKeyUp().

int MouseScrollState = ScrollNone


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