KGameComputerIO Class Reference
KGameIO variant for real-time games. More...
#include <kgameio.h>
Inheritance diagram for KGameComputerIO:


Public Slots | |
virtual void | advance () |
Signals | |
void | signalReaction () |
Public Member Functions | |
KGameComputerIO () | |
KGameComputerIO (KPlayer *player) | |
~KGameComputerIO () | |
int | rtti () const |
void | setReactionPeriod (int advanceCalls) |
int | reactionPeriod () const |
void | setAdvancePeriod (int ms) |
void | stopAdvancePeriod () |
void | pause (int calls=-1) |
void | unpause () |
Protected Member Functions | |
virtual void | reaction () |
Detailed Description
KGameIO variant for real-time games.The KGameComputerIO class. It is used to create a LOCAL computer player and communicate transparently with it. Question: Is this needed or is it overwritten anyway for a real game?
You most probably don't want to use this if you want to design a turn based game/player. You'll rather use KGameIO directly, i.e. subclass it yourself. You just need to use KGameIO::signalPrepareTurn and/or KGameIO::notifyTurn there.
This is rather meant to be of use in real time games.
- Author:
- <b_mann@gmx.de>
Definition at line 477 of file kgameio.h.
Constructor & Destructor Documentation
|
Creates a LOCAL computer player.
Definition at line 449 of file kgameio.cpp. |
Member Function Documentation
|
Run time idendification. Predefined values are from IOMode You MUST overwrite this in derived classes!
Implements KGameIO. Definition at line 473 of file kgameio.cpp. |
|
The number of advance calls until the player (or rather: the IO) does something (default: 1).
Definition at line 478 of file kgameio.cpp. |
|
Start a QTimer which calls advance every
Definition at line 488 of file kgameio.cpp. References advance(), and stopAdvancePeriod(). |
|
Ignore calls number of advance calls. if calls is -1 then all following advance calls are ignored until unpause is called. This simply prevents the internal advance counter to be increased. You may want to use this to emulate a "thinking" computer player. Note that this means if you increase the advance period (see setAdvancePeriod), i.e. if you change the speed of your game, your computer player thinks "faster".
Definition at line 505 of file kgameio.cpp. Referenced by unpause(). |
|
Equivalent to pause(0). Immediately continue to increase the internal advance counter. Definition at line 510 of file kgameio.cpp. References pause(). |
|
Works kind of similar to QCanvas::advance.
Increase the internal advance counter. If This is very useful if you use QCanvas as you can use this in your QCanvas::advance call. The advantage is that if you change the speed of the game (i.e. change QCanvas::setAdvancePeriod) the computer player gets slower as well. If you don't use QCanvas you can use setAdvancePeriod to get the same result. Alternatively you can just use a QTimer. Definition at line 515 of file kgameio.cpp. References reaction(). Referenced by setAdvancePeriod(). |
|
This signal is emitted when your computer player is meant to do something, or better is meant to be allowed to do something.
Referenced by reaction(). |
|
Default implementation simply emits signalReaction.
Definition at line 534 of file kgameio.cpp. References signalReaction(). Referenced by advance(). |
The documentation for this class was generated from the following files: