Skip to content

Commit

Permalink
0.0.6dev (#31)
Browse files Browse the repository at this point in the history
User does event polling instead of an internal vector
Documentation visual quality improvement with category dropdowns
Animation struct for more control over how animations are rendered
getTicks now works
Documentation for contributing has been created
Kraken handles window closing and controller connected/disconnected events
Basically the input namespace got scattered
requirements.txt for necessary pip packages to contribute
  • Loading branch information
durkisneer1 authored Dec 10, 2024
1 parent 6e0286a commit 1ccc733
Show file tree
Hide file tree
Showing 48 changed files with 928 additions and 802 deletions.
6 changes: 0 additions & 6 deletions docs/_static/css/algolia.css

This file was deleted.

10 changes: 5 additions & 5 deletions docs/_static/css/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -592,6 +592,11 @@ html.writer-html5 .rst-content dl:not(.docutils) > dt, html.writer-html5 .rst-co
background: var(--highlight-background-color);
}

dl.simple dt {
border-bottom: 1px solid var(--hr-color);
background: none !important;
}

html.writer-html5 .rst-content dl:not(.docutils) dl:not(.option-list):not(.field-list):not(.footnote):not(.citation):not(.glossary):not(.simple) > dt, html.writer-html5 .rst-content dl[class]:not(.option-list):not(.field-list):not(.footnote):not(.citation):not(.glossary):not(.simple) dl:not(.option-list):not(.field-list):not(.footnote):not(.citation):not(.glossary):not(.simple) > dt {
border-left-color: var(--highlight-background-emph-color);
background: var(--highlight-background-color);
Expand Down Expand Up @@ -1905,8 +1910,3 @@ p + .classref-constant {
padding: 3px 5px;
}
}

/* Giscus */
#godot-giscus {
margin-bottom: 1em;
}
434 changes: 21 additions & 413 deletions docs/_static/js/custom.js

Large diffs are not rendered by default.

Binary file added docs/_static/rect.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
49 changes: 20 additions & 29 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import os
import subprocess

breathe_projects = {'KrakenEngine': 'xml'}
breathe_default_project = 'KrakenEngine'
breathe_projects = {"KrakenEngine": "xml"}
breathe_default_project = "KrakenEngine"

needs_sphinx = "7.1"

extensions = [
'breathe',
'sphinx.ext.autosectionlabel',
'notfound.extension',
"breathe",
"sphinx.ext.autosectionlabel",
"notfound.extension",
]

notfound_context = {
Expand All @@ -35,22 +35,22 @@

on_rtd = os.environ.get("READTHEDOCS", None) == "True"
if on_rtd:
subprocess.call('doxygen', shell=True)
subprocess.call("doxygen", shell=True)
else:
notfound_urls_prefix = ''

templates_path = ["_templates"]

source_suffix = '.rst'
source_suffix = ".rst"
source_encoding = "utf-8-sig"

master_doc = 'index'
master_doc = "index"

project = 'Kraken Engine'
copyright = '2024, Derrick Martinez'
author = 'Derrick Martinez'
project = "Kraken Engine"
copyright = "2024, Derrick Martinez"
author = "Derrick Martinez"

version = os.getenv("READTHEDOCS_VERSION", "0.0.3")
version = os.getenv("READTHEDOCS_VERSION", "0.0.6")
release = version

exclude_patterns = ["_build"]
Expand All @@ -66,7 +66,6 @@
html_theme_options = {
"logo_only": True,
"collapse_navigation": False,
"display_version": False,
}

html_title = f"Kraken Engine ({version}) documentation in English"
Expand All @@ -75,33 +74,25 @@
"display_github": True, # Integrate GitHub
"github_user": "durkisneer1", # Username
"github_repo": "Kraken-Engine", # Repo name
"github_version": "0.0.3", # Version
"conf_py_path": "/", # Path in the checkout to the docs root
"github_version": "main", # Version
"conf_py_path": "/docs/", # Path in the checkout to the docs root
"kraken_docs_title": html_title,
"kraken_docs_basepath": "https://kraken-engine.readthedocs.io/",
"kraken_docs_suffix": ".html",
"kraken_default_lang": "en",
"kraken_canonical_version": "stable",
# Set this to `True` when in the `latest` branch to clearly indicate to the reader
# that they are not reading the `stable` documentation.
"kraken_is_latest": False,
"kraken_version": "0.0.3",
"kraken_is_latest": True,
"kraken_version": "0.0.6",
# Enables a banner that displays the up-to-date status of each article.
"kraken_show_article_status": True,
}

html_logo = "_static/kraken-engine-banner.png"
html_static_path = ['_static']

html_css_files = [
'css/algolia.css',
'https://cdn.jsdelivr.net/npm/@docsearch/css@3',
"css/custom.css",
]

html_js_files = [
"js/custom.js",
]
html_static_path = ["_static"]
html_css_files = ["css/custom.css"]
html_js_files = ["js/custom.js"]

file_insertion_enabled = False

Expand All @@ -110,4 +101,4 @@

gettext_compact = False

epub_tocscope = 'includehidden'
epub_tocscope = "includehidden"
70 changes: 70 additions & 0 deletions docs/contributing/guidelines.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
Coding Guidelines
=================

This document outlines the coding guidelines for Kraken Engine.
These guidelines are intended to ensure that Kraken stays in its best shape and documentation is consistent and easy to read.

General Principles
------------------

- **Consistency**: Follow the style of the surrounding code. This is elaborated in the next section.
- **Clarity**: Write code that's easy to read and understand. This means using descriptive names for variables, functions, and classes.
- **Documentation**: Write clear, concise, and useful comments.
- **Testing**: Write tests for your code (you may ask an experienced contributor to assist you).
- **Error Handling**: Check for errors and handle them appropriately.


Style Guidelines
----------------

Kraken Engine uses a consistent code style defined by the ``.clang-format`` file in the root directory. Additionally, the ``.pre-commit-config.yaml`` file automatically runs clang-format on staged files before committing, ensuring proper formatting.

However, the formatter doesn't catch everything. Please follow these additional guidelines:

- **Naming Conventions**:
- Classes, Structs, and Enums: ``PascalCase``
- Functions and Variables: ``camelCase``
- Constants: ``ALL_CAPS``
- Header Files: ``PascalCase.hpp``
- Source Files: ``snake_case.cpp``
- **Header Includes**: Only include headers that are strictly necessary in a given file. Avoid including general-purpose headers (e.g., ``<iostream>``) in header files unless they are directly needed there. Instead, include them in source files where applicable. This practice reduces unnecessary dependencies and improves compile times.
- **Comments**: Focus comments on the *why* behind your code, not the *what*. Clear and descriptive function and variable names should make the code's intent self-explanatory.

Documentation Guidelines
------------------------

Kraken Engine uses **Sphinx** and **Doxygen** for generating documentation.
Follow these guidelines to maintain consistency and clarity:

Writing Docstrings
~~~~~~~~~~~~~~~~~~

When writing docstrings, adhere to the **Doxygen** format. Here's an example:

.. code-block:: cpp
/**
* @brief Adds two numbers.
*
* @param a The left-hand side operand.
* @param b The right-hand side operand.
*
* @return The sum of a and b.
*/
int addNums(int a, int b);
For more details on Doxygen formatting, refer to the `official Doxygen documentation <https://www.doxygen.nl/manual/docblocks.html>`_.

Writing Documentation
~~~~~~~~~~~~~~~~~~~~~

Use **reStructuredText (RST)** format for creating and editing documentation files.

- If you add a new class, function, or namespace to the codebase, create a corresponding ``.rst`` file in the appropriate directory under ``docs/``.
- Include the following details in the ``.rst`` file:
- A clear description of the class, function, or namespace.
- Example usage code (if applicable).
- Doxygen's generated documentation.

For guidance on RST syntax, check the `official Sphinx documentation <https://www.sphinx-doc.org/en/master/usage/restructuredtext/index.html>`_.
You can also review existing ``.rst`` files in the repository as examples.
70 changes: 67 additions & 3 deletions docs/contributing/how_to_contribute.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,71 @@
How To Contribute
=================

This page is currently under construction. Please check back later for updates.
Welcome!
Your contributions help make Kraken Engine better for everyone,
whether it's fixing a bug, adding a feature, or improving the documentation.

.. image:: ../_static/under_construction.gif
:alt: Page Under Construction
Prerequisites
-------------

Before you begin, ensure you have:

- A GitHub account
- Git installed locally
- A C/C++ compiler (e.g., GCC, Clang, MSVC)
- Python 3.9 or later
- Doxygen
- Familiarity with our :doc:`guidelines`

Setting Up
----------

The Kraken Engine repository uses a `dev` branch (e.g., ``0.0.6dev``) for upcoming releases.
Base your work on this branch.

1. Fork and clone the current `dev` branch.
2. Run ``pip install -r requirements.txt`` to install dependencies.

Compiling
---------

To control which of the following targets you want to build, change the options in ``meson_options.txt``.
For example, both ``build_example`` and ``build_tests`` set to ``false`` builds only the library.
Then, run either of the following commands:

Library Only
~~~~~~~~~~~~

.. code-block:: bash
meson setup build
meson compile kraken -C build
Library + Example Demo
~~~~~~~~~~~~~~~~~~~~~~

.. code-block:: bash
meson setup build
meson compile krakenapp -C build
Library + Test Suite
~~~~~~~~~~~~~~~~~~~~

.. code-block:: bash
meson setup build
meson compile krakentests -C build
Making Changes
--------------

*Before making changes to Kraken, please read the* :doc:`guidelines`.

1. Commit and push your changes to your fork.
2. Submit a pull request to the `dev` branch of the Kraken Engine repository.
3. Address any feedback from maintainers.
4. Once approved, your changes will be merged, and you will be credited in the changelog.

Thank you for contributing to Kraken Engine!
37 changes: 37 additions & 0 deletions docs/contributing/testing.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
Testing Your Contributions
==========================

Before submitting a pull request, you should run tests and preview the documentation to ensure that your changes are correct.

Testing Code
----------------

If you haven't already, read through building the *test suite* in the :doc:`how_to_contribute` section.

Tests are written using the Google Test framework and can be found in the ``tests`` directory.
After making changes or adding new features, run the test suite to ensure that your changes do not break existing or new functionality.

Previewing Documentation
------------------------

1. Install the required dependencies via pip:

.. code-block:: bash
pip install -r docs/requirements.txt
2. Generate the documentation with Doxygen:

.. code-block:: bash
cd docs
doxygen
1. Build the documentation:

.. code-block:: bash
make -C docs html
You will find the generated documentation in the ``docs/_build/html`` directory.
If everything looks as intended, you can submit your pull request.
49 changes: 35 additions & 14 deletions docs/getting_started/create_window.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,51 @@ Creating a Window
=================

After following the :doc:`installation` guide, you are ready for your first Kraken Engine program.
The following code creates a window and keeps it open until the user closes it.

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

#include <KrakenEngine.hpp>

int main()
{
int main() {
kn::window::init({800, 600});
kn::time::Clock clock;
kn::Event event;

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

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

kn::window::clear();
while (kn::window::isOpen()) {
while (kn::window::pollEvent(event)) {
// handle events
}
kn::window::flip();
}

kn::window::quit();

return EXIT_SUCCESS;
}

Explanation
-----------

This simple program serves as a basic skeleton for applications built with the Kraken Engine.
Let's break down the key components that make this program function:

* Initializing the Window
``kn::window::init({800, 600})`` sets up a rendering window with a resolution of 800x600 pixels.
This function prepares the underlying graphical context, ensuring the application is ready to display content.

* Event Handling
Before entering the main game loop, an ``Event`` union is instantiated.
This union acts as a container for user inputs and system events.
The call to ``kn::window::pollEvent(event)`` continuously monitors for user interactions or system-generated signals, populating the event union with the details of the most recent occurrence.

* Closing the Application
By default, Kraken Engine applications close when the user clicks the window’s close button.
Upon detecting this event internally, the call to ``kn::window::close()`` ends the game loop.

* Updating the Display
``kn::window::flip()`` acts as the final piece in the game loop, swapping the back buffer to the front.
This step ensures that any rendering operations performed during the loop are visually updated on the screen.
Think of it as flipping the pages of a book—ensuring smooth, sequential updates for the user.

This template establishes a foundation for more advanced game logic and rendering.
In-depth tutorials on the next page cover the more intricate aspects of the Kraken Engine.
Loading

0 comments on commit 1ccc733

Please sign in to comment.