You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

254 lines
16 KiB

3 years ago
3 years ago
  1. <!DOCTYPE HTML>
  2. <html lang="de">
  3. <head>
  4. <!-- Generated by javadoc (17) on Fri Jun 17 12:42:43 CEST 2022 -->
  5. <title>GameLoop</title>
  6. <meta name="viewport" content="width=device-width, initial-scale=1">
  7. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  8. <meta name="dc.created" content="2022-06-17">
  9. <meta name="description" content="declaration: package: base, class: GameLoop">
  10. <meta name="generator" content="javadoc/ClassWriterImpl">
  11. <link rel="stylesheet" type="text/css" href="../stylesheet.css" title="Style">
  12. <link rel="stylesheet" type="text/css" href="../script-dir/jquery-ui.min.css" title="Style">
  13. <link rel="stylesheet" type="text/css" href="../jquery-ui.overrides.css" title="Style">
  14. <script type="text/javascript" src="../script.js"></script>
  15. <script type="text/javascript" src="../script-dir/jquery-3.5.1.min.js"></script>
  16. <script type="text/javascript" src="../script-dir/jquery-ui.min.js"></script>
  17. </head>
  18. <body class="class-declaration-page">
  19. <script type="text/javascript">var evenRowColor = "even-row-color";
  20. var oddRowColor = "odd-row-color";
  21. var tableTab = "table-tab";
  22. var activeTableTab = "active-table-tab";
  23. var pathtoroot = "../";
  24. loadScripts(document, 'script');</script>
  25. <noscript>
  26. <div>JavaScript is disabled on your browser.</div>
  27. </noscript>
  28. <div class="flex-box">
  29. <header role="banner" class="flex-header">
  30. <nav role="navigation">
  31. <!-- ========= START OF TOP NAVBAR ======= -->
  32. <div class="top-nav" id="navbar-top">
  33. <div class="skip-nav"><a href="#skip-navbar-top" title="Skip navigation links">Skip navigation links</a></div>
  34. <ul id="navbar-top-firstrow" class="nav-list" title="Navigation">
  35. <li><a href="../index.html">Overview</a></li>
  36. <li><a href="package-summary.html">Package</a></li>
  37. <li class="nav-bar-cell1-rev">Class</li>
  38. <li><a href="class-use/GameLoop.html">Use</a></li>
  39. <li><a href="package-tree.html">Tree</a></li>
  40. <li><a href="../index-files/index-1.html">Index</a></li>
  41. <li><a href="../help-doc.html#class">Help</a></li>
  42. </ul>
  43. </div>
  44. <div class="sub-nav">
  45. <div>
  46. <ul class="sub-nav-list">
  47. <li>Summary:&nbsp;</li>
  48. <li>Nested&nbsp;|&nbsp;</li>
  49. <li><a href="#field-summary">Field</a>&nbsp;|&nbsp;</li>
  50. <li><a href="#constructor-summary">Constr</a>&nbsp;|&nbsp;</li>
  51. <li><a href="#method-summary">Method</a></li>
  52. </ul>
  53. <ul class="sub-nav-list">
  54. <li>Detail:&nbsp;</li>
  55. <li><a href="#field-detail">Field</a>&nbsp;|&nbsp;</li>
  56. <li><a href="#constructor-detail">Constr</a>&nbsp;|&nbsp;</li>
  57. <li><a href="#method-detail">Method</a></li>
  58. </ul>
  59. </div>
  60. <div class="nav-list-search"><label for="search-input">SEARCH:</label>
  61. <input type="text" id="search-input" value="search" disabled="disabled">
  62. <input type="reset" id="reset-button" value="reset" disabled="disabled">
  63. </div>
  64. </div>
  65. <!-- ========= END OF TOP NAVBAR ========= -->
  66. <span class="skip-nav" id="skip-navbar-top"></span></nav>
  67. </header>
  68. <div class="flex-content">
  69. <main role="main">
  70. <!-- ======== START OF CLASS DATA ======== -->
  71. <div class="header">
  72. <div class="sub-title"><span class="package-label-in-type">Package</span>&nbsp;<a href="package-summary.html">base</a></div>
  73. <h1 title="Class GameLoop" class="title">Class GameLoop</h1>
  74. </div>
  75. <div class="inheritance" title="Inheritance Tree"><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html" title="class or interface in java.lang" class="external-link">java.lang.Object</a>
  76. <div class="inheritance">base.GameLoop</div>
  77. </div>
  78. <section class="class-description" id="class-description">
  79. <dl class="notes">
  80. <dt>Direct Known Subclasses:</dt>
  81. <dd><code><a href="BreakoutGame.html" title="class in base">BreakoutGame</a></code>, <code><a href="MovingObjectsGame.html" title="class in base">MovingObjectsGame</a></code>, <code><a href="MultiLevelGame.html" title="class in base">MultiLevelGame</a></code></dd>
  82. </dl>
  83. <hr>
  84. <div class="type-signature"><span class="modifiers">public class </span><span class="element-name type-name-label">GameLoop</span>
  85. <span class="extends-implements">extends <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a></span></div>
  86. <div class="block">Main class starting any game, contains main(). Apart from that, this class manages all
  87. non-logical functionalities which should be hidden from a game designer like:
  88. <ul>
  89. <li>Setting up windows, panels, buttons, action callbacks, ...
  90. <li>Reading keyboard inputs
  91. <li>Redrawing game window if necessary
  92. <li>managing the game time and calling the appropriate <a href="../gameobjects/GameObject.html" title="class in gameobjects"><code>GameObject</code></a> or <a href="../playground/Playground.html" title="class in playground"><code>Playground</code></a>
  93. methods periodically, at every time step of the game.
  94. </ul>
  95. There will normally never be a need to modify this file, a designer/game programmer should always
  96. redefine the <a href="../gameobjects/GameObject.html" title="class in gameobjects"><code>GameObject</code></a> and <a href="../playground/Playground.html" title="class in playground"><code>Playground</code></a> classes and implement new functionality
  97. there. To make a long story short<br></div>
  98. </section>
  99. <section class="summary">
  100. <ul class="summary-list">
  101. <!-- =========== FIELD SUMMARY =========== -->
  102. <li>
  103. <section class="field-summary" id="field-summary">
  104. <h2>Field Summary</h2>
  105. <div class="caption"><span>Fields</span></div>
  106. <div class="summary-table three-column-summary">
  107. <div class="table-header col-first">Modifier and Type</div>
  108. <div class="table-header col-second">Field</div>
  109. <div class="table-header col-last">Description</div>
  110. <div class="col-first even-row-color"><code>static int</code></div>
  111. <div class="col-second even-row-color"><code><a href="#SIZEX" class="member-name-link">SIZEX</a></code></div>
  112. <div class="col-last even-row-color">
  113. <div class="block">Pixel width of Game GUI ( above 0)</div>
  114. </div>
  115. <div class="col-first odd-row-color"><code>static int</code></div>
  116. <div class="col-second odd-row-color"><code><a href="#SIZEY" class="member-name-link">SIZEY</a></code></div>
  117. <div class="col-last odd-row-color">
  118. <div class="block">Pixel height of Game GUI (above 0)</div>
  119. </div>
  120. </div>
  121. </section>
  122. </li>
  123. <!-- ======== CONSTRUCTOR SUMMARY ======== -->
  124. <li>
  125. <section class="constructor-summary" id="constructor-summary">
  126. <h2>Constructor Summary</h2>
  127. <div class="caption"><span>Constructors</span></div>
  128. <div class="summary-table two-column-summary">
  129. <div class="table-header col-first">Constructor</div>
  130. <div class="table-header col-last">Description</div>
  131. <div class="col-constructor-name even-row-color"><code><a href="#%3Cinit%3E()" class="member-name-link">GameLoop</a>()</code></div>
  132. <div class="col-last even-row-color">
  133. <div class="block">constructor which calls <code>defineLevels()</code>, which adds all levels of this game.</div>
  134. </div>
  135. </div>
  136. </section>
  137. </li>
  138. <!-- ========== METHOD SUMMARY =========== -->
  139. <li>
  140. <section class="method-summary" id="method-summary">
  141. <h2>Method Summary</h2>
  142. <div id="method-summary-table">
  143. <div class="table-tabs" role="tablist" aria-orientation="horizontal"><button id="method-summary-table-tab0" role="tab" aria-selected="true" aria-controls="method-summary-table.tabpanel" tabindex="0" onkeydown="switchTab(event)" onclick="show('method-summary-table', 'method-summary-table', 3)" class="active-table-tab">All Methods</button><button id="method-summary-table-tab1" role="tab" aria-selected="false" aria-controls="method-summary-table.tabpanel" tabindex="-1" onkeydown="switchTab(event)" onclick="show('method-summary-table', 'method-summary-table-tab1', 3)" class="table-tab">Static Methods</button><button id="method-summary-table-tab2" role="tab" aria-selected="false" aria-controls="method-summary-table.tabpanel" tabindex="-1" onkeydown="switchTab(event)" onclick="show('method-summary-table', 'method-summary-table-tab2', 3)" class="table-tab">Instance Methods</button><button id="method-summary-table-tab4" role="tab" aria-selected="false" aria-controls="method-summary-table.tabpanel" tabindex="-1" onkeydown="switchTab(event)" onclick="show('method-summary-table', 'method-summary-table-tab4', 3)" class="table-tab">Concrete Methods</button></div>
  144. <div id="method-summary-table.tabpanel" role="tabpanel">
  145. <div class="summary-table three-column-summary" aria-labelledby="method-summary-table-tab0">
  146. <div class="table-header col-first">Modifier and Type</div>
  147. <div class="table-header col-second">Method</div>
  148. <div class="table-header col-last">Description</div>
  149. <div class="col-first even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static void</code></div>
  150. <div class="col-second even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#main(java.lang.String%5B%5D)" class="member-name-link">main</a><wbr>(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a>[]&nbsp;args)</code></div>
  151. <div class="col-last even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4">
  152. <div class="block">main to start the whole application.</div>
  153. </div>
  154. <div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>void</code></div>
  155. <div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#runGame(java.lang.String%5B%5D)" class="member-name-link">runGame</a><wbr>(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a>[]&nbsp;args)</code></div>
  156. <div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
  157. <div class="block">loops over all <code>levels</code> and implements the game loop to update continuously the level
  158. during play time</div>
  159. </div>
  160. </div>
  161. </div>
  162. </div>
  163. <div class="inherited-list">
  164. <h3 id="methods-inherited-from-class-java.lang.Object">Methods inherited from class&nbsp;java.lang.<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a></h3>
  165. <code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#equals(java.lang.Object)" title="class or interface in java.lang" class="external-link">equals</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#getClass()" title="class or interface in java.lang" class="external-link">getClass</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#hashCode()" title="class or interface in java.lang" class="external-link">hashCode</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notify()" title="class or interface in java.lang" class="external-link">notify</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notifyAll()" title="class or interface in java.lang" class="external-link">notifyAll</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#toString()" title="class or interface in java.lang" class="external-link">toString</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait()" title="class or interface in java.lang" class="external-link">wait</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait(long)" title="class or interface in java.lang" class="external-link">wait</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait(long,int)" title="class or interface in java.lang" class="external-link">wait</a></code></div>
  166. </section>
  167. </li>
  168. </ul>
  169. </section>
  170. <section class="details">
  171. <ul class="details-list">
  172. <!-- ============ FIELD DETAIL =========== -->
  173. <li>
  174. <section class="field-details" id="field-detail">
  175. <h2>Field Details</h2>
  176. <ul class="member-list">
  177. <li>
  178. <section class="detail" id="SIZEX">
  179. <h3>SIZEX</h3>
  180. <div class="member-signature"><span class="modifiers">public static</span>&nbsp;<span class="return-type">int</span>&nbsp;<span class="element-name">SIZEX</span></div>
  181. <div class="block">Pixel width of Game GUI ( above 0)</div>
  182. </section>
  183. </li>
  184. <li>
  185. <section class="detail" id="SIZEY">
  186. <h3>SIZEY</h3>
  187. <div class="member-signature"><span class="modifiers">public static</span>&nbsp;<span class="return-type">int</span>&nbsp;<span class="element-name">SIZEY</span></div>
  188. <div class="block">Pixel height of Game GUI (above 0)</div>
  189. </section>
  190. </li>
  191. </ul>
  192. </section>
  193. </li>
  194. <!-- ========= CONSTRUCTOR DETAIL ======== -->
  195. <li>
  196. <section class="constructor-details" id="constructor-detail">
  197. <h2>Constructor Details</h2>
  198. <ul class="member-list">
  199. <li>
  200. <section class="detail" id="&lt;init&gt;()">
  201. <h3>GameLoop</h3>
  202. <div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="element-name">GameLoop</span>()</div>
  203. <div class="block">constructor which calls <code>defineLevels()</code>, which adds all levels of this game.</div>
  204. </section>
  205. </li>
  206. </ul>
  207. </section>
  208. </li>
  209. <!-- ============ METHOD DETAIL ========== -->
  210. <li>
  211. <section class="method-details" id="method-detail">
  212. <h2>Method Details</h2>
  213. <ul class="member-list">
  214. <li>
  215. <section class="detail" id="runGame(java.lang.String[])">
  216. <h3>runGame</h3>
  217. <div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">void</span>&nbsp;<span class="element-name">runGame</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a>[]&nbsp;args)</span>
  218. throws <span class="exceptions"><a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html" title="class or interface in java.io" class="external-link">IOException</a></span></div>
  219. <div class="block">loops over all <code>levels</code> and implements the game loop to update continuously the level
  220. during play time</div>
  221. <dl class="notes">
  222. <dt>Parameters:</dt>
  223. <dd><code>args</code> - command line arguments forwarded (currently ignored)</dd>
  224. <dt>Throws:</dt>
  225. <dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html" title="class or interface in java.io" class="external-link">IOException</a></code> - if hitghscore.txt cannot be written.</dd>
  226. </dl>
  227. </section>
  228. </li>
  229. <li>
  230. <section class="detail" id="main(java.lang.String[])">
  231. <h3>main</h3>
  232. <div class="member-signature"><span class="modifiers">public static</span>&nbsp;<span class="return-type">void</span>&nbsp;<span class="element-name">main</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a>[]&nbsp;args)</span>
  233. throws <span class="exceptions"><a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html" title="class or interface in java.io" class="external-link">IOException</a></span></div>
  234. <div class="block">main to start the whole application. It calls. <a href="#runGame(java.lang.String%5B%5D)"><code>runGame(String[])</code></a>.
  235. (levels are automatically added/loaded by constructor of <a href="#%3Cinit%3E()"><code>GameLoop()</code></a>).</div>
  236. <dl class="notes">
  237. <dt>Parameters:</dt>
  238. <dd><code>args</code> - Java default command line args, forwarded to <a href="#runGame(java.lang.String%5B%5D)"><code>runGame(String[])</code></a></dd>
  239. <dt>Throws:</dt>
  240. <dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html" title="class or interface in java.io" class="external-link">IOException</a></code> - in case highscore.txt cannot be written.</dd>
  241. </dl>
  242. </section>
  243. </li>
  244. </ul>
  245. </section>
  246. </li>
  247. </ul>
  248. </section>
  249. <!-- ========= END OF CLASS DATA ========= -->
  250. </main>
  251. </div>
  252. </div>
  253. </body>
  254. </html>