<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en_US" xml:lang="en_US"> <head> <title>libkdegames: KGameComputerIO Class Reference (libkdegames)</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Style-Type" content="text/css" /> <meta http-equiv="pics-label" content='(pics-1.1 "http://www.icra.org/ratingsv02.html" comment "ICRAonline DE v2.0" l gen true for "http://www.kde.org" r (nz 1 vz 1 lz 1 oz 1 cb 1) "http://www.rsac.org/ratingsv01.html" l gen true for "http://www.kde.org" r (n 0 s 0 v 0 l 0))' /> <meta name="trademark" content="KDE e.V." /> <meta name="description" content="K Desktop Environment Homepage, KDE.org" /> <meta name="MSSmartTagsPreventParsing" content="true" /> <meta name="robots" content="all" /> <link rel="shortcut icon" href="../../favicon.ico" /> <link rel="stylesheet" media="screen" type="text/css" title="APIDOX" href="doxygen.css" /> </head> <body> <div id="nav_header_top" align="right"> <a href="#content" class="doNotDisplay" accesskey="2">Skip to main content ::</a> <a href="../.."><img id="nav_header_logo" alt="Home" align="left" src="../../kde_gear_64.png" border="0" /></a> <span class="doNotDisplay">::</span> <div id="nav_header_title" align="left">KDE API Reference</div> </div> <div id="nav_header_bottom" align="right"> <span class="doNotDisplay">:: <a href="#navigation" accesskey="5">Skip to Link Menu</a><br/></span> <div id="nav_header_bottom_right" style="text-align: left;"> / <a href="../..">API Reference</a> / <a href=".">libkdegames</a> </div> </div> <table id="main" border="0" cellpadding="0" cellspacing="0" width="100%"> <tr> <td valign="top" class="menuheader" height="0"></td> <td id="contentcolumn" valign="top" rowspan="2" > <div id="content" style="padding-top: 0px;"><div style="width:100%; margin: 0px; padding: 0px;"> <a name="content"></a> <!-- Generated by Doxygen 1.5.5 --> <div class="contents"> <h1>KGameComputerIO Class Reference</h1><!-- doxytag: class="KGameComputerIO" --><!-- doxytag: inherits="KGameIO" --><code>#include <<a class="el" href="kgameio_8h-source.html">kgameio.h</a>></code> <p> <div class="dynheader"> Inheritance diagram for KGameComputerIO:</div> <div class="dynsection"> <p><center><img src="classKGameComputerIO.png" usemap="#KGameComputerIO_map" border="0" alt=""></center> <map name="KGameComputerIO_map"> <area href="classKGameIO.html" alt="KGameIO" shape="rect" coords="0,0,119,24"> </map> </div> <p> <a href="classKGameComputerIO-members.html">List of all members.</a><hr><a name="_details"></a><h2>Detailed Description</h2> <a class="el" href="classKGameIO.html" title="Base class for IO devices for games.">KGameIO</a> variant for real-time games. <p> The <a class="el" href="classKGameComputerIO.html" title="KGameIO variant for real-time games.">KGameComputerIO</a> 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?<p> You most probably don't want to use this if you want to design a turn based game/player. You'll rather use <a class="el" href="classKGameIO.html">KGameIO</a> directly, i.e. subclass it yourself. You just need to use <a class="el" href="classKGameIO.html#0091d3ba6ae94d70fc83a362087f32a9">KGameIO::signalPrepareTurn</a> and/or <a class="el" href="classKGameIO.html#20bf262118d7420385351c1339b4c40f">KGameIO::notifyTurn</a> there.<p> This is rather meant to be of use in real time games.<p> <dl class="author" compact><dt><b>Author:</b></dt><dd><<a href="mailto:b_mann@gmx.de">b_mann@gmx.de</a>> </dd></dl> <p>Definition at line <a class="el" href="kgameio_8h-source.html#l00477">477</a> of file <a class="el" href="kgameio_8h-source.html">kgameio.h</a>.</p> <table border="0" cellpadding="0" cellspacing="0"> <tr><td></td></tr> <tr><td colspan="2"><br><h2>Public Slots</h2></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><a class="el" href="classKGameComputerIO.html#6f9f6c9f152398096eff63b7470a995e">advance</a> ()</td></tr> <tr><td colspan="2"><br><h2>Signals</h2></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classKGameComputerIO.html#2a662322dad2682080b628a759774524">signalReaction</a> ()</td></tr> <tr><td colspan="2"><br><h2>Public Member Functions</h2></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classKGameComputerIO.html#a4f513b2e984d6510956c1ed34a446e3">KGameComputerIO</a> ()</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="00a3069a3eb8a6eeef645619b52e7e18"></a><!-- doxytag: member="KGameComputerIO::KGameComputerIO" ref="00a3069a3eb8a6eeef645619b52e7e18" args="(KPlayer *player)" --> </td><td class="memItemRight" valign="bottom"><b>KGameComputerIO</b> (<a class="el" href="classKPlayer.html">KPlayer</a> *player)</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="classKGameComputerIO.html#e1de92f6e3f9115a44ca862fdde2a5cb">rtti</a> () const </td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classKGameComputerIO.html#c2e156eb72e37a45a09de5049b4eae4d">setReactionPeriod</a> (int advanceCalls)</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="9f249febd4e702d8367f1195775a27fa"></a><!-- doxytag: member="KGameComputerIO::reactionPeriod" ref="9f249febd4e702d8367f1195775a27fa" args="() const " --> int </td><td class="memItemRight" valign="bottom"><b>reactionPeriod</b> () const </td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classKGameComputerIO.html#6ee28c75c1cfacf0f78fa6c964ea8cd8">setAdvancePeriod</a> (int ms)</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="77a0018f8a575c28378b622678bba284"></a><!-- doxytag: member="KGameComputerIO::stopAdvancePeriod" ref="77a0018f8a575c28378b622678bba284" args="()" --> void </td><td class="memItemRight" valign="bottom"><b>stopAdvancePeriod</b> ()</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classKGameComputerIO.html#a0ad885b286f4dc1ae42cce32b86b751">pause</a> (int calls=-1)</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classKGameComputerIO.html#a02af05693334b1a97a2749ab4b4d15c">unpause</a> ()</td></tr> <tr><td colspan="2"><br><h2>Protected Member Functions</h2></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><a class="el" href="classKGameComputerIO.html#fbb43270dbfb2ca020a44a3abe3415eb">reaction</a> ()</td></tr> </table> <hr><h2>Constructor & Destructor Documentation</h2> <a class="anchor" name="a4f513b2e984d6510956c1ed34a446e3"></a><!-- doxytag: member="KGameComputerIO::KGameComputerIO" ref="a4f513b2e984d6510956c1ed34a446e3" args="()" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">KGameComputerIO::KGameComputerIO </td> <td>(</td> <td class="paramname"> </td> <td> ) </td> <td width="100%"></td> </tr> </table> </div> <div class="memdoc"> <p> Creates a LOCAL computer player. <p> <p>Definition at line <a class="el" href="kgameio_8cpp-source.html#l00449">449</a> of file <a class="el" href="kgameio_8cpp-source.html">kgameio.cpp</a>.</p> </div> </div><p> <hr><h2>Member Function Documentation</h2> <a class="anchor" name="e1de92f6e3f9115a44ca862fdde2a5cb"></a><!-- doxytag: member="KGameComputerIO::rtti" ref="e1de92f6e3f9115a44ca862fdde2a5cb" args="() const " --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int KGameComputerIO::rtti </td> <td>(</td> <td class="paramname"> </td> <td> ) </td> <td width="100%"> const<code> [virtual]</code></td> </tr> </table> </div> <div class="memdoc"> <p> Run time idendification. <p> Predefined values are from IOMode You MUST overwrite this in derived classes!<p> <dl class="return" compact><dt><b>Returns:</b></dt><dd>rtti value </dd></dl> <p>Implements <a class="el" href="classKGameIO.html#88a4154d5e130823ee152c0e0258cc62">KGameIO</a>.</p> <p>Definition at line <a class="el" href="kgameio_8cpp-source.html#l00473">473</a> of file <a class="el" href="kgameio_8cpp-source.html">kgameio.cpp</a>.</p> </div> </div><p> <a class="anchor" name="c2e156eb72e37a45a09de5049b4eae4d"></a><!-- doxytag: member="KGameComputerIO::setReactionPeriod" ref="c2e156eb72e37a45a09de5049b4eae4d" args="(int advanceCalls)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void KGameComputerIO::setReactionPeriod </td> <td>(</td> <td class="paramtype">int </td> <td class="paramname"> <em>advanceCalls</em> </td> <td> ) </td> <td width="100%"></td> </tr> </table> </div> <div class="memdoc"> <p> The number of advance calls until the player (or rather: the IO) does something (default: 1). <p> <p>Definition at line <a class="el" href="kgameio_8cpp-source.html#l00478">478</a> of file <a class="el" href="kgameio_8cpp-source.html">kgameio.cpp</a>.</p> </div> </div><p> <a class="anchor" name="6ee28c75c1cfacf0f78fa6c964ea8cd8"></a><!-- doxytag: member="KGameComputerIO::setAdvancePeriod" ref="6ee28c75c1cfacf0f78fa6c964ea8cd8" args="(int ms)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void KGameComputerIO::setAdvancePeriod </td> <td>(</td> <td class="paramtype">int </td> <td class="paramname"> <em>ms</em> </td> <td> ) </td> <td width="100%"></td> </tr> </table> </div> <div class="memdoc"> <p> Start a QTimer which calls advance every <code>ms</code> milli seconds. <p> <p>Definition at line <a class="el" href="kgameio_8cpp-source.html#l00488">488</a> of file <a class="el" href="kgameio_8cpp-source.html">kgameio.cpp</a>.</p> </div> </div><p> <a class="anchor" name="a0ad885b286f4dc1ae42cce32b86b751"></a><!-- doxytag: member="KGameComputerIO::pause" ref="a0ad885b286f4dc1ae42cce32b86b751" args="(int calls=-1)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void KGameComputerIO::pause </td> <td>(</td> <td class="paramtype">int </td> <td class="paramname"> <em>calls</em> = <code>-1</code> </td> <td> ) </td> <td width="100%"></td> </tr> </table> </div> <div class="memdoc"> <p> Ignore calls number of advance calls. <p> if calls is -1 then all following advance calls are ignored until unpause is called.<p> This simply prevents the internal advance counter to be increased.<p> 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". <dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>calls</em> </td><td>Number of advance calls to be ignored </td></tr> </table> </dl> <p>Definition at line <a class="el" href="kgameio_8cpp-source.html#l00505">505</a> of file <a class="el" href="kgameio_8cpp-source.html">kgameio.cpp</a>.</p> </div> </div><p> <a class="anchor" name="a02af05693334b1a97a2749ab4b4d15c"></a><!-- doxytag: member="KGameComputerIO::unpause" ref="a02af05693334b1a97a2749ab4b4d15c" args="()" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void KGameComputerIO::unpause </td> <td>(</td> <td class="paramname"> </td> <td> ) </td> <td width="100%"></td> </tr> </table> </div> <div class="memdoc"> <p> Equivalent to pause(0). <p> Immediately continue to increase the internal advance counter. <p>Definition at line <a class="el" href="kgameio_8cpp-source.html#l00510">510</a> of file <a class="el" href="kgameio_8cpp-source.html">kgameio.cpp</a>.</p> </div> </div><p> <a class="anchor" name="6f9f6c9f152398096eff63b7470a995e"></a><!-- doxytag: member="KGameComputerIO::advance" ref="6f9f6c9f152398096eff63b7470a995e" args="()" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void KGameComputerIO::advance </td> <td>(</td> <td class="paramname"> </td> <td> ) </td> <td width="100%"><code> [virtual, slot]</code></td> </tr> </table> </div> <div class="memdoc"> <p> Works kind of similar to QCanvas::advance. <p> Increase the internal advance counter. If <code>reactionPeriod</code> is reached the counter is set back to 0 and <a class="el" href="classKGameComputerIO.html#2a662322dad2682080b628a759774524">signalReaction</a> is emitted. This is when the player is meant to do something (move its units or so).<p> 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.<p> If you don't use QCanvas you can use setAdvancePeriod to get the same result. Alternatively you can just use a QTimer. <p>Definition at line <a class="el" href="kgameio_8cpp-source.html#l00515">515</a> of file <a class="el" href="kgameio_8cpp-source.html">kgameio.cpp</a>.</p> </div> </div><p> <a class="anchor" name="2a662322dad2682080b628a759774524"></a><!-- doxytag: member="KGameComputerIO::signalReaction" ref="2a662322dad2682080b628a759774524" args="()" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void KGameComputerIO::signalReaction </td> <td>(</td> <td class="paramname"> </td> <td> ) </td> <td width="100%"><code> [signal]</code></td> </tr> </table> </div> <div class="memdoc"> <p> This signal is emitted when your computer player is meant to do something, or better is meant to be allowed to do something. <p> </div> </div><p> <a class="anchor" name="fbb43270dbfb2ca020a44a3abe3415eb"></a><!-- doxytag: member="KGameComputerIO::reaction" ref="fbb43270dbfb2ca020a44a3abe3415eb" args="()" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void KGameComputerIO::reaction </td> <td>(</td> <td class="paramname"> </td> <td> ) </td> <td width="100%"><code> [protected, virtual]</code></td> </tr> </table> </div> <div class="memdoc"> <p> Default implementation simply emits signalReaction. <p> <p>Definition at line <a class="el" href="kgameio_8cpp-source.html#l00534">534</a> of file <a class="el" href="kgameio_8cpp-source.html">kgameio.cpp</a>.</p> </div> </div><p> <hr>The documentation for this class was generated from the following files:<ul> <li><a class="el" href="kgameio_8h-source.html">kgameio.h</a><li><a class="el" href="kgameio_8cpp-source.html">kgameio.cpp</a></ul> </div> </div></div> </td> </tr> <tr> <td valign="top" id="leftmenu" width="25%"> <a name="navigation"></a> <div class="menu_box"><h2>libkdegames</h2> <div class="nav_list"> <ul><li><a href="index.html">Main Page</a></li><li><a href="hierarchy.html">Class Hierarchy</a></li><li><a href="classes.html">Alphabetical List</a></li><li><a href="annotated.html">Class List</a></li><li><a href="files.html">File List</a></li><li><a href="functions.html">Class Members</a></li><li><a href="pages.html">Related Pages</a></li></ul> <!-- <h2>Class Picker</h2> <div style="text-align: center;"> <form name="guideform"> <select name="guidelinks" style="width:100%;" onChange="window.location=document.guideform.guidelinks.options[document.guideform.guidelinks.selectedIndex].value"> <option value="annotated.html">-- Choose --</option> <option value="classKCanvasRootPixmap.html">kcanvasrootpixmap</option>, <option value="classKCardDialog.html">kcarddialog</option>, <option value="classKChat.html">kchat</option>, <option value="classKChatBase.html">kchatbase</option>, <option value="classKChatBaseText.html">kchatbasetext</option>, <option value="classKExtHighscore_1_1Item.html">kexthighscore::item</option>, <option value="classKExtHighscore_1_1ItemArray.html">kexthighscore::itemarray</option>, <option value="classKExtHighscore_1_1Manager.html">kexthighscore::manager</option>, <option value="classKExtHighscore_1_1MultiplayerScores.html">kexthighscore::multiplayerscores</option>, <option value="classKExtHighscore_1_1Score.html">kexthighscore::score</option>, <option value="classKGame.html">kgame</option>, <option value="classKGameChat.html">kgamechat</option>, <option value="classKGameComputerIO.html">kgamecomputerio</option>, <option value="classKGameConnectDialog.html">kgameconnectdialog</option>, <option value="classKGameDialog.html">kgamedialog</option>, <option value="classKGameDialogChatConfig.html">kgamedialogchatconfig</option>, <option value="classKGameDialogConfig.html">kgamedialogconfig</option>, <option value="classKGameErrorDialog.html">kgameerrordialog</option>, <option value="classKGameErrorMessageDialog.html">kgameerrormessagedialog</option>, <option value="classKGameIO.html">kgameio</option>, <option value="classKGameKeyIO.html">kgamekeyio</option>, <option value="classKGameLCD.html">kgamelcd</option>, <option value="classKGameLCDClock.html">kgamelcdclock</option>, <option value="classKGameLCDList.html">kgamelcdlist</option>, <option value="classKGameMisc.html">kgamemisc</option>, <option value="classKGameMouseIO.html">kgamemouseio</option>, <option value="classKGameNetwork.html">kgamenetwork</option>, <option value="classKGameProcess.html">kgameprocess</option>, <option value="classKGameProcessIO.html">kgameprocessio</option>, <option value="classKGameProgress.html">kgameprogress</option>, <option value="classKGameProperty.html">kgameproperty</option>, <option value="classKGamePropertyBase.html">kgamepropertybase</option>, <option value="classKGamePropertyHandler.html">kgamepropertyhandler</option>, <option value="classKGameSequence.html">kgamesequence</option>, <option value="classKGrid2D_1_1Generic.html">kgrid2d::generic</option>, <option value="classKGrid2D_1_1Hexagonal.html">kgrid2d::hexagonal</option>, <option value="classKGrid2D_1_1HexagonalBase.html">kgrid2d::hexagonalbase</option>, <option value="classKGrid2D_1_1Square.html">kgrid2d::square</option>, <option value="classKGrid2D_1_1SquareBase.html">kgrid2d::squarebase</option>, <option value="classKHighscore.html">khighscore</option>, <option value="classKMessageClient.html">kmessageclient</option>, <option value="classKMessageDirect.html">kmessagedirect</option>, <option value="classKMessageIO.html">kmessageio</option>, <option value="classKMessageServer.html">kmessageserver</option>, <option value="classKMessageServerSocket.html">kmessageserversocket</option>, <option value="classKMessageSocket.html">kmessagesocket</option>, <option value="classKPlayer.html">kplayer</option>, <option value="classKScoreDialog.html">kscoredialog</option>, <option value="classKStdGameAction.html">kstdgameaction</option>, </select> </form> </div> --> </div></div> <div class="menu_box"><h2>API Dox</h2> <div class="nav_list"> <ul> <li><a href="../../libkdegames/html/index.html">libkdegames</a></li> </ul></div></div> </td> </tr> </table> <span class="doNotDisplay"> <a href="http://www.kde.org/" accesskey="8">KDE Home</a> | <a href="http://accessibility.kde.org/" accesskey="9">KDE Accessibility Home</a> | <a href="http://www.kde.org/media/accesskeys.php" accesskey="0">Description of Access Keys</a> </span> <div style="height: 8px"></div> <div id="footer"> <div id="footer_left"> Maintained by <a href="mailto:groot@kde.org">Adriaan de Groot</a> and <a href="mailto:winter@kde.org">Allen Winter</a>. <br/> KDE and K Desktop Environment are trademarks of <a href="http://www.kde.org/areas/kde-ev/" title="Homepage of the KDE non-profit Organization">KDE e.V.</a> | <a href="http://www.kde.org/contact/impressum.php">Legal</a> </div> <div id="footer_right"><img src="/media/images/footer_right.png" style="margin: 0px" alt="" /></div> </div> <!-- WARNING: DO NOT SEND MAIL TO THE FOLLOWING EMAIL ADDRESS! YOU WILL BE BLOCKED INSTANTLY AND PERMANENTLY! <a href="mailto:aaaatrap-425acc3b5374943f@kde.org">Block me</a> WARNING END --> </body> </html>