- 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:
7
.vscode/launch.json
vendored
7
.vscode/launch.json
vendored
@ -1,6 +1,13 @@
|
|||||||
{
|
{
|
||||||
"version": "0.2.0",
|
"version": "0.2.0",
|
||||||
"configurations": [
|
"configurations": [
|
||||||
|
{
|
||||||
|
"name": "Format Code",
|
||||||
|
"type": "debugpy",
|
||||||
|
"request": "launch",
|
||||||
|
"program": "${workspaceFolder}/clang-format.py",
|
||||||
|
"cwd": "${workspaceFolder}"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "(gdb) Launch",
|
"name": "(gdb) Launch",
|
||||||
"type": "cppdbg",
|
"type": "cppdbg",
|
||||||
|
23
.vscode/tasks.json
vendored
Normal file
23
.vscode/tasks.json
vendored
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
{
|
||||||
|
"version": "2.0.0",
|
||||||
|
"tasks": [
|
||||||
|
{
|
||||||
|
"label": "Build",
|
||||||
|
"command": "make",
|
||||||
|
"type": "shell",
|
||||||
|
"options": {
|
||||||
|
"cwd": "${workspaceFolder}/rd7tf/"
|
||||||
|
},
|
||||||
|
"presentation": {
|
||||||
|
"reveal": "always",
|
||||||
|
"panel": "new",
|
||||||
|
"focus": true
|
||||||
|
},
|
||||||
|
"problemMatcher": [],
|
||||||
|
"group": {
|
||||||
|
"kind": "build",
|
||||||
|
"isDefault": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
@ -11,8 +11,8 @@ RENDERD7_SRC := RenderD7/source RenderD7/external
|
|||||||
RENDERD7_INC := RenderD7/include
|
RENDERD7_INC := RenderD7/include
|
||||||
# Libraries used for RenderD7
|
# Libraries used for RenderD7
|
||||||
# if you already use -lm, -lctru etc place a # before -lm
|
# if you already use -lm, -lctru etc place a # before -lm
|
||||||
RENDERD7_LIBS := -lmpg123 -lvorbisidec -logg -lcurl -lm -lcitro2dd -lcitro3d -lctru
|
RENDERD7_LIBS := -lcurl -lm -lcitro2dd -lcitro3d -lctru
|
||||||
RENDERD7_FLAGS := -DRENDERD7_MUSICDEC=1 -DRENDERD7_MEMTRACK=1
|
RENDERD7_FLAGS := -DRENDERD7_MEMTRACK=1
|
||||||
```
|
```
|
||||||
Now you need to add it to your sources and includes
|
Now you need to add it to your sources and includes
|
||||||
```
|
```
|
||||||
@ -22,7 +22,6 @@ INCLUDES := source $(RENDERD7_INC)
|
|||||||
Finally append `$(RENDERD7_FLAGS)` to your `CFLAGS`
|
Finally append `$(RENDERD7_FLAGS)` to your `CFLAGS`
|
||||||
|
|
||||||
Example from rd7tf
|
Example from rd7tf
|
||||||
Keep in mind that -DRENDERD7_MUSICDEC=1 requires `-lmpg123 -lvorbisidec -logg`
|
|
||||||
### Installation (0.8.0-0.9.4) (OUTDATED)
|
### Installation (0.8.0-0.9.4) (OUTDATED)
|
||||||
Download a Package From Releses Page
|
Download a Package From Releses Page
|
||||||
`https://github.com/NPI-D7/RenderD7/releases/download/v0.9.4/renderd7.tar.bz2 -o renderd7.tar.bz2`
|
`https://github.com/NPI-D7/RenderD7/releases/download/v0.9.4/renderd7.tar.bz2 -o renderd7.tar.bz2`
|
||||||
|
@ -10,6 +10,9 @@
|
|||||||
#include <renderd7/Timer.hpp>
|
#include <renderd7/Timer.hpp>
|
||||||
#include <renderd7/UI7.hpp>
|
#include <renderd7/UI7.hpp>
|
||||||
#include <renderd7/global_db.hpp>
|
#include <renderd7/global_db.hpp>
|
||||||
#include <renderd7/nimg_engine.hpp>
|
|
||||||
#include <renderd7/renderd7.hpp>
|
#include <renderd7/renderd7.hpp>
|
||||||
#include <renderd7/sound.hpp>
|
#include <renderd7/sound.hpp>
|
||||||
|
#include <renderd7/swr.hpp>
|
||||||
|
|
||||||
|
namespace RD7 = RenderD7;
|
||||||
|
namespace DV2 = RenderD7::Draw2;
|
@ -12,7 +12,7 @@
|
|||||||
#define UNPACK_BGRA(col) (uint8_t)(col >> 8), (col >> 16), (col >> 24), (col)
|
#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) {
|
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) |
|
return (ISIMPLEPAK(r, 0) | ISIMPLEPAK(g, 8) | ISIMPLEPAK(b, 16) |
|
||||||
ISIMPLEPAK(a, 24));
|
ISIMPLEPAK(a, 24));
|
||||||
}
|
}
|
||||||
|
@ -40,3 +40,65 @@ struct R7Vec2 {
|
|||||||
float x;
|
float x;
|
||||||
float y;
|
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;
|
||||||
|
};
|
@ -26,6 +26,9 @@ void Deinit();
|
|||||||
void Update();
|
void Update();
|
||||||
float GetTime();
|
float GetTime();
|
||||||
float GetDeltaTime();
|
float GetDeltaTime();
|
||||||
|
// Internal Function
|
||||||
|
// Should not be used
|
||||||
|
void Debug();
|
||||||
|
|
||||||
bool Button(const std::string &label, R7Vec2 size = R7Vec2(0, 0));
|
bool Button(const std::string &label, R7Vec2 size = R7Vec2(0, 0));
|
||||||
void Checkbox(const std::string &label, bool &c);
|
void Checkbox(const std::string &label, bool &c);
|
||||||
|
@ -3,12 +3,12 @@
|
|||||||
#include <renderd7/nimg.hpp>
|
#include <renderd7/nimg.hpp>
|
||||||
|
|
||||||
namespace RenderD7 {
|
namespace RenderD7 {
|
||||||
class NIMG_Engine {
|
class swr {
|
||||||
public:
|
public:
|
||||||
NIMG_Engine(int w, int h);
|
swr(int w, int h);
|
||||||
NIMG_Engine();
|
swr();
|
||||||
~NIMG_Engine();
|
~swr();
|
||||||
nimg& GetImage() { return image; }
|
nimg& get_image() { return image; }
|
||||||
void load_file(const std::string& path);
|
void load_file(const std::string& path);
|
||||||
void load_nimg(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_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(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_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);
|
void flip(bool h, bool v);
|
||||||
|
|
||||||
private:
|
private:
|
@ -1,32 +1,24 @@
|
|||||||
#include "scene.hpp"
|
#include "scene.hpp"
|
||||||
|
|
||||||
void ColorThemeSample() {
|
void ColorThemeSample() {
|
||||||
RenderD7::ColorNew(RD7Color_Text, RenderD7::Color::Hex("#000000", 255));
|
RD7::ColorNew(RD7Color_Text, RD7::Color::Hex("#000000", 255));
|
||||||
RenderD7::ColorNew(RD7Color_TextDisabled,
|
RD7::ColorNew(RD7Color_TextDisabled, RD7::Color::Hex("#212121", 200));
|
||||||
RenderD7::Color::Hex("#212121", 200));
|
RD7::ColorNew(RD7Color_Text2, RD7::Color::Hex("#ffffff", 255));
|
||||||
RenderD7::ColorNew(RD7Color_Text2, RenderD7::Color::Hex("#ffffff", 255));
|
RD7::ColorNew(RD7Color_Background, RD7::Color::Hex("#eeeeee", 170));
|
||||||
RenderD7::ColorNew(RD7Color_Background, RenderD7::Color::Hex("#eeeeee", 170));
|
RD7::ColorNew(RD7Color_Header, RD7::Color::Hex("#222222", 190));
|
||||||
RenderD7::ColorNew(RD7Color_Header, RenderD7::Color::Hex("#222222", 190));
|
RD7::ColorNew(RD7Color_Selector, RD7::Color::Hex("#4444dd", 200));
|
||||||
RenderD7::ColorNew(RD7Color_Selector, RenderD7::Color::Hex("#4444dd", 200));
|
RD7::ColorNew(RD7Color_SelectorFade, RD7::Color::Hex("#7777dd", 200));
|
||||||
RenderD7::ColorNew(RD7Color_SelectorFade,
|
RD7::ColorNew(RD7Color_List0, RD7::Color::Hex("#555555", 130));
|
||||||
RenderD7::Color::Hex("#7777dd", 200));
|
RD7::ColorNew(RD7Color_List1, RD7::Color::Hex("#777777", 130));
|
||||||
RenderD7::ColorNew(RD7Color_List0, RenderD7::Color::Hex("#555555", 130));
|
RD7::ColorNew(RD7Color_MessageBackground, RD7::Color::Hex("#222222", 180));
|
||||||
RenderD7::ColorNew(RD7Color_List1, RenderD7::Color::Hex("#777777", 130));
|
RD7::ColorNew(RD7Color_Button, RD7::Color::Hex("#4444dd", 150));
|
||||||
RenderD7::ColorNew(RD7Color_MessageBackground,
|
RD7::ColorNew(RD7Color_ButtonHovered, RD7::Color::Hex("#6666dd", 150));
|
||||||
RenderD7::Color::Hex("#222222", 180));
|
RD7::ColorNew(RD7Color_ButtonDisabled, RD7::Color::Hex("#2222dd", 150));
|
||||||
RenderD7::ColorNew(RD7Color_Button, RenderD7::Color::Hex("#4444dd", 150));
|
RD7::ColorNew(RD7Color_ButtonActive, RD7::Color::Hex("#7777dd", 150));
|
||||||
RenderD7::ColorNew(RD7Color_ButtonHovered,
|
RD7::ColorNew(RD7Color_Checkmark, RD7::Color::Hex("#4444dd", 130));
|
||||||
RenderD7::Color::Hex("#6666dd", 150));
|
RD7::ColorNew(RD7Color_FrameBg, RD7::Color::Hex("#555555", 160));
|
||||||
RenderD7::ColorNew(RD7Color_ButtonDisabled,
|
RD7::ColorNew(RD7Color_FrameBgHovered, RD7::Color::Hex("#777777", 160));
|
||||||
RenderD7::Color::Hex("#2222dd", 150));
|
RD7::ColorNew(RD7Color_Progressbar, RD7::Color::Hex("#4444dd", 200));
|
||||||
RenderD7::ColorNew(RD7Color_ButtonActive,
|
|
||||||
RenderD7::Color::Hex("#7777dd", 150));
|
|
||||||
RenderD7::ColorNew(RD7Color_Checkmark, RenderD7::Color::Hex("#4444dd", 130));
|
|
||||||
RenderD7::ColorNew(RD7Color_FrameBg, RenderD7::Color::Hex("#555555", 160));
|
|
||||||
RenderD7::ColorNew(RD7Color_FrameBgHovered,
|
|
||||||
RenderD7::Color::Hex("#777777", 160));
|
|
||||||
RenderD7::ColorNew(RD7Color_Progressbar,
|
|
||||||
RenderD7::Color::Hex("#4444dd", 200));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extern void IdbServer();
|
extern void IdbServer();
|
||||||
@ -34,24 +26,24 @@ extern void IdbServer();
|
|||||||
int main() {
|
int main() {
|
||||||
rd7_enable_memtrack = true;
|
rd7_enable_memtrack = true;
|
||||||
rd7_do_splash = true;
|
rd7_do_splash = true;
|
||||||
RenderD7::Ftrace::Beg("app", "app_init");
|
RD7::Ftrace::Beg("app", "app_init");
|
||||||
RenderD7::Init::Main("rd7tf");
|
RD7::Init::Main("rd7tf");
|
||||||
RenderD7::FadeIn();
|
RD7::FadeIn();
|
||||||
// IdbServer();
|
// IdbServer();
|
||||||
ColorThemeSample();
|
ColorThemeSample();
|
||||||
RenderD7::Init::NdspFirm();
|
RD7::Init::NdspFirm();
|
||||||
RenderD7::Scene::Load(std::make_unique<Sample>());
|
RD7::Scene::Load(std::make_unique<Sample>());
|
||||||
RenderD7::Ftrace::End("app", "app_init");
|
RD7::Ftrace::End("app", "app_init");
|
||||||
while (RenderD7::MainLoop()) {
|
while (RD7::MainLoop()) {
|
||||||
RenderD7::OnScreen(Top);
|
RD7::OnScreen(Top);
|
||||||
RenderD7::Ftrace::Beg("app", "app_mainloop");
|
RD7::Ftrace::Beg("app", "app_mainloop");
|
||||||
if (d7_hDown & KEY_START) {
|
if (d7_hDown & KEY_START) {
|
||||||
RenderD7::FadeOut();
|
RD7::FadeOut();
|
||||||
RenderD7::ExitApp();
|
RD7::ExitApp();
|
||||||
}
|
}
|
||||||
RenderD7::OnScreen(Top);
|
RD7::OnScreen(Top);
|
||||||
RenderD7::FrameEnd();
|
RD7::FrameEnd();
|
||||||
RenderD7::Ftrace::End("app", "app_mainloop");
|
RD7::Ftrace::End("app", "app_mainloop");
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -25,27 +25,25 @@ static void Wave(int index, R7Vec2 position, R7Vec2 size, float time,
|
|||||||
y_position = std::min(y_position, position.y + size.y - (90 - shrink));
|
y_position = std::min(y_position, position.y + size.y - (90 - shrink));
|
||||||
|
|
||||||
if (dbg)
|
if (dbg)
|
||||||
RenderD7::Draw2::TriangleLined(
|
DV2::TriangleLined(
|
||||||
R7Vec2(x_position, y_position),
|
R7Vec2(x_position, y_position),
|
||||||
R7Vec2(x_position + 300, y_position + (90 - shrink)),
|
R7Vec2(x_position + 300, y_position + (90 - shrink)),
|
||||||
R7Vec2(x_position - 300, y_position + (90 - shrink)),
|
R7Vec2(x_position - 300, y_position + (90 - shrink)),
|
||||||
RenderD7::Color::RGBA(.94f - .17f * color_effect,
|
RD7::Color::RGBA(.94f - .17f * color_effect, .61f - .25f * color_effect,
|
||||||
.61f - .25f * color_effect,
|
|
||||||
.36f + .38f * color_effect)
|
.36f + .38f * color_effect)
|
||||||
.toRGBA());
|
.toRGBA());
|
||||||
else
|
else
|
||||||
RenderD7::Draw2::TriangleSolid(
|
DV2::TriangleSolid(
|
||||||
R7Vec2(x_position, y_position),
|
R7Vec2(x_position, y_position),
|
||||||
R7Vec2(x_position + 300, y_position + (90 - shrink)),
|
R7Vec2(x_position + 300, y_position + (90 - shrink)),
|
||||||
R7Vec2(x_position - 300, y_position + (90 - shrink)),
|
R7Vec2(x_position - 300, y_position + (90 - shrink)),
|
||||||
RenderD7::Color::RGBA(.94f - .17f * color_effect,
|
RD7::Color::RGBA(.94f - .17f * color_effect, .61f - .25f * color_effect,
|
||||||
.61f - .25f * color_effect,
|
|
||||||
.36f + .38f * color_effect)
|
.36f + .38f * color_effect)
|
||||||
.toRGBA());
|
.toRGBA());
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawWave(R7Vec2 position, R7Vec2 size, float time, bool dbg) {
|
void DrawWave(R7Vec2 position, R7Vec2 size, float time, bool dbg) {
|
||||||
RenderD7::Draw2::RectFilledSolid(position, size, 0xff64c9fd);
|
DV2::RectFilledSolid(position, size, 0xff64c9fd);
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (; i < 44; i++) Wave(i, position, size, time, dbg);
|
for (; i < 44; i++) Wave(i, position, size, time, dbg);
|
||||||
}
|
}
|
||||||
@ -53,7 +51,7 @@ void DrawWave(R7Vec2 position, R7Vec2 size, float time, bool dbg) {
|
|||||||
R7Vec2 testv2 = R7Vec2(48, 48);
|
R7Vec2 testv2 = R7Vec2(48, 48);
|
||||||
|
|
||||||
Sample::Sample() {
|
Sample::Sample() {
|
||||||
auto t = RenderD7::FileSystem::GetDirContent("sdmc:/music/");
|
auto t = RD7::FileSystem::GetDirContent("sdmc:/music/");
|
||||||
for (const auto& it : t) {
|
for (const auto& it : t) {
|
||||||
names.push_back(it.name);
|
names.push_back(it.name);
|
||||||
files.push_back(it.path);
|
files.push_back(it.path);
|
||||||
@ -67,32 +65,32 @@ Sample::~Sample() {
|
|||||||
void Sample::Draw() const {
|
void Sample::Draw() const {
|
||||||
// Draw Things to Screen:
|
// Draw Things to Screen:
|
||||||
// Step 1 -> Select Screen
|
// Step 1 -> Select Screen
|
||||||
RenderD7::OnScreen(Top);
|
RD7::OnScreen(Top);
|
||||||
// Step 2 -> Draw Things
|
// Step 2 -> Draw Things
|
||||||
// The hbloader Triangle Wave
|
// The hbloader Triangle Wave
|
||||||
DrawWave(R7Vec2(0, 0), R7Vec2(400, 240), RenderD7::GetTime(),
|
DrawWave(R7Vec2(0, 0), R7Vec2(400, 240), RD7::GetTime(), debug_background);
|
||||||
debug_background);
|
|
||||||
// For Example A Rect with Draw2 and StyleColorApi
|
// For Example A Rect with Draw2 and StyleColorApi
|
||||||
// And the RFS Wrapper for RectFilledSolid lol
|
// And the RFS Wrapper for RectFilledSolid lol
|
||||||
/*RenderD7::Draw2::RFS(R7Vec2(0, 0), R7Vec2(400, 20),
|
/*DV2::RFS(R7Vec2(0, 0), R7Vec2(400, 20),
|
||||||
RenderD7::StyleColor(RD7Color_Header));
|
RD7::StyleColor(RD7Color_Header));
|
||||||
// As the Top bar is Dark you need TextColor2
|
// As the Top bar is Dark you need TextColor2
|
||||||
RenderD7::RedirectColor(RD7Color_Text, RD7Color_Text2);
|
RD7::RedirectColor(RD7Color_Text, RD7Color_Text2);
|
||||||
RenderD7::Draw2::Text(R7Vec2(5, 2), "RenderD7 - Test Framework");
|
DV2::Text(R7Vec2(5, 2), "RenderD7 - Test Framework");
|
||||||
RenderD7::Draw2::Text(R7Vec2(395, 2), RENDERD7VSTRING,
|
DV2::Text(R7Vec2(395, 2), RENDERD7VSTRING,
|
||||||
RD7TextFlags_AlignRight);
|
RD7TextFlags_AlignRight);
|
||||||
RenderD7::UndoColorEdit(RD7Color_Text);*/
|
RD7::UndoColorEdit(RD7Color_Text);*/
|
||||||
if (UI7::BeginMenu("RenderD7 Test Framework")) {
|
if (UI7::BeginMenu("RenderD7 Test Framework")) {
|
||||||
UI7::SetCursorPos(R7Vec2(395, 2));
|
UI7::SetCursorPos(R7Vec2(395, 2));
|
||||||
UI7::Label(RenderD7::FormatBytes(RenderD7::Memory::GetCurrent()),
|
UI7::Label(RD7::FormatBytes(RD7::Memory::GetCurrent()),
|
||||||
RD7TextFlags_AlignRight);
|
RD7TextFlags_AlignRight);
|
||||||
UI7::RestoreCursor();
|
UI7::RestoreCursor();
|
||||||
if (state == State_Menu) {
|
if (state == State_Menu) {
|
||||||
UI7::Label("Test App");
|
UI7::Label("Test App");
|
||||||
|
UI7::BrowserList(names, sel);
|
||||||
}
|
}
|
||||||
UI7::EndMenu();
|
UI7::EndMenu();
|
||||||
}
|
}
|
||||||
RenderD7::OnScreen(Bottom);
|
RD7::OnScreen(Bottom);
|
||||||
if (UI7::BeginMenu("Control Center")) {
|
if (UI7::BeginMenu("Control Center")) {
|
||||||
if (state == State_Menu) {
|
if (state == State_Menu) {
|
||||||
if (UI7::Button("RenderD7 Settings"))
|
if (UI7::Button("RenderD7 Settings"))
|
||||||
@ -116,14 +114,14 @@ void Sample::Draw() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Sample::Logic() {
|
void Sample::Logic() {
|
||||||
RenderD7::CustomTextSize(txt_size);
|
RD7::CustomTextSize(txt_size);
|
||||||
for (const auto& it : shared_requests) {
|
for (const auto& it : shared_requests) {
|
||||||
if (it.first == 1U) {
|
if (it.first == 1U) {
|
||||||
if (it.second) RenderD7::LoadSettings();
|
if (it.second) RD7::LoadSettings();
|
||||||
} else if (it.first == 2U) {
|
} else if (it.first == 2U) {
|
||||||
if (it.second)
|
if (it.second)
|
||||||
RenderD7::PushMessage(RenderD7::Message(
|
RD7::PushMessage(RD7::Message("Test Message",
|
||||||
"Test Message", "Button Bressed\nBest Msg Handler..."));
|
"Button Bressed\nBest Msg Handler..."));
|
||||||
} else if (it.first == 3U) {
|
} else if (it.first == 3U) {
|
||||||
state = (State)it.second;
|
state = (State)it.second;
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
#include <rd7.hpp>
|
#include <rd7.hpp>
|
||||||
|
|
||||||
class Sample : public RenderD7::Scene {
|
class Sample : public RD7::Scene {
|
||||||
public:
|
public:
|
||||||
enum State {
|
enum State {
|
||||||
State_Menu,
|
State_Menu,
|
||||||
|
@ -5,10 +5,8 @@
|
|||||||
#include <renderd7/external/json.hpp>
|
#include <renderd7/external/json.hpp>
|
||||||
#include <renderd7/internal_db.hpp>
|
#include <renderd7/internal_db.hpp>
|
||||||
|
|
||||||
// This is btw the default theme setup
|
// Default Theme
|
||||||
// RenderD7 StyleColor Api
|
const std::map<RD7Color, unsigned int> rd7i_default_theme = {
|
||||||
// not const cause const = error lol
|
|
||||||
std::map<RD7Color, unsigned int> rd7i_color_map = {
|
|
||||||
{RD7Color_Text, RGBA8(0, 0, 0, 255)},
|
{RD7Color_Text, RGBA8(0, 0, 0, 255)},
|
||||||
{RD7Color_Text2, RGBA8(255, 255, 255, 255)}, // For Background change or so
|
{RD7Color_Text2, RGBA8(255, 255, 255, 255)}, // For Background change or so
|
||||||
{RD7Color_TextDisabled, RGBA8(170, 170, 170, 255)},
|
{RD7Color_TextDisabled, RGBA8(170, 170, 170, 255)},
|
||||||
@ -29,6 +27,10 @@ std::map<RD7Color, unsigned int> rd7i_color_map = {
|
|||||||
{RD7Color_Progressbar, RGBA8(0, 255, 0, 255)},
|
{RD7Color_Progressbar, RGBA8(0, 255, 0, 255)},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// RenderD7 StyleColor Api
|
||||||
|
// not const cause const = error lol
|
||||||
|
std::map<RD7Color, unsigned int> rd7i_color_map = rd7i_default_theme;
|
||||||
|
|
||||||
std::map<RD7Color, unsigned int> rd7i_color_swap_map;
|
std::map<RD7Color, unsigned int> rd7i_color_swap_map;
|
||||||
|
|
||||||
unsigned int RenderD7::StyleColor(RD7Color color) {
|
unsigned int RenderD7::StyleColor(RD7Color color) {
|
||||||
@ -175,26 +177,7 @@ void RenderD7::ThemeSave(const std::string& path) {
|
|||||||
file.close();
|
file.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderD7::ThemeDefault() {
|
void RenderD7::ThemeDefault() { rd7i_color_map = rd7i_default_theme; }
|
||||||
rd7i_color_map[RD7Color_Text] = RGBA8(0, 0, 0, 255);
|
|
||||||
rd7i_color_map[RD7Color_Text2] = RGBA8(255, 255, 255, 255);
|
|
||||||
rd7i_color_map[RD7Color_TextDisabled] = RGBA8(170, 170, 170, 255);
|
|
||||||
rd7i_color_map[RD7Color_Background] = RGBA8(238, 238, 238, 255);
|
|
||||||
rd7i_color_map[RD7Color_Header] = RGBA8(17, 17, 17, 255);
|
|
||||||
rd7i_color_map[RD7Color_Selector] = RGBA8(34, 34, 34, 255);
|
|
||||||
rd7i_color_map[RD7Color_SelectorFade] = RGBA8(90, 90, 90, 255);
|
|
||||||
rd7i_color_map[RD7Color_List0] = RGBA8(204, 204, 204, 255);
|
|
||||||
rd7i_color_map[RD7Color_List1] = RGBA8(187, 187, 187, 255);
|
|
||||||
rd7i_color_map[RD7Color_MessageBackground] = RGBA8(51, 51, 51, 255);
|
|
||||||
rd7i_color_map[RD7Color_Button] = RGBA8(17, 17, 17, 255);
|
|
||||||
rd7i_color_map[RD7Color_ButtonHovered] = RGBA8(34, 34, 34, 255);
|
|
||||||
rd7i_color_map[RD7Color_ButtonDisabled] = RGBA8(8, 8, 8, 255);
|
|
||||||
rd7i_color_map[RD7Color_ButtonActive] = RGBA8(42, 42, 42, 255);
|
|
||||||
rd7i_color_map[RD7Color_Checkmark] = RGBA8(42, 42, 42, 255);
|
|
||||||
rd7i_color_map[RD7Color_FrameBg] = RGBA8(85, 85, 85, 255);
|
|
||||||
rd7i_color_map[RD7Color_FrameBgHovered] = RGBA8(119, 119, 119, 255);
|
|
||||||
rd7i_color_map[RD7Color_Progressbar] = RGBA8(0, 255, 0, 255);
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t RenderD7::Color::Hex(const std::string& color, uint8_t a) {
|
uint32_t RenderD7::Color::Hex(const std::string& color, uint8_t a) {
|
||||||
if (color.length() < 7 ||
|
if (color.length() < 7 ||
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
namespace RenderD7 {
|
namespace RenderD7 {
|
||||||
void Error(const std::string& msg) {
|
void Error(const std::string& msg) {
|
||||||
if (rd7i_graphics_on) {
|
/*if (rd7i_graphics_on) {
|
||||||
C3D_FrameEnd(0);
|
C3D_FrameEnd(0);
|
||||||
while (aptMainLoop()) {
|
while (aptMainLoop()) {
|
||||||
hidScanInput();
|
hidScanInput();
|
||||||
@ -27,7 +27,7 @@ void Error(const std::string& msg) {
|
|||||||
C3D_FrameEnd(0);
|
C3D_FrameEnd(0);
|
||||||
}
|
}
|
||||||
exit(0);
|
exit(0);
|
||||||
} else {
|
} else {*/
|
||||||
gfxInitDefault();
|
gfxInitDefault();
|
||||||
consoleInit(GFX_TOP, NULL);
|
consoleInit(GFX_TOP, NULL);
|
||||||
printf("RENDERD7 - ERROR MANAGER\n\n%s\n", msg.c_str());
|
printf("RENDERD7 - ERROR MANAGER\n\n%s\n", msg.c_str());
|
||||||
@ -39,6 +39,6 @@ void Error(const std::string& msg) {
|
|||||||
}
|
}
|
||||||
gfxExit();
|
gfxExit();
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
} // namespace RenderD7
|
} // namespace RenderD7
|
@ -65,6 +65,31 @@ struct UI7ID {
|
|||||||
int lt;
|
int lt;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct UI7OBJ {
|
||||||
|
UI7OBJ() {}
|
||||||
|
UI7OBJ(const R7Vec4 &i0, const int &i1) {
|
||||||
|
box = i0;
|
||||||
|
type = i1;
|
||||||
|
s = rd7i_current_screen;
|
||||||
|
}
|
||||||
|
void Debug() {
|
||||||
|
RenderD7::OnScreen(s ? Top : Bottom);
|
||||||
|
RenderD7::Draw2::TriangleLined(R7Vec2(box.x, box.y),
|
||||||
|
R7Vec2(box.x + box.z, box.y),
|
||||||
|
R7Vec2(box.x, box.y + box.w), 0xff0000ff);
|
||||||
|
RenderD7::Draw2::TriangleLined(
|
||||||
|
R7Vec2(box.x, box.y + box.w), R7Vec2(box.x + box.z, box.y),
|
||||||
|
R7Vec2(box.x + box.z, box.y + box.w), 0xff0000ff);
|
||||||
|
}
|
||||||
|
R7Vec4 box;
|
||||||
|
int type;
|
||||||
|
bool s = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
std::vector<unsigned int> ui7i_debug_colors{
|
||||||
|
0x00000000,
|
||||||
|
};
|
||||||
|
|
||||||
struct UI7_Ctx {
|
struct UI7_Ctx {
|
||||||
UI7_Ctx() {
|
UI7_Ctx() {
|
||||||
delta = 0.0f;
|
delta = 0.0f;
|
||||||
@ -76,6 +101,7 @@ struct UI7_Ctx {
|
|||||||
cbackup = R7Vec2();
|
cbackup = R7Vec2();
|
||||||
in_menu = false;
|
in_menu = false;
|
||||||
current_menu = UI7ID("");
|
current_menu = UI7ID("");
|
||||||
|
debugging = true;
|
||||||
}
|
}
|
||||||
float delta;
|
float delta;
|
||||||
float time;
|
float time;
|
||||||
@ -85,9 +111,11 @@ struct UI7_Ctx {
|
|||||||
R7Vec2 cbackup;
|
R7Vec2 cbackup;
|
||||||
R7Vec2 slc;
|
R7Vec2 slc;
|
||||||
bool in_menu;
|
bool in_menu;
|
||||||
|
bool debugging;
|
||||||
UI7ID current_menu;
|
UI7ID current_menu;
|
||||||
std::map<std::string, R7Vec2> grid_mapping;
|
std::map<std::string, R7Vec2> grid_mapping;
|
||||||
std::unordered_map<std::string, UI7ID *> ids;
|
std::unordered_map<std::string, UI7ID *> ids;
|
||||||
|
std::vector<UI7OBJ> objects;
|
||||||
};
|
};
|
||||||
|
|
||||||
UI7_Ctx *ui7_ctx;
|
UI7_Ctx *ui7_ctx;
|
||||||
@ -127,6 +155,12 @@ void UI7CtxCursorMove(R7Vec2 size) {
|
|||||||
ui7_ctx->slc += R7Vec2(size.x, 0);
|
ui7_ctx->slc += R7Vec2(size.x, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void UI7CtxRegObj(const UI7OBJ &obj) {
|
||||||
|
if (!UI7CtxValidate()) return;
|
||||||
|
if (!ui7_ctx->debugging) return;
|
||||||
|
ui7_ctx->objects.push_back(obj);
|
||||||
|
}
|
||||||
|
|
||||||
UI7ID *UI7CtxNewID(const std::string &i) {
|
UI7ID *UI7CtxNewID(const std::string &i) {
|
||||||
std::string t = i;
|
std::string t = i;
|
||||||
std::transform(t.begin(), t.end(), t.begin(),
|
std::transform(t.begin(), t.end(), t.begin(),
|
||||||
@ -195,6 +229,7 @@ void Update() {
|
|||||||
ui7_ctx->time += ui7_ctx->delta;
|
ui7_ctx->time += ui7_ctx->delta;
|
||||||
ui7_ctx->cursor = R7Vec2();
|
ui7_ctx->cursor = R7Vec2();
|
||||||
UI7CtxClearIDs();
|
UI7CtxClearIDs();
|
||||||
|
if (ui7_ctx->debugging) ui7_ctx->objects.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
float GetTime() {
|
float GetTime() {
|
||||||
@ -219,8 +254,7 @@ bool Button(const std::string &label, R7Vec2 size) {
|
|||||||
}
|
}
|
||||||
RD7Color btn = RD7Color_Button;
|
RD7Color btn = RD7Color_Button;
|
||||||
R7Vec2 pos = GetCursorPos();
|
R7Vec2 pos = GetCursorPos();
|
||||||
|
UI7CtxRegObj(UI7OBJ(R7Vec4(pos, size), 0));
|
||||||
UI7CtxCursorMove(size);
|
|
||||||
|
|
||||||
if (RenderD7::Hid::IsEvent("touch", RenderD7::Hid::Up) &&
|
if (RenderD7::Hid::IsEvent("touch", RenderD7::Hid::Up) &&
|
||||||
InBox(RenderD7::Hid::GetLastTouchPosition(), pos, size)) {
|
InBox(RenderD7::Hid::GetLastTouchPosition(), pos, size)) {
|
||||||
@ -237,6 +271,7 @@ bool Button(const std::string &label, R7Vec2 size) {
|
|||||||
RenderD7::TextColorByBg(btn);
|
RenderD7::TextColorByBg(btn);
|
||||||
RenderD7::Draw2::Text(pos, label);
|
RenderD7::Draw2::Text(pos, label);
|
||||||
RenderD7::UndoColorEdit(RD7Color_Text);
|
RenderD7::UndoColorEdit(RD7Color_Text);
|
||||||
|
UI7CtxCursorMove(size);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -265,8 +300,11 @@ void Checkbox(const std::string &label, bool &c) {
|
|||||||
if (c == true) {
|
if (c == true) {
|
||||||
RenderD7::Draw2::RFS(pos + R7Vec2(2, 2), cbs - R7Vec2(4, 4),
|
RenderD7::Draw2::RFS(pos + R7Vec2(2, 2), cbs - R7Vec2(4, 4),
|
||||||
RenderD7::StyleColor(RD7Color_Checkmark));
|
RenderD7::StyleColor(RD7Color_Checkmark));
|
||||||
|
UI7CtxRegObj(UI7OBJ(R7Vec4(pos + R7Vec2(2, 2), cbs - R7Vec2(4, 4)), 2));
|
||||||
}
|
}
|
||||||
RenderD7::Draw2::Text(pos + R7Vec2(cbs.x + 5, 1), label);
|
RenderD7::Draw2::Text(pos + R7Vec2(cbs.x + 5, 1), label);
|
||||||
|
UI7CtxRegObj(UI7OBJ(R7Vec4(pos, cbs + R7Vec2(txtdim.x + 5, 0)), 0));
|
||||||
|
UI7CtxRegObj(UI7OBJ(R7Vec4(pos, cbs), 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Label(const std::string &label, RD7TextFlags flags) {
|
void Label(const std::string &label, RD7TextFlags flags) {
|
||||||
@ -274,6 +312,11 @@ void Label(const std::string &label, RD7TextFlags flags) {
|
|||||||
R7Vec2 textdim = RenderD7::GetTextDimensions(label);
|
R7Vec2 textdim = RenderD7::GetTextDimensions(label);
|
||||||
R7Vec2 pos = GetCursorPos();
|
R7Vec2 pos = GetCursorPos();
|
||||||
float tbh = RenderD7::TextGetSize() * 40;
|
float tbh = RenderD7::TextGetSize() * 40;
|
||||||
|
if (flags & RD7TextFlags_AlignRight) {
|
||||||
|
UI7CtxRegObj(UI7OBJ(R7Vec4(pos - R7Vec2(textdim.x, 0), textdim), 0));
|
||||||
|
} else {
|
||||||
|
UI7CtxRegObj(UI7OBJ(R7Vec4(pos, textdim), 0));
|
||||||
|
}
|
||||||
// Remove some y offset cause texts have some offset
|
// Remove some y offset cause texts have some offset
|
||||||
UI7CtxCursorMove(textdim - R7Vec2(0, 4));
|
UI7CtxCursorMove(textdim - R7Vec2(0, 4));
|
||||||
RenderD7::TextColorByBg(
|
RenderD7::TextColorByBg(
|
||||||
@ -301,6 +344,7 @@ void Image(RenderD7::Image *img) {
|
|||||||
if (!UI7CtxValidate()) return;
|
if (!UI7CtxValidate()) return;
|
||||||
R7Vec2 pos = GetCursorPos();
|
R7Vec2 pos = GetCursorPos();
|
||||||
UI7CtxCursorMove(R7Vec2(img->get_size().x, img->get_size().y));
|
UI7CtxCursorMove(R7Vec2(img->get_size().x, img->get_size().y));
|
||||||
|
UI7CtxRegObj(UI7OBJ(R7Vec4(pos, img->get_size()), 0));
|
||||||
|
|
||||||
RenderD7::Draw2::Image(img, pos);
|
RenderD7::Draw2::Image(img, pos);
|
||||||
}
|
}
|
||||||
@ -414,6 +458,7 @@ bool BeginMenu(const std::string &title, R7Vec2 size, UI7MenuFlags flags) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SetCursorPos(R7Vec2(5, tbh + 5));
|
SetCursorPos(R7Vec2(5, tbh + 5));
|
||||||
|
|
||||||
return UI7CtxBeginMenu(title);
|
return UI7CtxBeginMenu(title);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -488,4 +533,13 @@ void SameLine() {
|
|||||||
ui7_ctx->cursor = ui7_ctx->slc;
|
ui7_ctx->cursor = ui7_ctx->slc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Debug() {
|
||||||
|
if (!UI7CtxValidate()) return;
|
||||||
|
if (ui7_ctx->debugging) {
|
||||||
|
for (size_t i = 0; i < ui7_ctx->objects.size(); i++) {
|
||||||
|
ui7_ctx->objects[i].Debug();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace UI7
|
} // namespace UI7
|
@ -8,8 +8,8 @@
|
|||||||
#define reca_cc(x) reinterpret_cast<const char*>(x)
|
#define reca_cc(x) reinterpret_cast<const char*>(x)
|
||||||
#define reca_c(x) reinterpret_cast<char*>(x)
|
#define reca_c(x) reinterpret_cast<char*>(x)
|
||||||
#define pak32(q, w, e, r) \
|
#define pak32(q, w, e, r) \
|
||||||
((((q)&0xff) << 0) | (((w)&0xff) << 8) | (((e)&0xff) << 16) | \
|
((((q) & 0xff) << 0) | (((w) & 0xff) << 8) | (((e) & 0xff) << 16) | \
|
||||||
(((r)&0xff) << 24))
|
(((r) & 0xff) << 24))
|
||||||
|
|
||||||
// Stupid RLE Algorithm
|
// Stupid RLE Algorithm
|
||||||
void npi_compress(std::vector<unsigned char>& ret,
|
void npi_compress(std::vector<unsigned char>& ret,
|
||||||
|
@ -448,6 +448,7 @@ void RenderD7::FrameEnd() {
|
|||||||
RenderD7::Ftrace::Beg("rd7oh", f2s(OvlHandler));
|
RenderD7::Ftrace::Beg("rd7oh", f2s(OvlHandler));
|
||||||
OvlHandler();
|
OvlHandler();
|
||||||
RenderD7::Ftrace::End("rd7oh", f2s(OvlHandler));
|
RenderD7::Ftrace::End("rd7oh", f2s(OvlHandler));
|
||||||
|
UI7::Debug();
|
||||||
Npifade();
|
Npifade();
|
||||||
RenderD7::Ftrace::End("rd7-core", "frame");
|
RenderD7::Ftrace::End("rd7-core", "frame");
|
||||||
C3D_FrameEnd(0);
|
C3D_FrameEnd(0);
|
||||||
@ -593,10 +594,10 @@ void RenderD7::RSettings::Draw(void) const {
|
|||||||
// List Bg
|
// List Bg
|
||||||
for (int i = 0; i < 12; i++) {
|
for (int i = 0; i < 12; i++) {
|
||||||
if ((i % 2 == 0))
|
if ((i % 2 == 0))
|
||||||
RenderD7::Draw2::RFS(R7Vec2(0, 40 + (i)*15), R7Vec2(400, 15),
|
RenderD7::Draw2::RFS(R7Vec2(0, 40 + (i) * 15), R7Vec2(400, 15),
|
||||||
RenderD7::StyleColor(RD7Color_List0));
|
RenderD7::StyleColor(RD7Color_List0));
|
||||||
else
|
else
|
||||||
RenderD7::Draw2::RFS(R7Vec2(0, 40 + (i)*15), R7Vec2(400, 15),
|
RenderD7::Draw2::RFS(R7Vec2(0, 40 + (i) * 15), R7Vec2(400, 15),
|
||||||
RenderD7::StyleColor(RD7Color_List1));
|
RenderD7::StyleColor(RD7Color_List1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,17 +1,17 @@
|
|||||||
#include <renderd7/external/stb_image.h>
|
#include <renderd7/external/stb_image.h>
|
||||||
|
|
||||||
#include <renderd7/Color.hpp>
|
#include <renderd7/Color.hpp>
|
||||||
#include <renderd7/nimg_engine.hpp>
|
#include <renderd7/swr.hpp>
|
||||||
|
|
||||||
namespace RenderD7 {
|
namespace RenderD7 {
|
||||||
NIMG_Engine::NIMG_Engine(int w, int h) { image = RenderD7::nimg(w, h); }
|
swr::swr(int w, int h) { image = RenderD7::nimg(w, h); }
|
||||||
NIMG_Engine::NIMG_Engine() { image = RenderD7::nimg(1, 1); }
|
swr::swr() { image = RenderD7::nimg(1, 1); }
|
||||||
|
|
||||||
NIMG_Engine::~NIMG_Engine() {
|
swr::~swr() {
|
||||||
// Do nothing
|
// Do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
void NIMG_Engine::load_file(const std::string& path) {
|
void swr::load_file(const std::string& path) {
|
||||||
int w, h, c;
|
int w, h, c;
|
||||||
uint8_t* dat = stbi_load(path.c_str(), &w, &h, &c, 4);
|
uint8_t* dat = stbi_load(path.c_str(), &w, &h, &c, 4);
|
||||||
image = nimg(w, h);
|
image = nimg(w, h);
|
||||||
@ -27,11 +27,11 @@ void NIMG_Engine::load_file(const std::string& path) {
|
|||||||
stbi_image_free(dat);
|
stbi_image_free(dat);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NIMG_Engine::load_nimg(const std::string& path) {
|
void swr::load_nimg(const std::string& path) {
|
||||||
image = RenderD7::NIMG_Load(path);
|
image = RenderD7::NIMG_Load(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NIMG_Engine::draw_pixel(int x, int y, unsigned int color) {
|
void swr::draw_pixel(int x, int y, unsigned int color) {
|
||||||
if (x > image.width || x < 0 || y > image.height || y < 0) return;
|
if (x > image.width || x < 0 || y > image.height || y < 0) return;
|
||||||
RenderD7::Color::RGBA splitter(color);
|
RenderD7::Color::RGBA splitter(color);
|
||||||
image.pixel_buffer[((y * image.width + x) * 4) + 0] = splitter.m_r;
|
image.pixel_buffer[((y * image.width + x) * 4) + 0] = splitter.m_r;
|
||||||
@ -40,11 +40,14 @@ void NIMG_Engine::draw_pixel(int x, int y, unsigned int color) {
|
|||||||
image.pixel_buffer[((y * image.width + x) * 4) + 3] = splitter.m_a;
|
image.pixel_buffer[((y * image.width + x) * 4) + 3] = splitter.m_a;
|
||||||
}
|
}
|
||||||
|
|
||||||
void NIMG_Engine::draw_rect(int x, int y, int w, int h, unsigned int color,
|
void swr::draw_rect(int x, int y, int w, int h, unsigned int color, int t) {
|
||||||
int t) {}
|
draw_line(x, y, x + w, y, color, t);
|
||||||
|
draw_line(x, y, x, y + h, color, t);
|
||||||
|
draw_line(x, y + h, x + w, y + h, color, t);
|
||||||
|
draw_line(x + w, y + h, x + w, y + h, color, t);
|
||||||
|
}
|
||||||
|
|
||||||
void NIMG_Engine::draw_rect_solid(int x, int y, int w, int h,
|
void swr::draw_rect_solid(int x, int y, int w, int h, unsigned int color) {
|
||||||
unsigned int color) {
|
|
||||||
for (int ix = x; ix < x + w; ix++) {
|
for (int ix = x; ix < x + w; ix++) {
|
||||||
for (int iy = y; iy < y + h; iy++) {
|
for (int iy = y; iy < y + h; iy++) {
|
||||||
draw_pixel(ix, iy, color);
|
draw_pixel(ix, iy, color);
|
||||||
@ -52,7 +55,15 @@ void NIMG_Engine::draw_rect_solid(int x, int y, int w, int h,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void NIMG_Engine::flip(bool h, bool v) {
|
void swr::draw_line(int x1, int y1, int x2, int y2, unsigned int color, int t) {
|
||||||
|
for (int ix = x1; ix < x2 * t; ix++) {
|
||||||
|
for (int iy = y1; iy < y2 * t; iy++) {
|
||||||
|
draw_pixel(ix, iy, color);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void swr::flip(bool h, bool v) {
|
||||||
const nimg _bak = image;
|
const nimg _bak = image;
|
||||||
if (h) {
|
if (h) {
|
||||||
for (int x = 0; x < image.width; x++) {
|
for (int x = 0; x < image.width; x++) {
|
Reference in New Issue
Block a user