- Add RD7 and DV2 namespace

- Restructer Default Theme System
- Rename NIMG_Engine to swr (SoftwareRender)
- Begin Adding Debug Lines to UI7
- Remove GUI ErrorSystem
This commit is contained in:
Tobi-D7
2024-02-21 12:48:56 +01:00
parent 688570b3cd
commit 968c2576b9
17 changed files with 269 additions and 132 deletions

View File

@ -10,6 +10,9 @@
#include <renderd7/Timer.hpp>
#include <renderd7/UI7.hpp>
#include <renderd7/global_db.hpp>
#include <renderd7/nimg_engine.hpp>
#include <renderd7/renderd7.hpp>
#include <renderd7/sound.hpp>
#include <renderd7/swr.hpp>
namespace RD7 = RenderD7;
namespace DV2 = RenderD7::Draw2;

View File

@ -12,7 +12,7 @@
#define UNPACK_BGRA(col) (uint8_t)(col >> 8), (col >> 16), (col >> 24), (col)
inline uint32_t RGBA8(uint8_t r, uint8_t g, uint8_t b, uint8_t a = 255) {
#define ISIMPLEPAK(x, y) (((x)&0xff) << y)
#define ISIMPLEPAK(x, y) (((x) & 0xff) << y)
return (ISIMPLEPAK(r, 0) | ISIMPLEPAK(g, 8) | ISIMPLEPAK(b, 16) |
ISIMPLEPAK(a, 24));
}

View File

@ -39,4 +39,66 @@ struct R7Vec2 {
// Internal Values
float x;
float y;
};
struct R7Vec4 {
// Init Funcs
R7Vec4() : x(0), y(0), z(0), w(0) {}
R7Vec4(float i0, float i1, float i2, float i3) : x(i0), y(i1), z(i2), w(i3) {}
R7Vec4(const R7Vec4 &i) {
x = i.x;
y = i.y;
z = i.z;
w = i.w;
}
R7Vec4(const R7Vec2 &i0, const R7Vec2 &i1) {
x = i0.x;
y = i0.y;
z = i1.x;
w = i1.y;
}
// Operators
// Add
R7Vec4 &operator+=(const R7Vec4 &i) {
x += i.x;
y += i.y;
z += i.z;
w += i.w;
return *this;
}
R7Vec4 operator+(const R7Vec4 &i) const {
return R7Vec4(x + i.x, y + i.y, z + i.z, w + i.w);
}
// Sub
R7Vec4 &operator-=(const R7Vec4 &i) {
x -= i.x;
y -= i.y;
z -= i.z;
w -= i.w;
return *this;
}
R7Vec4 operator-(const R7Vec4 &i) const {
return R7Vec4(x - i.x, y - i.y, z - i.z, w - i.w);
}
// Compare
bool operator==(const R7Vec4 &in) const {
return x == in.x && y == in.y && z == in.z && w == in.w;
}
bool operator!=(const R7Vec4 &in) const {
// use the first comparefuncs result
// and swap it lol
return !(*this == in);
}
// Internal Values
float x;
float y;
float z;
float w;
};

View File

@ -26,6 +26,9 @@ void Deinit();
void Update();
float GetTime();
float GetDeltaTime();
// Internal Function
// Should not be used
void Debug();
bool Button(const std::string &label, R7Vec2 size = R7Vec2(0, 0));
void Checkbox(const std::string &label, bool &c);

View File

@ -3,12 +3,12 @@
#include <renderd7/nimg.hpp>
namespace RenderD7 {
class NIMG_Engine {
class swr {
public:
NIMG_Engine(int w, int h);
NIMG_Engine();
~NIMG_Engine();
nimg& GetImage() { return image; }
swr(int w, int h);
swr();
~swr();
nimg& get_image() { return image; }
void load_file(const std::string& path);
void load_nimg(const std::string& path);
@ -16,6 +16,7 @@ class NIMG_Engine {
void draw_pixel(int x, int y, unsigned int color);
void draw_rect(int x, int y, int w, int h, unsigned int color, int t = 1);
void draw_rect_solid(int x, int y, int w, int h, unsigned int color);
void draw_line(int x1, int y1, int x2, int y2, unsigned int color, int t = 1);
void flip(bool h, bool v);
private: