Skip to content

Commit

Permalink
RenderWindow class to namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
durkisneer1 committed Jan 21, 2024
1 parent cb16751 commit d458e9c
Show file tree
Hide file tree
Showing 87 changed files with 2,496 additions and 2,116 deletions.
Binary file modified docs/build/doctrees/environment.pickle
Binary file not shown.
Binary file modified docs/build/doctrees/getting_started/index.doctree
Binary file not shown.
Binary file added docs/build/doctrees/reference/constants.doctree
Binary file not shown.
Binary file modified docs/build/doctrees/reference/draw.doctree
Binary file not shown.
Binary file modified docs/build/doctrees/reference/entity.doctree
Binary file not shown.
Binary file modified docs/build/doctrees/reference/error_logger.doctree
Binary file not shown.
Binary file modified docs/build/doctrees/reference/font.doctree
Binary file not shown.
Binary file removed docs/build/doctrees/reference/globals.doctree
Binary file not shown.
Binary file modified docs/build/doctrees/reference/index.doctree
Binary file not shown.
Binary file modified docs/build/doctrees/reference/rect.doctree
Binary file not shown.
Binary file removed docs/build/doctrees/reference/render_window.doctree
Binary file not shown.
Binary file added docs/build/doctrees/reference/window.doctree
Binary file not shown.
23 changes: 12 additions & 11 deletions docs/build/html/_sources/getting_started/index.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,30 @@ Creating a Window

After following the :doc:`../installation` guide, you are ready for your first Kraken Engine program.

.. code-block:: c
.. code-block:: c++
:linenos:

#include <KrakenEngine.hpp>

const kn::math::Vec2 kn::SCREEN_SIZE = { 800, 600 };
int main() {
kn::RenderWindow& window = kn::RenderWindow::get();
int main()
{
kn::window::init({ 800, 600 });
kn::time::Clock clock;

bool done = false;
while (!done) {
while (!done)
{
clock.tick();

for (const auto &event : window.getEvents())
if (event.type == kn::QUIT) done = true;
for (const auto &event : kn::window::getEvents())
if (event.type == kn::QUIT)
done = true;

window.cls();
window.flip();
kn::window::cls();
kn::window::flip();
}

kn::window::quit();
return EXIT_SUCCESS;
}

Expand Down
5 changes: 5 additions & 0 deletions docs/build/html/_sources/reference/constants.rst.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
=========
constants
=========

.. doxygenfile:: Constants.hpp
12 changes: 0 additions & 12 deletions docs/build/html/_sources/reference/globals.rst.txt

This file was deleted.

5 changes: 2 additions & 3 deletions docs/build/html/_sources/reference/index.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,15 @@ API Reference
error_logger.rst
font.rst
rect.rst
render_window.rst
sound.rst
texture.rst
tile_map.rst
cache.rst
constants.rst
draw.rst
globals.rst
input.rst
math.rst
music.rst
overflow.rst
time.rst

window.rst
6 changes: 0 additions & 6 deletions docs/build/html/_sources/reference/render_window.rst.txt

This file was deleted.

5 changes: 5 additions & 0 deletions docs/build/html/_sources/reference/window.rst.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
======
window
======

.. doxygennamespace:: kn::window
492 changes: 245 additions & 247 deletions docs/build/html/genindex.html

Large diffs are not rendered by default.

41 changes: 21 additions & 20 deletions docs/build/html/getting_started/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -166,18 +166,18 @@
<li class="toctree-l2"><a class="reference internal" href="../reference/error_logger.html">ErrorLogger</a></li>
<li class="toctree-l2"><a class="reference internal" href="../reference/font.html">Font</a></li>
<li class="toctree-l2"><a class="reference internal" href="../reference/rect.html">Rect</a></li>
<li class="toctree-l2"><a class="reference internal" href="../reference/render_window.html">RenderWindow</a></li>
<li class="toctree-l2"><a class="reference internal" href="../reference/sound.html">Sound</a></li>
<li class="toctree-l2"><a class="reference internal" href="../reference/texture.html">Texture</a></li>
<li class="toctree-l2"><a class="reference internal" href="../reference/tile_map.html">TileMap</a></li>
<li class="toctree-l2"><a class="reference internal" href="../reference/cache.html">cache</a></li>
<li class="toctree-l2"><a class="reference internal" href="../reference/constants.html">constants</a></li>
<li class="toctree-l2"><a class="reference internal" href="../reference/draw.html">draw</a></li>
<li class="toctree-l2"><a class="reference internal" href="../reference/globals.html">globals</a></li>
<li class="toctree-l2"><a class="reference internal" href="../reference/input.html">input</a></li>
<li class="toctree-l2"><a class="reference internal" href="../reference/math.html">math</a></li>
<li class="toctree-l2"><a class="reference internal" href="../reference/music.html">music</a></li>
<li class="toctree-l2"><a class="reference internal" href="../reference/overflow.html">overflow</a></li>
<li class="toctree-l2"><a class="reference internal" href="../reference/time.html">time</a></li>
<li class="toctree-l2"><a class="reference internal" href="../reference/window.html">window</a></li>
</ul>
</li>
</ul>
Expand Down Expand Up @@ -219,28 +219,29 @@ <h1>Getting Started<a class="headerlink" href="#getting-started" title="Link to
<section id="creating-a-window">
<h2>Creating a Window<a class="headerlink" href="#creating-a-window" title="Link to this heading">#</a></h2>
<p>After following the <a class="reference internal" href="../installation.html"><span class="doc">Installation</span></a> guide, you are ready for your first Kraken Engine program.</p>
<div class="highlight-c notranslate"><div class="highlight"><pre><span></span><span class="linenos"> 1</span><span class="cp">#include</span><span class="w"> </span><span class="cpf">&lt;KrakenEngine.hpp&gt;</span>
<div class="highlight-c++ notranslate"><div class="highlight"><pre><span></span><span class="linenos"> 1</span><span class="cp">#include</span><span class="w"> </span><span class="cpf">&lt;KrakenEngine.hpp&gt;</span>
<span class="linenos"> 2</span>
<span class="linenos"> 3</span><span class="k">const</span><span class="w"> </span><span class="n">kn</span><span class="o">::</span><span class="n">math</span><span class="o">::</span><span class="n">Vec2</span><span class="w"> </span><span class="n">kn</span><span class="o">::</span><span class="n">SCREEN_SIZE</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="mi">800</span><span class="p">,</span><span class="w"> </span><span class="mi">600</span><span class="w"> </span><span class="p">};</span>
<span class="linenos"> 4</span>
<span class="linenos"> 5</span>
<span class="linenos"> 6</span><span class="kt">int</span><span class="w"> </span><span class="nf">main</span><span class="p">()</span><span class="w"> </span><span class="p">{</span>
<span class="linenos"> 7</span><span class="w"> </span><span class="n">kn</span><span class="o">::</span><span class="n">RenderWindow</span><span class="o">&amp;</span><span class="w"> </span><span class="n">window</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">kn</span><span class="o">::</span><span class="n">RenderWindow</span><span class="o">::</span><span class="n">get</span><span class="p">();</span>
<span class="linenos"> 8</span><span class="w"> </span><span class="n">kn</span><span class="o">::</span><span class="n">time</span><span class="o">::</span><span class="n">Clock</span><span class="w"> </span><span class="n">clock</span><span class="p">;</span>
<span class="linenos"> 9</span>
<span class="linenos">10</span><span class="w"> </span><span class="kt">bool</span><span class="w"> </span><span class="n">done</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nb">false</span><span class="p">;</span>
<span class="linenos">11</span><span class="w"> </span><span class="k">while</span><span class="w"> </span><span class="p">(</span><span class="o">!</span><span class="n">done</span><span class="p">)</span><span class="w"> </span><span class="p">{</span>
<span class="linenos">12</span><span class="w"> </span><span class="n">clock</span><span class="p">.</span><span class="n">tick</span><span class="p">();</span>
<span class="linenos">13</span>
<span class="linenos">14</span><span class="w"> </span><span class="k">for</span><span class="w"> </span><span class="p">(</span><span class="k">const</span><span class="w"> </span><span class="k">auto</span><span class="w"> </span><span class="o">&amp;</span><span class="n">event</span><span class="w"> </span><span class="o">:</span><span class="w"> </span><span class="n">window</span><span class="p">.</span><span class="n">getEvents</span><span class="p">())</span>
<span class="linenos">15</span><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="p">(</span><span class="n">event</span><span class="p">.</span><span class="n">type</span><span class="w"> </span><span class="o">==</span><span class="w"> </span><span class="n">kn</span><span class="o">::</span><span class="n">QUIT</span><span class="p">)</span><span class="w"> </span><span class="n">done</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nb">true</span><span class="p">;</span>
<span class="linenos"> 3</span><span class="kt">int</span><span class="w"> </span><span class="nf">main</span><span class="p">()</span>
<span class="linenos"> 4</span><span class="p">{</span>
<span class="linenos"> 5</span><span class="w"> </span><span class="n">kn</span><span class="o">::</span><span class="n">window</span><span class="o">::</span><span class="n">init</span><span class="p">({</span><span class="w"> </span><span class="mi">800</span><span class="p">,</span><span class="w"> </span><span class="mi">600</span><span class="w"> </span><span class="p">});</span>
<span class="linenos"> 6</span><span class="w"> </span><span class="n">kn</span><span class="o">::</span><span class="n">time</span><span class="o">::</span><span class="n">Clock</span><span class="w"> </span><span class="n">clock</span><span class="p">;</span>
<span class="linenos"> 7</span>
<span class="linenos"> 8</span><span class="w"> </span><span class="kt">bool</span><span class="w"> </span><span class="n">done</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nb">false</span><span class="p">;</span>
<span class="linenos"> 9</span><span class="w"> </span><span class="k">while</span><span class="w"> </span><span class="p">(</span><span class="o">!</span><span class="n">done</span><span class="p">)</span>
<span class="linenos">10</span><span class="w"> </span><span class="p">{</span>
<span class="linenos">11</span><span class="w"> </span><span class="n">clock</span><span class="p">.</span><span class="n">tick</span><span class="p">();</span>
<span class="linenos">12</span>
<span class="linenos">13</span><span class="w"> </span><span class="k">for</span><span class="w"> </span><span class="p">(</span><span class="k">const</span><span class="w"> </span><span class="k">auto</span><span class="w"> </span><span class="o">&amp;</span><span class="n">event</span><span class="w"> </span><span class="o">:</span><span class="w"> </span><span class="n">kn</span><span class="o">::</span><span class="n">window</span><span class="o">::</span><span class="n">getEvents</span><span class="p">())</span>
<span class="linenos">14</span><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="p">(</span><span class="n">event</span><span class="p">.</span><span class="n">type</span><span class="w"> </span><span class="o">==</span><span class="w"> </span><span class="n">kn</span><span class="o">::</span><span class="n">QUIT</span><span class="p">)</span>
<span class="linenos">15</span><span class="w"> </span><span class="n">done</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nb">true</span><span class="p">;</span>
<span class="linenos">16</span>
<span class="linenos">17</span><span class="w"> </span><span class="n">window</span><span class="p">.</span><span class="n">cls</span><span class="p">();</span>
<span class="linenos">18</span><span class="w"> </span><span class="n">window</span><span class="p">.</span><span class="n">flip</span><span class="p">();</span>
<span class="linenos">17</span><span class="w"> </span><span class="n">kn</span><span class="o">::</span><span class="n">window</span><span class="o">::</span><span class="n">cls</span><span class="p">();</span>
<span class="linenos">18</span><span class="w"> </span><span class="n">kn</span><span class="o">::</span><span class="n">window</span><span class="o">::</span><span class="n">flip</span><span class="p">();</span>
<span class="linenos">19</span><span class="w"> </span><span class="p">}</span>
<span class="linenos">20</span>
<span class="linenos">21</span><span class="w"> </span><span class="k">return</span><span class="w"> </span><span class="n">EXIT_SUCCESS</span><span class="p">;</span>
<span class="linenos">22</span><span class="p">}</span>
<span class="linenos">21</span><span class="w"> </span><span class="n">kn</span><span class="o">::</span><span class="n">window</span><span class="o">::</span><span class="n">quit</span><span class="p">();</span>
<span class="linenos">22</span><span class="w"> </span><span class="k">return</span><span class="w"> </span><span class="n">EXIT_SUCCESS</span><span class="p">;</span>
<span class="linenos">23</span><span class="p">}</span>
</pre></div>
</div>
<p>This code opens a window and closes it when the user presses the window’s X button.
Expand Down
4 changes: 2 additions & 2 deletions docs/build/html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -166,18 +166,18 @@
<li class="toctree-l2"><a class="reference internal" href="reference/error_logger.html">ErrorLogger</a></li>
<li class="toctree-l2"><a class="reference internal" href="reference/font.html">Font</a></li>
<li class="toctree-l2"><a class="reference internal" href="reference/rect.html">Rect</a></li>
<li class="toctree-l2"><a class="reference internal" href="reference/render_window.html">RenderWindow</a></li>
<li class="toctree-l2"><a class="reference internal" href="reference/sound.html">Sound</a></li>
<li class="toctree-l2"><a class="reference internal" href="reference/texture.html">Texture</a></li>
<li class="toctree-l2"><a class="reference internal" href="reference/tile_map.html">TileMap</a></li>
<li class="toctree-l2"><a class="reference internal" href="reference/cache.html">cache</a></li>
<li class="toctree-l2"><a class="reference internal" href="reference/constants.html">constants</a></li>
<li class="toctree-l2"><a class="reference internal" href="reference/draw.html">draw</a></li>
<li class="toctree-l2"><a class="reference internal" href="reference/globals.html">globals</a></li>
<li class="toctree-l2"><a class="reference internal" href="reference/input.html">input</a></li>
<li class="toctree-l2"><a class="reference internal" href="reference/math.html">math</a></li>
<li class="toctree-l2"><a class="reference internal" href="reference/music.html">music</a></li>
<li class="toctree-l2"><a class="reference internal" href="reference/overflow.html">overflow</a></li>
<li class="toctree-l2"><a class="reference internal" href="reference/time.html">time</a></li>
<li class="toctree-l2"><a class="reference internal" href="reference/window.html">window</a></li>
</ul>
</li>
</ul>
Expand Down
4 changes: 2 additions & 2 deletions docs/build/html/installation.html
Original file line number Diff line number Diff line change
Expand Up @@ -166,18 +166,18 @@
<li class="toctree-l2"><a class="reference internal" href="reference/error_logger.html">ErrorLogger</a></li>
<li class="toctree-l2"><a class="reference internal" href="reference/font.html">Font</a></li>
<li class="toctree-l2"><a class="reference internal" href="reference/rect.html">Rect</a></li>
<li class="toctree-l2"><a class="reference internal" href="reference/render_window.html">RenderWindow</a></li>
<li class="toctree-l2"><a class="reference internal" href="reference/sound.html">Sound</a></li>
<li class="toctree-l2"><a class="reference internal" href="reference/texture.html">Texture</a></li>
<li class="toctree-l2"><a class="reference internal" href="reference/tile_map.html">TileMap</a></li>
<li class="toctree-l2"><a class="reference internal" href="reference/cache.html">cache</a></li>
<li class="toctree-l2"><a class="reference internal" href="reference/constants.html">constants</a></li>
<li class="toctree-l2"><a class="reference internal" href="reference/draw.html">draw</a></li>
<li class="toctree-l2"><a class="reference internal" href="reference/globals.html">globals</a></li>
<li class="toctree-l2"><a class="reference internal" href="reference/input.html">input</a></li>
<li class="toctree-l2"><a class="reference internal" href="reference/math.html">math</a></li>
<li class="toctree-l2"><a class="reference internal" href="reference/music.html">music</a></li>
<li class="toctree-l2"><a class="reference internal" href="reference/overflow.html">overflow</a></li>
<li class="toctree-l2"><a class="reference internal" href="reference/time.html">time</a></li>
<li class="toctree-l2"><a class="reference internal" href="reference/window.html">window</a></li>
</ul>
</li>
</ul>
Expand Down
Binary file modified docs/build/html/objects.inv
Binary file not shown.
Loading

0 comments on commit d458e9c

Please sign in to comment.