This repository has been archived by the owner on Jan 31, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAwnd.h
160 lines (121 loc) · 3.65 KB
/
Awnd.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
/*
Awnd.h
Awnd, a C++ Framework.
Copyright Agesoft 2021 - 2023
Here at Agesoft we like to use our own products and really avoid third party libraries that can bloat your project.
That's why we made Awnd. a framework to create Win32 Applications easily.
I doubt someone reads this all!
If you want the specific features read this:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
These Features work standalone:
"Random.h" - Pseudo-RNG
Poem:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
I'm a toy. everyone loves toys right?
even coders. they like to code anything
Suffer less. code more.
chop chop, i'll make you a good coder.
use me and you will be satisfied.
but don't expect me to be as good as Adobe.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Author(s):
~~~~~~~~~~~~~~~~~~~~~~~~
Copy05 (https://github.com/Copy05)
ConstantesInt (https://github.com/ConstantesInt)
*/
#pragma region Includes
#pragma once
// Awnd Includes
#include "AwndLabel.h"
#include "AwndButton.h"
#include "AwndTextBox.h"
#include "Application.h"
// C/C++ Includes
#include <string>
#include <cstdlib>
#include <iostream>
#include <ostream>
#include <Windows.h>
#pragma endregion
#pragma region Macros
#define OnClick(wParam, ID) (LOWORD(wParam) == ID)
#define DebugPrint(value) printf(value);
#pragma endregion
#pragma region Awnd Namespace
namespace Awnd {
// Easy Color
class Color {
public:
// constructors
Color() : r(0x00), g(0x00), b(0x00) {};
Color(int red, int green, int blue) : r(red), g(green), b(blue) {};
// operators
friend std::ostream& operator<<(std::ostream& out, const Color& c);
// methods
void SetColor(int r, int g, int b) {
this->r = r;
this->g = g;
this->b = b;
}
int GetRed() const { return r; }
int GetGreen() const { return g; }
int GetBlue() const { return b; }
int r, g, b;
};
class Vector2 {
public:
Vector2(float x, float y) {
this->x = x;
this->y = y;
}
friend std::ostream& operator<<(std::ostream& out, const Vector2& v);
// Returns true if the vector has the same values like the passed vector ones
bool Equals(const Vector2& other) {
if (other.x == this->x && other.y == this->y)
return true;
else
return false;
}
std::string ToString() {
return std::to_string(x) + ',' + std::to_string(y);
}
float x, y;
};
class Vector3 {
public:
Vector3(float x, float y, float z) {
this->x = x;
this->y = y;
this->z = z;
}
friend std::ostream& operator<<(std::ostream& out, const Vector3& v);
// Returns true if the vector has the same values like the passed vector ones
bool Equals(const Vector3& other) {
if (other.x == this->x && other.y == this->y && other.z == this->z)
return true;
else
return false;
}
std::string ToString() {
return std::to_string(x) + ',' + std::to_string(y) + ',' + std::to_string(z);
}
float x, y, z;
};
// Operators
inline std::ostream& operator<<(std::ostream& out, const Color& c) { out << c.r << ", " << c.g << ", " << c.b; return out; };
inline std::ostream& operator<<(std::ostream& out, const Vector2& v) { out << v.x << ", " << v.y; return out; };
inline std::ostream& operator<<(std::ostream& out, const Vector3& v) { out << v.x << ", " << v.y << ", " << v.z; return out; };
// Methods
}
#pragma endregion
// Awnd Base Class
class AwndApp
{
protected:
virtual void onApplicationCreate(float e_Time) { exit(0x00); };
virtual void onApplicationCreate() { exit(0x00); };
// Hides the Window
void HideConsole() { ShowWindow(GetConsoleWindow(), SW_HIDE); };
long GetScreenWidth() { return GetSystemMetrics(SM_CXSCREEN); };
long GetScreenHeight() { return GetSystemMetrics(SM_CYSCREEN); };
};