Skip to content

Commit

Permalink
contributing and installing doc update
Browse files Browse the repository at this point in the history
  • Loading branch information
durkisneer1 committed Dec 8, 2024
1 parent 9a036d4 commit 973708a
Show file tree
Hide file tree
Showing 8 changed files with 254 additions and 23 deletions.
5 changes: 5 additions & 0 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
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.
36 changes: 31 additions & 5 deletions docs/getting_started/create_window.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,11 @@ The following code creates a window and keeps it open until the user closes it.

#include <KrakenEngine.hpp>

int main()
{
int main() {
kn::window::init({800, 600});

kn::Event event;
while (kn::window::isOpen())
{

while (kn::window::isOpen()) {
kn::window::pollEvent(event);
if (event.type == kn::QUIT)
kn::window::close();
Expand All @@ -26,3 +24,31 @@ The following code creates a window and keeps it open until the user closes it.

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
The event-handling system allows the program to respond dynamically to user actions.
Specifically, ``if (event.type == kn::QUIT)`` detects when the user clicks the window’s close button.
Upon detecting this event, 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.
27 changes: 24 additions & 3 deletions docs/getting_started/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,35 @@ Before starting, ensure you have the Meson build system and a C++ compiler insta
mkdir subprojects
2. Run ``meson wrap install kraken-engine`` to install the latest version of Kraken Engine.
2. Use the following command to install the latest version of Kraken Engine:

3. Include the Kraken Engine dependency in your Meson build file.
.. code-block:: bash
meson wrap install kraken-engine
3. Include the Kraken Engine dependency in your Meson build file (usually ``meson.build``).

.. code-block:: python
project('MyProject', 'cpp', default_options: ['cpp_std=c++17', 'default_library=static'])
kraken_dep = dependency('kraken-engine')
executable('MyProject', 'main.cpp', dependencies: kraken_dep)
4. Continue with the typical Meson build and compile process.
4. Build and compile your project using Meson:

.. code-block:: bash
meson setup build
cd build
meson compile
You can also use the ``-j`` flag to specify the number of threads to use to speed up compilation (e.g., ``meson compile -j4``).

Updating
--------

To update Kraken Engine to the latest version, use the following command:

.. code-block:: bash
meson wrap update kraken-engine
30 changes: 18 additions & 12 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -1,31 +1,35 @@
Kraken Engine Docs
==================

The **Kraken Engine** is a powerful extension to *SDL2*, designed to streamline your
game development process. It provides a suite of easy-to-use features such as texture
caching and collision logic, allowing you to focus on creating immersive experiences
for your players.
The **Kraken Engine** is a robust extension to *SDL2*, designed to strike a balance between high- and low-level control in game development.
It supports input handling, audio management, and extra utilities like tile maps and animation controllers.

About
-----

This documentation is a comprehensive guide to the Kraken Engine, covering everything
from installation to advanced features. It's intended for both beginners and
experienced developers.
This documentation provides a comprehensive guide to the Kraken Engine, catering to developers with a foundational understanding of C++.
As the engine evolves, it will also become increasingly accessible to beginners, with a friendlier API and enhanced documentation.

Future of Kraken Engine
-----------------------

Future plans for the Kraken Engine include the implementation of essential mathematical
functions like pathfinding, ray casting, and a built-in physics engine, further enhancing
its capabilities and versatility.
Planned features for the Kraken Engine include implementing essential mathematical tools like pathfinding, ray casting, and a built-in physics engine.
These additions will further expand the engine’s capabilities and make it a one-stop solution for 2D game development.

Advanced Features
-----------------

The Kraken Engine stands out with its:

- **Animation Controller Class**: A utility for managing sprite sheet animations efficiently.
- **Tile Map Class**: Simplifying the process of loading, rendering, and managing tile maps.

Community
---------

Join our `discord <https://discord.gg/GyyddE7AD5>`_ to get help, share your projects, and contribute to the Kraken Engine!
Join our `Discord <https://discord.gg/GyyddE7AD5>`_ to connect with fellow developers, share your projects, and contribute to the Kraken Engine.

We look forward to seeing the incredible games you create with the Kraken Engine.
We’re excited to see how you push the boundaries of creativity with the Kraken Engine!

.. toctree::
:hidden:
Expand All @@ -48,6 +52,8 @@ We look forward to seeing the incredible games you create with the Kraken Engine
:caption: Contributing

contributing/how_to_contribute
contributing/guidelines
contributing/testing

.. toctree::
:hidden:
Expand Down
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
meson
ninja

0 comments on commit 973708a

Please sign in to comment.