2D_Game_Engine
Loading...
Searching...
No Matches
structs.hpp
Go to the documentation of this file.
1#pragma once
2
3struct Vec2{
4 union{
5 float x;
6 float w;
7 };
8 union{
9 float y;
10 float h;
11 };
12 Vec2();
13 Vec2(float x,float y);
14};
15
16struct Vec3{
17 float r,g,b;
18 Vec3();
19 Vec3(float r,float g,float b);
20};
21
22struct Vec4{
23 float r,g,b,a;
24 Vec4();
25 Vec4(float r,float g,float b,float a);
26};
27
28struct Vertex{
31 int layer;
32 float texID;
33
34 Vertex();
35 Vertex(Vec2 pos,Vec2 texcoords,int layer,float texID);
36};
37
46
56
64
68Vec2 operator*(float a,Vec2 b);
69Vec2 operator*(Vec2 a,float b);
71Vec2 operator/(float a,Vec2 b);
72Vec2 operator/(Vec2 a,int b);
73
82
83std::ostream &operator<<(std::ostream &os,const Vec2 &v);
84std::ostream &operator<<(std::ostream &os,const Vec3 &v);
85std::ostream &operator<<(std::ostream &os,const Vec4 &v);
86std::ostream &operator<<(std::ostream &os,const Vertex &v);
87std::ostream &operator<<(std::ostream &os,const LineVertex &v);
88std::ostream &operator<<(std::ostream &os,const PointVertex &v);
89std::ostream &operator<<(std::ostream &os,const TriangleVertex &v);
90std::ostream &operator<<(std::ostream &os,const Rect &v);
Vec4 color
Definition structs.hpp:40
float border
Definition structs.hpp:50
Vec2 size
Definition structs.hpp:76
Vec2 pos
Definition structs.hpp:75
Rect()
Definition structs.cpp:57
Vec2 vel
Definition structs.hpp:77
float y
Definition structs.hpp:9
Vec2()
Definition structs.cpp:4
float w
Definition structs.hpp:6
float h
Definition structs.hpp:10
float x
Definition structs.hpp:5
float b
Definition structs.hpp:17
float r
Definition structs.hpp:17
float g
Definition structs.hpp:17
Vec3()
Definition structs.cpp:7
float g
Definition structs.hpp:23
float b
Definition structs.hpp:23
float a
Definition structs.hpp:23
Vec4()
Definition structs.cpp:10
float r
Definition structs.hpp:23
float texID
Definition structs.hpp:32
Vec2 position
Definition structs.hpp:29
Vertex()
Definition structs.cpp:22
Vec2 texcoords
Definition structs.hpp:30
int layer
Definition structs.hpp:31
Vec2 operator-(Vec2 a, Vec2 b)
Definition structs.cpp:29
Vec2 operator*(Vec2 a, Vec2 b)
Definition structs.cpp:33
Vec2 operator/(Vec2 a, Vec2 b)
Definition structs.cpp:45
std::ostream & operator<<(std::ostream &os, const Vec2 &v)
Definition structs.cpp:60
Vec2 operator+(Vec2 a, Vec2 b)
Definition structs.cpp:25