Skip to content

Commit

Permalink
Documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
nemene21 committed Jul 9, 2024
1 parent 5634925 commit c0edcef
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/framework/framework.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include <objects/particles.hpp>
#include <objects/audio.hpp>

/// @brief Used to initialise the framework and run it in main.cpp
class Framework {
private:
static void process_modules(float delta);
Expand Down
2 changes: 2 additions & 0 deletions src/framework/objects/drawables.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ class ShaderBond {
std::string name;
} BoundTexture;

/// @brief Used internally for buffering shader uniform updates
typedef struct {
std::string name; void *ptr; int type;
} UniformUpdate;
Expand Down Expand Up @@ -135,6 +136,7 @@ class Drawable {
float angle;
Color tint;

/// @brief If this is true on init the Drawable is going to be rendered on the UI layer
bool is_ui;

/// @brief Drawables with a lower z_coord are drawn behind one another
Expand Down
5 changes: 5 additions & 0 deletions src/framework/objects/progress_bar.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define PROGRESS_BAR_H
#include <ui_drawables.hpp>

/// @brief Draws a progress bar on the UI layer
class ProgressBar: public UIDrawable {
public:
float width, height, value, maximum, progress, ease_progress;
Expand All @@ -10,6 +11,10 @@ class ProgressBar: public UIDrawable {

void process(float delta);
void draw();
/// @brief Sets the colors of the progress bar
/// @param background Background color
/// @param progress Color of the progress part of the bar
/// @param ease Color of the animated lagging part of the bar
void set_color_scheme(Color background, Color progress, Color ease);
};

Expand Down
10 changes: 10 additions & 0 deletions src/framework/objects/ui_drawables.hpp
Original file line number Diff line number Diff line change
@@ -1,13 +1,23 @@
#include <drawables.hpp>

/// @brief UI drawables get drawn on their own layer on top of the game layer
class UIDrawable: public Drawable {
public:
/// @brief 0, 0 for no centering; 0.5, 0.5 for centering
Vector2 centering;
float width, height;
UIDrawable(float width, float height, Vector2 centering={0, 0});

/// @brief Returns width of the UIDrawable taking into account scale
/// @return Width of UIDrawable
float get_width();
/// @brief Returns height of the UIDrawable taking into account scale
/// @return Height of UIDrawable
float get_height();
/// @brief Returns dimensions of the UIDrawable taking into account scale
/// @return Dimensions of UIDrawable
Vector2 get_dimensions();
/// @brief Returns position of the UIDrawable taking into account centering
/// @return Position of UIDrawable
Vector2 real_pos();
};

0 comments on commit c0edcef

Please sign in to comment.