rewrite everything
This commit is contained in:
56
Source/sys-clk/overlay/src/ui/gui/base_gui.cpp
Normal file
56
Source/sys-clk/overlay/src/ui/gui/base_gui.cpp
Normal file
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* --------------------------------------------------------------------------
|
||||
* "THE BEER-WARE LICENSE" (Revision 42):
|
||||
* <p-sam@d3vs.net>, <natinusala@gmail.com>, <m4x@m4xw.net>
|
||||
* wrote this file. As long as you retain this notice you can do whatever you
|
||||
* want with this stuff. If you meet any of us some day, and you think this
|
||||
* stuff is worth it, you can buy us a beer in return. - The sys-clk authors
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include "base_gui.h"
|
||||
|
||||
#include "../elements/base_frame.h"
|
||||
#include "logo_rgba_bin.h"
|
||||
|
||||
|
||||
#define LOGO_WIDTH 110
|
||||
#define LOGO_HEIGHT 39
|
||||
#define LOGO_X 18
|
||||
#define LOGO_Y 21
|
||||
|
||||
#define LOGO_LABEL_X (LOGO_X + LOGO_WIDTH + 6)
|
||||
#define LOGO_LABEL_Y 50
|
||||
#define LOGO_LABEL_FONT_SIZE 28
|
||||
|
||||
#define VERSION_X (LOGO_LABEL_X + 110+8)
|
||||
#define VERSION_Y LOGO_LABEL_Y-4
|
||||
#define VERSION_FONT_SIZE 15
|
||||
|
||||
std::string getVersionString() {
|
||||
char buf[0x100] = ""; // 256 bytes — safe for any expected version string
|
||||
Result rc = sysclkIpcGetVersionString(buf, sizeof(buf));
|
||||
if (R_FAILED(rc) || buf[0] == '\0') {
|
||||
return "unknown";
|
||||
}
|
||||
return std::string(buf);
|
||||
}
|
||||
|
||||
void BaseGui::preDraw(tsl::gfx::Renderer* renderer)
|
||||
{
|
||||
renderer->drawBitmap(LOGO_X, LOGO_Y, LOGO_WIDTH, LOGO_HEIGHT, logo_rgba_bin);
|
||||
renderer->drawString("overlay", false, LOGO_LABEL_X, LOGO_LABEL_Y, LOGO_LABEL_FONT_SIZE, renderer->a(TEXT_COLOR));
|
||||
renderer->drawString(TARGET_VERSION, false, VERSION_X, VERSION_Y, VERSION_FONT_SIZE, tsl::bannerVersionTextColor);
|
||||
}
|
||||
|
||||
tsl::elm::Element* BaseGui::createUI()
|
||||
{
|
||||
BaseFrame* rootFrame = new BaseFrame(this);
|
||||
rootFrame->setContent(this->baseUI());
|
||||
return rootFrame;
|
||||
}
|
||||
|
||||
void BaseGui::update()
|
||||
{
|
||||
this->refresh();
|
||||
}
|
||||
Reference in New Issue
Block a user