Files
2024-04-17 13:54:48 +02:00

125 lines
3.8 KiB
C++

#include "base.h"
#include "structs.h"
#include <ostream>
//-----------------------------------------------------------------
// Window Constructors
//-----------------------------------------------------------------
Window::Window(const std::string& title, float width, float height, bool isVSyncOn)
: title { title }
, width { width }
, height { height }
, isVSyncOn { isVSyncOn } {
}
//-----------------------------------------------------------------
// Vector2f Constructors
//-----------------------------------------------------------------
// Vector2f::Vector2f()
// : Vector2f { 0.0f, 0.0f } {
// }
// Vector2f::Vector2f(float x, float y)
// : x { x }, y { y } {
// }
// Vector2f Vector2f::operator+(const Vector2f& other) const {
// return Vector2f { x + other.x, y + other.y };
// }
// Vector2f Vector2f::operator+=(const Vector2f& other) const {
// return Vector2f { x + other.x, y + other.y };
// }
// Vector2f Vector2f::operator*(float other) const {
// return Vector2f { x * other, y * other };
// }
// Vector2f Vector2f::operator*(const Vector2f& other) const {
// return Vector2f { x * other.x, y * other.y };
// }
// Vector2f Vector2f::operator*(int other) const {
// return Vector2f { x * float(other), y * float(other) };
// }
// Vector2f Vector2f::operator/(float other) const {
// return Vector2f { x / other, y / other };
// }
// Vector2f Vector2f::operator-(const Vector2f& other) const {
// return Vector2f { x - other.x, y - other.y };
// }
// Vector2f::Vector2f(int x, int y)
// : x { (float)x }, y { (float)y } {
// }
// Vector2f operator/(float right, const Vector2f& left) {
// return Vector2f { right / left.x, right / left.y };
// }
// Vector2f operator*(float right, const Vector2f& left) {
// return Vector2f{ right * left.x, right * left.y };
// }
// std::ostream& operator<<(std::ostream& os, const Vector2f& p) {
// os << "Vector2f( " << p.x << ", " << p.y << " )" << std::endl;
// return os;
// }
//-----------------------------------------------------------------
// 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(Vector2f pos, Vector2f size): left(pos.x), bottom(pos.y), width(size.x), height(size.y) {}
// 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 { Vector2f { centerX, centerY }, radius } {
}
Circlef::Circlef(const Vector2f& center, float radius)
: center { center }
, radius { radius } {
}
//-----------------------------------------------------------------
// Ellipsef Constructors
//-----------------------------------------------------------------
Ellipsef::Ellipsef()
: Ellipsef { 0.0f, 0.0f, 0.0f, 0.0f } {
}
Ellipsef::Ellipsef(const Vector2f& center, float radiusX, float radiusY)
: center { center }
, radiusX { radiusX }
, radiusY { radiusY } {
}
Ellipsef::Ellipsef(float centerX, float centerY, float radiusX, float radiusY)
: Ellipsef { Vector2f { centerX, centerY }, radiusX, radiusY } {
}