Files
dae16-VerhulstBram-GameProject/Engine/structs.cpp
Bram Verhulst d6bb3add26 Added the Grid, Camera, Level system
Basic player
Started (Barely) on the TextureManager
And other fixes
2024-03-11 03:29:44 +01:00

106 lines
3.0 KiB
C++

#include "base.h"
#include "structs.h"
//-----------------------------------------------------------------
// Window Constructors
//-----------------------------------------------------------------
Window::Window(const std::string& title, float width, float height, bool isVSyncOn)
: title { title }
, width { width }
, height { height }
, isVSyncOn { isVSyncOn } {
}
//-----------------------------------------------------------------
// Point2f Constructors
//-----------------------------------------------------------------
Point2f::Point2f()
: Point2f { 0.0f, 0.0f } {
}
Point2f::Point2f(float x, float y)
: x { x }, y { y } {
}
Point2f Point2f::operator+(const Point2f& other) const {
return Point2f { x + other.x, y + other.y };
}
Point2f Point2f::operator*(float other) const {
return Point2f { x * other, y * other };
}
Point2f Point2f::operator*(const Point2f& other) const {
return Point2f { x * other.x, y * other.y };
}
Point2f Point2f::operator*(int other) const {
return Point2f { x * float(other), y * float(other) };
}
Point2f Point2f::operator/(float other) const {
return Point2f { x / other, y / other };
}
// Point2f::Point2f(int x, int y)
// : x { (float)x }, y { (float)y } {
// }
//-----------------------------------------------------------------
// Rectf Constructors
//-----------------------------------------------------------------
Rectf::Rectf()
: Rectf { 0.0f, 0.0f, 0.0f, 0.0f } {
}
Rectf::Rectf(float left, float bottom, float width, float height)
: left { left }
, bottom { bottom }
, width { width }
, height { height } {
}
// Rectf::Rectf(int left, int bottom, int width, int height) : left { (float)left }, bottom { (float)bottom }, width { (float)width }, height { (float)height } {
// }
//-----------------------------------------------------------------
// Color4f Constructors
//-----------------------------------------------------------------
Color4f::Color4f()
: Color4f { 0.0f, 0.0f, 0.0f, 1.0f } {
}
Color4f::Color4f(float r, float g, float b, float a)
: r { r }
, g { g }
, b { b }
, a { a } {
}
//-----------------------------------------------------------------
// Circlef Constructors
//-----------------------------------------------------------------
Circlef::Circlef()
: Circlef { 0.0f, 0.0f, 0.0f } {
}
Circlef::Circlef(float centerX, float centerY, float radius)
: Circlef { Point2f { centerX, centerY }, radius } {
}
Circlef::Circlef(const Point2f& center, float radius)
: center { center }
, radius { radius } {
}
//-----------------------------------------------------------------
// Ellipsef Constructors
//-----------------------------------------------------------------
Ellipsef::Ellipsef()
: Ellipsef { 0.0f, 0.0f, 0.0f, 0.0f } {
}
Ellipsef::Ellipsef(const Point2f& center, float radiusX, float radiusY)
: center { center }
, radiusX { radiusX }
, radiusY { radiusY } {
}
Ellipsef::Ellipsef(float centerX, float centerY, float radiusX, float radiusY)
: Ellipsef { Point2f { centerX, centerY }, radiusX, radiusY } {
}