class KGameWindow

More...

Definition#include <ksirk/kgamewin.h>
InheritsKMainWindow (unknown) [public ]
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Methods

Public Slots

Public Members

Protected Methods

Private Methods

Private Members


Detailed Description

static const char* GameStateNames[]

GameStateNames[]

 KGameWindow (QWidget* parent=0, const char* name=0)

KGameWindow

Create the window and initializes its members

 ~KGameWindow ()

~KGameWindow

Deletes the background and the pool

void  paint (void)

paint

Ask all the sprites to repaint

CountryclickIn (const QPoint &Point)

clickIn

Returns the country where inside which is the argument point. 0 f none.

PlayercurrentPlayer (void)

currentPlayer

Returns the current player

void  newGame (void)

newGame

Creates a new game. Called when the New Game button is hit

void  initArmiesMovement (int nb, Country* src, Country* dest)

initArmiesMovement

Prepares the sprites to be moved : removes the nb necessary sprites from source, creates the moving sprites and gives them their destination, etc

void  moveCannons (void)

moveCannons

The 3 methods below manage the movement of, respectively, the cannons, the cavalrymen and the infantrymen. It ask them to move by a certain amount and, eventually, manages their arrival at destination

void  moveCavalrymen (void)

moveCavalrymen

void  moveInfantrymen (void)

moveInfantrymen

void  initCombatMovement (Country *attacker, Country *defender)

initCombatMovement

Initializes the sprites that will fight for the attacker and the defender. Prepares them for moving

void  moveMovingCombatants (void)

moveMovingCombatants

Handle the moving of the fighters towards destination

void  combatantArrival (AnimSprite *)

combatantArrival

Handle the arrival of a fighter to destination

void  animCombat (void)

animCombat

Prepare the fighting animation : replace the sprites sequence by the sequence of explosion

void  stopCombat (void)

stopCombat

Replaces the animated fighters by the simple cannon image

void  animExplosion (int)

animExplosion

Replaces the sequence of destroyed cannon(s) by the explosion sequence

void  stopExplosion (void)

stopExplosion

When all the explosion sequence has been shown for all explosing devices, removes these sprites

void  initCombatBringBack (int, Country *, Country *)

initCombatBringBack

Set up the eventual survivor(s) to come back home

void  evenementTimer (void)

evenementTimer

called every 50ms, it causes the scrolling of the world if necessary the movement of the moving sprites. After it call the paint method to do the animation of the sprites and it asks the pool to update

bool  setupPlayers (void)

setupPlayers

Prepares the players for the game with human interaction. Return true if successful or false if failure or cancel

void  distribueArmees (void)

distribueArmees

Do the distribution of armies for all players in function of their number of countries

int  nbNewArmies (Player *p)

nbNewArmies

Computes the number of armies to be distributed to p at the beginning of the turn, function of the number of countries he owns TODO : this method should be a method of Player

void  attackEnd (void)

attackEnd

Changes the owner of the attacked country if its number of armies becomes negative or null. Handle the end of the game of the winning conditions are fullfilled.

void  resolveAttack (void)

resolveAttack

Computes the results of the fight

void  displayNextPlayerButton (void)

displayNextPlayerButton

Display and removes various toolbar buttons in function of the state of the game.

void  removeNextPlayerButton (void)

removeNextPlayerButton

void  displayRecyclingButtons (void)

displayRecyclingButtons

void  removeRecyclingButtons (void)

removeRecyclingButtons

void  displayNormalGameButtons (void)

displayNormalGameButtons

void  removeNormalGameButtons (void)

removeNormalGameButtons

void  displayDefenseButtons (void)

displayDefenseButtons

void  removeDefenseButtons (void)

removeDefenseButtons

void  displayInvasionButtons (void)

displayInvasionButtons

void  removeInvasionButtons (void)

removeInvasionButtons

void  displayCancelButton (void)

displayCancelButton

void  removeCancelButton (void)

removeCancelButton

void  setBarFlagButton (void)

setBarFlagButton

Updates the flag in the statusbar with the one of the current player

void  changeItem ( const QString& text, int id )

changeItem

Shortcut for "statusBar()-> changeItem(text, id)"

void  reconnectMouse (void)

reconnectMouse

Reconnect the mouse events signals to their slots to allow human players to play

void  disconnectMouse (void)

disconnectMouse

Disconnects the mouse events signals from their slots to avoid human player actions when it is the turn of the AI

GameState  getState (void)

getState

[const]

bool  isMyState (GameState state)

isMyState

[const]

void  setState (GameState newState)

setState

QString  getStateName (void)

getStateName

[const]

int  setCurrentPlayerToFirst ()

setCurrentPlayerToFirst

int  setCurrentPlayerToNext ()

setCurrentPlayerToNext

sets the current player to be the next one in the list. Makes the associated actions : Changes the flag in the status bar,... Returns 0 in case of success; non-zero otherwise. For example, it returns 1 the current player was the last one

void  initActions ()

initActions

[protected]

Add the main toolbar buttons

void  initStatusBar ()

initStatusBar

[protected]

Prepares the status bar

void  initView ()

initView

[protected]

creates and display the main frame with the background

void  initSprites ()

initSprites

[protected]

Prepares the sprites lists

void  addAButton (const QString& fileName, int id, const QString& slot, const QString& txt)

addAButton

[protected]

Add a button to the toolbar

void  enterEvent (QEvent* ev)

enterEvent

[protected]

Reimplementation of the inherited function : starts the timer.

void  leaveEvent (QEvent* ev)

leaveEvent

[protected]

Reimplementation of the inherited function : stops the timer.

void  slotExitGame (void)

slotExitGame

[slot]

The slots associated to the buttons

void  slotNewGame (void)

slotNewGame

[slot]

void  slotOpenGame (void)

slotOpenGame

[slot]

void  slotRecycling (void)

slotRecycling

[slot]

void  slotRecyclingFinished (void)

slotRecyclingFinished

[slot]

void  slotNextPlayer (void)

slotNextPlayer

[slot]

void  slotAttack1 (void)

slotAttack1

[slot]

void  slotAttack2 (void)

slotAttack2

[slot]

void  slotAttack3 (void)

slotAttack3

[slot]

void  slotDefense1 (void)

slotDefense1

[slot]

void  slotDefense2 (void)

slotDefense2

[slot]

void  slotInvade1 (void)

slotInvade1

[slot]

void  slotInvade5 (void)

slotInvade5

[slot]

void  slotInvade10 (void)

slotInvade10

[slot]

void  slotInvasionFinished (void)

slotInvasionFinished

[slot]

void  slotRetreat1 (void)

slotRetreat1

[slot]

void  slotRetreat5 (void)

slotRetreat5

[slot]

void  slotRetreat10 (void)

slotRetreat10

[slot]

void  slotMove (void)

slotMove

[slot]

void  slotCancel (void)

slotCancel

[slot]

void  slotDumpGameInformations (void)

slotDumpGameInformations

[slot]

void  showAboutApplication (void)

showAboutApplication

[slot]

The standard showAboutApplication slot

void  slotTimerEvent (void)

slotTimerEvent

[slot]

Connected to the frame timer, it manages the behavior of the game in function of the value of the state.

Fundamental method !!!

void  evenementLButtonDown (const QPoint&)

evenementLButtonDown

[slot]

Connected to the frame mouse buttons signals, they manages the reaction of the game to user interaction inside its main widget in function of the state of the game.

Fundamental methods !!!

void  evenementLButtonUp (const QPoint&)

evenementLButtonUp

[slot]

void  evenementRButtonDown (const QPoint&)

evenementRButtonDown

[slot]

int NKD

NKD

[private]

int NKA

NKA

[private]

NKD = Numberof Killed Defenders NKA = Numberof Killed Attackers These numbers are set up by resolveAttack() and are used to compute in various methods TODO : this solution is ugly. Change that.

ONU * theWorld

theWorld

[private]

QCanvas* canvas

canvas

[private]

BackGnd* backGnd

backGnd

[private]

AnimSpritesList * movingCannons

movingCannons

[private]

AnimSpritesList * movingCavalrymen

movingCavalrymen

[private]

AnimSpritesList * movingInfantrymen

movingInfantrymen

[private]

AnimSpritesList * movingCombatants

movingCombatants

[private]

AnimSpritesList * animCombatants

animCombatants

[private]

AnimSpritesList * animExplodings

animExplodings

[private]

AnimSpritesList * combatants

combatants

[private]

GameState myState

myState

[private]

QString status2Text

status2Text

[private]

int nbMovedArmies

nbMovedArmies

[private]

unsigned int nbPlayers

nbPlayers

[private]

Country * firstCountry

firstCountry

[private]

Country * secondCountry

secondCountry

[private]

The 2 countries involved in a fight or in a armies move

DecoratedGameFrame * frame

frame

[private]

KStandardDirs * dirs

dirs

[private]

QVBox * vbox

vbox

[private]

PlayersArray * players

players

[private]

KConfig * config

config

[private]

QToolButton * barFlagButton

barFlagButton

[private]

void  aiAction ()

aiAction

[private]

This button is used to display the flag of the currently active player in the status bar

void  attack (Country& attacker, Country& defender, int nb)

attack

[private]

void  moveArmies (Country& src, Country& dest, int nb)

moveArmies

[private]


Generated by: gael on noirdes.limsi.u-psud.fr on Fri Jan 3 17:03:38 2003, using kdoc 2.0a53.