Olympe Engine 2.0
2D Game Engine with ECS Architecture
Loading...
Searching...
No Matches
Functions | Variables
drawing.cpp File Reference
#include "drawing.h"
#include <SDL3/SDL_render.h>
#include <cmath>
#include "GameEngine.h"
#include "RenderContext.h"
+ Include dependency graph for drawing.cpp:

Go to the source code of this file.

Functions

static SDL_FColor ToFColor (const SDL_Color &c)
 
static SDL_Color ToColor (const SDL_FColor &f)
 
void Draw_Circle (int cx, int cy, int radius)
 
void Draw_FilledCircle (int cx, int cy, int radius)
 
void Draw_Triangle (Vector p1, Vector p2, Vector p3)
 
void Draw_FilledTriangle (const Vector &p1, const Vector &p2, const Vector &p3, SDL_FColor color)
 
void Draw_FilledHexagon (Vector center, float radius, SDL_FColor color)
 
void Draw_Hexagon (Vector center, float radius, SDL_Color color)
 
void Draw_Rectangle (const SDL_FRect *rect, SDL_Color color)
 
void Draw_Text (const std::string &text, const SDL_FRect *rect, SDL_Color textcolor, SDL_Color backgroundcolor)
 

Variables

static const float PI = static_cast<float>(std::acos(-1.0))
 
static const float HEXAGON_COS_ANGLES [6]
 
static const float HEXAGON_SIN_ANGLES [6]
 

Function Documentation

◆ Draw_Circle()

void Draw_Circle ( int  cx,
int  cy,
int  radius 
)

Definition at line 69 of file drawing.cpp.

References RenderContext::Get(), RenderContext::GetActiveCamera(), GetComponentTypeID_Static(), and GameEngine::renderer.

Referenced by OlympeEffectSystem::Implementation::RenderPlasmaOrbs().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Draw_FilledCircle()

void Draw_FilledCircle ( int  cx,
int  cy,
int  radius 
)

Definition at line 135 of file drawing.cpp.

References RenderContext::Get(), RenderContext::GetActiveCamera(), GetComponentTypeID_Static(), and GameEngine::renderer.

Referenced by AI_Player::RenderDebug(), RenderEntitiesForCamera(), and RenderSingleEntity().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Draw_FilledHexagon()

void Draw_FilledHexagon ( Vector  center,
float  radius,
SDL_FColor  color 
)

◆ Draw_FilledTriangle()

void Draw_FilledTriangle ( const Vector p1,
const Vector p2,
const Vector p3,
SDL_FColor  color 
)

Definition at line 201 of file drawing.cpp.

References RenderContext::Get(), RenderContext::GetActiveCamera(), GetComponentTypeID_Static(), GameEngine::renderer, and Vector::ToFPoint().

+ Here is the call graph for this function:

◆ Draw_Hexagon()

void Draw_Hexagon ( Vector  center,
float  radius,
SDL_Color  color 
)

Definition at line 279 of file drawing.cpp.

References RenderContext::Get(), RenderContext::GetActiveCamera(), GetComponentTypeID_Static(), HEXAGON_COS_ANGLES, HEXAGON_SIN_ANGLES, and GameEngine::renderer.

+ Here is the call graph for this function:

◆ Draw_Rectangle()

void Draw_Rectangle ( const SDL_FRect rect,
SDL_Color  color 
)

Definition at line 309 of file drawing.cpp.

References RenderContext::Get(), RenderContext::GetActiveCamera(), GetComponentTypeID_Static(), and GameEngine::renderer.

Referenced by RenderEntitiesForCamera(), and RenderSingleEntity().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Draw_Text()

void Draw_Text ( const std::string text,
const SDL_FRect rect,
SDL_Color  textcolor,
SDL_Color  backgroundcolor 
)

Definition at line 345 of file drawing.cpp.

References RenderContext::Get(), RenderContext::GetActiveCamera(), GetComponentTypeID_Static(), GameEngine::renderer, and Vector::x.

Referenced by RenderEntitiesForCamera(), and RenderSingleEntity().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Draw_Triangle()

void Draw_Triangle ( Vector  p1,
Vector  p2,
Vector  p3 
)

Definition at line 178 of file drawing.cpp.

References RenderContext::Get(), RenderContext::GetActiveCamera(), GetComponentTypeID_Static(), and GameEngine::renderer.

+ Here is the call graph for this function:

◆ ToColor()

static SDL_Color ToColor ( const SDL_FColor f)
inlinestatic

Definition at line 53 of file drawing.cpp.

References GetComponentTypeID_Static().

+ Here is the call graph for this function:

◆ ToFColor()

static SDL_FColor ToFColor ( const SDL_Color c)
inlinestatic

Definition at line 43 of file drawing.cpp.

References GetComponentTypeID_Static().

+ Here is the call graph for this function:

Variable Documentation

◆ HEXAGON_COS_ANGLES

const float HEXAGON_COS_ANGLES[6]
static
Initial value:
= {
1.0f,
0.5f,
-0.5f,
-1.0f,
-0.5f,
0.5f
}

Definition at line 24 of file drawing.cpp.

Referenced by Draw_FilledHexagon(), and Draw_Hexagon().

◆ HEXAGON_SIN_ANGLES

const float HEXAGON_SIN_ANGLES[6]
static
Initial value:
= {
0.0f,
0.866025404f,
0.866025404f,
0.0f,
-0.866025404f,
-0.866025404f
}

Definition at line 33 of file drawing.cpp.

Referenced by Draw_FilledHexagon(), and Draw_Hexagon().

◆ PI

const float PI = static_cast<float>(std::acos(-1.0))
static

Definition at line 20 of file drawing.cpp.