Skip to content

Commit

Permalink
remove unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
ITotalJustice committed Dec 4, 2020
1 parent c3ddeb2 commit 0c854ff
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 98 deletions.
19 changes: 1 addition & 18 deletions src/app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// #include "nanovg/deko3d/nanovg_dk.h"
#include "nanovg_dk.h"
#include <algorithm>
#include <ranges>
#include <cassert>

#ifndef NDEBUG
Expand Down Expand Up @@ -49,16 +50,6 @@ void App::Loop() {
}
}

template <typename ...Args>
void test(Args... args) {
const auto size = sizeof...(args);
std::printf("we have this many args %lu\n", size);
}

// void function(std::same_as<std::pair<char*, YourEnum>> auto ... args) {
// // ...
// }

void App::Poll() {
// this will break with new libnx. when it does, let me know and i'll fix it
hidScanInput();
Expand Down Expand Up @@ -101,14 +92,6 @@ void App::Poll() {
}
};

if (this->controller.A) {
// test(pair{"cat", true}, pair{"dog", false});
// LOG("float returned is %.2f\n", nvgText(this->vg, 0, 0, "hello there hhhhhhhhh", nullptr));
} else if (this->controller.Y) {
// test(pair{"cat", true});
// gfx::drawButtons(this->vg, gfx::pair{gfx::Button::A, "ayy"}, gfx::pair{gfx::Button::A, "beee"});
}

display("A", this->controller.A);
display("B", this->controller.B);
display("X", this->controller.X);
Expand Down
2 changes: 1 addition & 1 deletion src/app.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ class App final {
void DrawConfirm();
void DrawProgress();

private: // from nanovg decko3d example by addubz
private: // from nanovg decko3d example by adubbz
static constexpr unsigned NumFramebuffers = 2;
static constexpr unsigned StaticCmdSize = 0x1000;
dk::UniqueDevice device;
Expand Down
68 changes: 0 additions & 68 deletions src/nvg_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,41 +120,6 @@ void drawRect(NVGcontext* vg, float x, float y, float w, float h, const NVGpaint
nvgFill(vg);
}

void drawRoundedRect(NVGcontext* vg, float x, float y, float w, float h, float r, Colour c) {
nvgBeginPath(vg);
nvgRoundedRect(vg, x, y, w, h, r);
nvgFillColor(vg, getColour(c));
nvgFill(vg);
}

void drawRoundedRect(NVGcontext* vg, float x, float y, float w, float h, float r, const NVGcolor& c) {
nvgBeginPath(vg);
nvgRoundedRect(vg, x, y, w, h, r);
nvgFillColor(vg, c);
nvgFill(vg);
}

void drawRoundedRect(NVGcontext* vg, float x, float y, float w, float h, float r, const NVGcolor&& c) {
nvgBeginPath(vg);
nvgRoundedRect(vg, x, y, w, h, r);
nvgFillColor(vg, c);
nvgFill(vg);
}

void drawRoundedRect(NVGcontext* vg, float x, float y, float w, float h, float r, const NVGpaint& p) {
nvgBeginPath(vg);
nvgRoundedRect(vg, x, y, w, h, r);
nvgFillPaint(vg, p);
nvgFill(vg);
}

void drawRoundedRect(NVGcontext* vg, float x, float y, float w, float h, float r, const NVGpaint&& p) {
nvgBeginPath(vg);
nvgRoundedRect(vg, x, y, w, h, r);
nvgFillPaint(vg, p);
nvgFill(vg);
}

void drawText(NVGcontext* vg, float x, float y, float size, const char* str, const char* end, int align, Colour c) {
nvgBeginPath(vg);
nvgFontSize(vg, size);
Expand Down Expand Up @@ -188,41 +153,8 @@ void drawTextArgs(NVGcontext* vg, float x, float y, float size, int align, Colou
va_end(v);
}

void drawTriangle(NVGcontext* vg, float aX, float aY, float bX, float bY, float cX, float cY, Colour c) {
nvgBeginPath(vg);
nvgMoveTo(vg, aX, aY);
nvgLineTo(vg, bX, bY);
nvgLineTo(vg, cX, cY);
nvgFillColor(vg, getColour(c));
nvgFill(vg);
}

void drawTriangle(NVGcontext* vg, float aX, float aY, float bX, float bY, float cX, float cY, const NVGcolor& c) {
nvgBeginPath(vg);
nvgMoveTo(vg, aX, aY);
nvgLineTo(vg, bX, bY);
nvgLineTo(vg, cX, cY);
nvgFillColor(vg, c);
nvgFill(vg);
}

void drawTriangle(NVGcontext* vg, float aX, float aY, float bX, float bY, float cX, float cY, const NVGcolor&& c) {
nvgBeginPath(vg);
nvgMoveTo(vg, aX, aY);
nvgLineTo(vg, bX, bY);
nvgLineTo(vg, cX, cY);
nvgFillColor(vg, c);
nvgFill(vg);
}

void drawButton(NVGcontext* vg, float x, float y, float size, Button button) {
drawText(vg, x, y, size, getButton(button), nullptr, NVG_ALIGN_LEFT | NVG_ALIGN_MIDDLE, getColour(Colour::WHITE));
}

void drawButtonText(NVGcontext* vg, float x, float y, float size, Button button, const char* text) {
const float text_pos = x + size + 12.f;
drawButton(vg, x, y, size, button);
drawText(vg, text_pos, y, size, text, nullptr, NVG_ALIGN_LEFT | NVG_ALIGN_MIDDLE, getColour(Colour::WHITE));
}

} // namespace tj::gfx
11 changes: 0 additions & 11 deletions src/nvg_util.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,23 +64,12 @@ void drawRect(NVGcontext*, float x, float y, float w, float h, const NVGcolor&&
void drawRect(NVGcontext*, float x, float y, float w, float h, const NVGpaint& p);
void drawRect(NVGcontext*, float x, float y, float w, float h, const NVGpaint&& p);

void drawRoundedRect(NVGcontext*, float x, float y, float w, float h, float r, Colour c);
void drawRoundedRect(NVGcontext*, float x, float y, float w, float h, float r, const NVGcolor& c);
void drawRoundedRect(NVGcontext*, float x, float y, float w, float h, float r, const NVGcolor&& c);
void drawRoundedRect(NVGcontext*, float x, float y, float w, float h, float r, const NVGpaint& p);
void drawRoundedRect(NVGcontext*, float x, float y, float w, float h, float r, const NVGpaint&& p);

void drawTriangle(NVGcontext*, float aX, float aY, float bX, float bY, float cX, float cY, Colour c);
void drawTriangle(NVGcontext*, float aX, float aY, float bX, float bY, float cX, float cY, const NVGcolor& c);
void drawTriangle(NVGcontext*, float aX, float aY, float bX, float bY, float cX, float cY, const NVGcolor&& c);

void drawText(NVGcontext*, float x, float y, float size, const char* str, const char* end, int align, Colour c);
void drawText(NVGcontext*, float x, float y, float size, const char* str, const char* end, int align, const NVGcolor& c);
void drawText(NVGcontext*, float x, float y, float size, const char* str, const char* end, int align, const NVGcolor&& c);
void drawTextArgs(NVGcontext*, float x, float y, float size, int align, Colour c, const char* str, ...);

void drawButton(NVGcontext* vg, float x, float y, float size, Button button);
void drawButtonText(NVGcontext* vg, float x, float y, float size, Button button, const char* text);

const char* getButton(Button button);

Expand Down

0 comments on commit 0c854ff

Please sign in to comment.