Mountain  1.0.0
Simple C++ 2D Game Framework
Mountain::Draw Class Reference

The Draw class contains static functions to draw various things on screen. More...

#include <draw.hpp>

Static Public Member Functions

static MOUNTAIN_API void Clear (const Color &color)
 Clear the current RenderTarget. More...
 
static MOUNTAIN_API void Point (Vector2 position, const Color &color=Color::White())
 
static MOUNTAIN_API void Line (Vector2 point1, Vector2 point2, const Color &color=Color::White())
 Draw a line. More...
 
static MOUNTAIN_API void Line (Vector2 point1, Vector2 point2, const Color &color1, const Color &color2)
 Draw a line. More...
 
static MOUNTAIN_API void Triangle (Vector2 point1, Vector2 point2, Vector2 point3, const Color &color=Color::White())
 Draw a hollow triangle. More...
 
static MOUNTAIN_API void Triangle (Vector2 point1, Vector2 point2, Vector2 point3, const Color &color1, const Color &color2, const Color &color3)
 Draw a hollow triangle. More...
 
static MOUNTAIN_API void TriangleFilled (Vector2 point1, Vector2 point2, Vector2 point3, const Color &color=Color::White())
 Draw a filled triangle. More...
 
static MOUNTAIN_API void TriangleFilled (Vector2 point1, Vector2 point2, Vector2 point3, const Color &color1, const Color &color2, const Color &color3)
 Draw a filled triangle. More...
 
static MOUNTAIN_API void Rectangle (Vector2 position, Vector2 size, const Color &color=Color::White())
 Draw a hollow rectangle. More...
 
static MOUNTAIN_API void Rectangle (const Mountain::Rectangle &rectangle, const Color &color=Color::White())
 Draw a hollow rectangle. More...
 
static MOUNTAIN_API void RectangleFilled (Vector2 position, Vector2 size, const Color &color=Color::White())
 Draw a filled rectangle. More...
 
static MOUNTAIN_API void RectangleFilled (const Mountain::Rectangle &rectangle, const Color &color=Color::White())
 Draw a filled rectangle. More...
 
static MOUNTAIN_API void Circle (Vector2 center, float_t radius, Vector2 scale=Vector2::One(), const Color &color=Color::White())
 Draw a hollow circle. More...
 
static MOUNTAIN_API void CircleFilled (Vector2 center, float_t radius, Vector2 scale=Vector2::One(), const Color &color=Color::White())
 Draw a filled circle. More...
 
static MOUNTAIN_API void Arc (Vector2 center, float_t radius, float_t startingAngle, float_t deltaAngle, Vector2 scale=Vector2::One(), const Color &color=Color::White())
 Draw a hollow arc. More...
 
static MOUNTAIN_API void ArcFilled (Vector2 center, float_t radius, float_t startingAngle, float_t deltaAngle, Vector2 scale=Vector2::One(), const Color &color=Color::White())
 Draw a filled arc. More...
 
static MOUNTAIN_API void Texture (const Texture &texture, Vector2 position, Vector2 scale=Vector2::One(), float_t rotation=0.f, Vector2 origin=Vector2::Zero(), Vector2 uv0=Vector2::Zero(), Vector2 uv1=Vector2::One(), const Color &color=Color::White(), Meta::UnderlyingEnumType< DrawTextureFlipping > flipFlags=static_cast< Meta::UnderlyingEnumType< DrawTextureFlipping >>(DrawTextureFlipping::None))
 Draw a texture. More...
 
static MOUNTAIN_API void Text (const Font &font, const std::string &text, Vector2 position, float_t scale=1.f, const Color &color=Color::White())
 Draw text. More...
 
static MOUNTAIN_API void RenderTarget (const RenderTarget &renderTarget, Vector2 position=Vector2::Zero(), Vector2 scale=Vector2::One(), float_t rotation=0, Vector2 uv0=Vector2::Zero(), Vector2 uv1=Vector2::One(), const Color &color=Color::White(), Meta::UnderlyingEnumType< DrawTextureFlipping > flipFlags=static_cast< Meta::UnderlyingEnumType< DrawTextureFlipping >>(DrawTextureFlipping::None))
 Draw a RenderTarget. More...
 
static MOUNTAIN_API void Flush ()
 Flushes the cached draw data onto the current RenderTarget. More...
 

Friends

class Renderer
 
class RenderTarget
 
class ParticleSystem
 

Detailed Description

The Draw class contains static functions to draw various things on screen.

Definition at line 32 of file draw.hpp.

Member Function Documentation

◆ Arc()

static MOUNTAIN_API void Mountain::Draw::Arc ( Vector2  center,
float_t  radius,
float_t  startingAngle,
float_t  deltaAngle,
Vector2  scale = Vector2::One(),
const Color color = Color::White() 
)
static

Draw a hollow arc.

Parameters
centerThe center position of the arc
radiusThe radius of the arc
startingAngleThe starting angle of the arc
deltaAngleThe delta angle of the arc, e.g. the ending angle is
startingAngle + deltaAngle
scaleThe scale of the arc
colorThe color of the arc

◆ ArcFilled()

static MOUNTAIN_API void Mountain::Draw::ArcFilled ( Vector2  center,
float_t  radius,
float_t  startingAngle,
float_t  deltaAngle,
Vector2  scale = Vector2::One(),
const Color color = Color::White() 
)
static

Draw a filled arc.

Parameters
centerThe center position of the arc
radiusThe radius of the arc
startingAngleThe starting angle of the arc
deltaAngleThe delta angle of the arc, e.g. the ending angle is
startingAngle + deltaAngle
scaleThe scale of the arc
colorThe color of the arc

◆ Circle()

static MOUNTAIN_API void Mountain::Draw::Circle ( Vector2  center,
float_t  radius,
Vector2  scale = Vector2::One(),
const Color color = Color::White() 
)
static

Draw a hollow circle.

Parameters
centerThe center position of the circle
radiusThe radius of the circle
scaleThe scale of the circle
colorThe color of the circle

◆ CircleFilled()

static MOUNTAIN_API void Mountain::Draw::CircleFilled ( Vector2  center,
float_t  radius,
Vector2  scale = Vector2::One(),
const Color color = Color::White() 
)
static

Draw a filled circle.

Parameters
centerThe center position of the circle
radiusThe radius of the circle
scaleThe scale of the circle
colorThe color of the circle

◆ Clear()

static MOUNTAIN_API void Mountain::Draw::Clear ( const Color color)
static

Clear the current RenderTarget.

Parameters
colorThe new color of all the pixels

◆ Flush()

static MOUNTAIN_API void Mountain::Draw::Flush ( )
static

Flushes the cached draw data onto the current RenderTarget.

This effectively renders everything that was scheduled since the last RenderTarget push/pop or Flush()

◆ Line() [1/2]

static MOUNTAIN_API void Mountain::Draw::Line ( Vector2  point1,
Vector2  point2,
const Color color = Color::White() 
)
static

Draw a line.

Parameters
point1The first point of the line
point2The second point of the line
colorThe color of the line

◆ Line() [2/2]

static MOUNTAIN_API void Mountain::Draw::Line ( Vector2  point1,
Vector2  point2,
const Color color1,
const Color color2 
)
static

Draw a line.

Parameters
point1The first point of the line
point2The second point of the line
color1The color of the first point
color2The color of the second point

◆ Rectangle() [1/2]

static MOUNTAIN_API void Mountain::Draw::Rectangle ( Vector2  position,
Vector2  size,
const Color color = Color::White() 
)
static

Draw a hollow rectangle.

Parameters
positionThe top-left position of the rectangle
sizeThe size of the rectangle
colorThe color of the rectangle

◆ Rectangle() [2/2]

static MOUNTAIN_API void Mountain::Draw::Rectangle ( const Mountain::Rectangle rectangle,
const Color color = Color::White() 
)
static

Draw a hollow rectangle.

Parameters
rectangleThe rectangle position and size
colorThe color of the rectangle

◆ RectangleFilled() [1/2]

static MOUNTAIN_API void Mountain::Draw::RectangleFilled ( Vector2  position,
Vector2  size,
const Color color = Color::White() 
)
static

Draw a filled rectangle.

Parameters
positionThe top-left position of the rectangle
sizeThe size of the rectangle
colorThe color of the rectangle

◆ RectangleFilled() [2/2]

static MOUNTAIN_API void Mountain::Draw::RectangleFilled ( const Mountain::Rectangle rectangle,
const Color color = Color::White() 
)
static

Draw a filled rectangle.

Parameters
rectangleThe rectangle position and size
colorThe color of the rectangle

◆ RenderTarget()

static MOUNTAIN_API void Mountain::Draw::RenderTarget ( const RenderTarget renderTarget,
Vector2  position = Vector2::Zero(),
Vector2  scale = Vector2::One(),
float_t  rotation = 0,
Vector2  uv0 = Vector2::Zero(),
Vector2  uv1 = Vector2::One(),
const Color color = Color::White(),
Meta::UnderlyingEnumType< DrawTextureFlipping >  flipFlags = static_cast< Meta::UnderlyingEnumType< DrawTextureFlipping >>(DrawTextureFlipping::None) 
)
static

Draw a RenderTarget.

Parameters
renderTargetThe RenderTarget to draw
positionThe top-left position of the RenderTarget
scaleThe scale to apply to the RenderTarget
rotationThe rotation in radians to apply to the RenderTarget
uv0The first texture UV position
uv1The second texture UV position
colorThe color of the RenderTarget
flipFlagsFlip flags from the DrawTextureFlipping enum
Exceptions
std::invalid_argumentIf uv0 is greater than uv1

◆ Text()

static MOUNTAIN_API void Mountain::Draw::Text ( const Font font,
const std::string &  text,
Vector2  position,
float_t  scale = 1.f,
const Color color = Color::White() 
)
static

Draw text.

Parameters
fontThe font of the text
textThe text to draw
positionThe top-left position of the text
scaleThe scale to apply to the text
colorThe color of the text

◆ Texture()

static MOUNTAIN_API void Mountain::Draw::Texture ( const Texture texture,
Vector2  position,
Vector2  scale = Vector2::One(),
float_t  rotation = 0.f,
Vector2  origin = Vector2::Zero(),
Vector2  uv0 = Vector2::Zero(),
Vector2  uv1 = Vector2::One(),
const Color color = Color::White(),
Meta::UnderlyingEnumType< DrawTextureFlipping >  flipFlags = static_cast< Meta::UnderlyingEnumType< DrawTextureFlipping >>(DrawTextureFlipping::None) 
)
static

Draw a texture.

Parameters
textureThe texture to draw
positionThe position of the texture
scaleThe scale to apply to the texture
rotationThe rotation in radians to apply to the texture
originThe rotation origin. Value in the range
[{ 0, 0 }, { 1, 1 }]
uv0The first texture UV position
uv1The second texture UV position
colorThe tint color of the texture. Use white for default colors
flipFlagsFlip flags from the DrawTextureFlipping enum
Exceptions
std::invalid_argumentIf uv0 is greater than uv1

◆ Triangle() [1/2]

static MOUNTAIN_API void Mountain::Draw::Triangle ( Vector2  point1,
Vector2  point2,
Vector2  point3,
const Color color = Color::White() 
)
static

Draw a hollow triangle.

Parameters
point1The first point
point2The second point
point3The third point
colorThe color of the triangle

◆ Triangle() [2/2]

static MOUNTAIN_API void Mountain::Draw::Triangle ( Vector2  point1,
Vector2  point2,
Vector2  point3,
const Color color1,
const Color color2,
const Color color3 
)
static

Draw a hollow triangle.

Parameters
point1The first point
point2The second point
point3The third point
color1The color of the first point
color2The color of the second point
color3The color of the third point

◆ TriangleFilled() [1/2]

static MOUNTAIN_API void Mountain::Draw::TriangleFilled ( Vector2  point1,
Vector2  point2,
Vector2  point3,
const Color color = Color::White() 
)
static

Draw a filled triangle.

Parameters
point1The first point
point2The second point
point3The third point
colorThe color of the triangle

◆ TriangleFilled() [2/2]

static MOUNTAIN_API void Mountain::Draw::TriangleFilled ( Vector2  point1,
Vector2  point2,
Vector2  point3,
const Color color1,
const Color color2,
const Color color3 
)
static

Draw a filled triangle.

Parameters
point1The first point
point2The second point
point3The third point
color1The color of the first point
color2The color of the second point
color3The color of the third point

The documentation for this class was generated from the following file: