Add Overlays Engine

This commit is contained in:
tobid7 2022-04-10 00:59:30 +02:00
parent d0e4d2296c
commit edb634b79d
2 changed files with 41 additions and 26 deletions

View File

@ -10,6 +10,7 @@ float animtime;
bool isndspinit = false;
bool running = true;
std::stack<std::unique_ptr<RenderD7::Scene>> RenderD7::Scene::scenes;
std::vevtor<RenderD7::Ovl> overlays;
bool usedbgmsg = false;
std::string dspststus = "Not Initialisized!";
@ -577,11 +578,7 @@ Result RenderD7::Init::Main(std::string app_name)
mt_screen = RenderD7::Convert::StringtoInt(cfgstruct["metrik-settings"]["Screen"]);
osSetSpeedupEnable(true);
/*if(metrikd)
{
RenderD7::Thread tr(MetrikThread);
tr.start();
}*/
C3D_Init(C3D_DEFAULT_CMDBUF_SIZE);
C2D_Init(size_t(maxobj__));
C2D_Prepare();
@ -838,14 +835,17 @@ void RenderD7::DrawMetrikOvl()
{
case 0:
RenderD7::OnScreen(Top);
break;
case 1:
RenderD7::OnScreen(Bottom);
break;
default:
RenderD7::OnScreen(Bottom);
break;
}
RenderD7::DrawText(0, 0, mt_txtSize, mt_txtcolor, "FPS: " + RenderD7::GetFramerate());
//RenderD7::DrawText(0, 50, mt_txtSize, mt_txtcolor, "CPU: " + std::to_string(C3D_GetProcessingTime()*6.0f) + "/" + std::to_string(C3D_GetProcessingTime()));
//RenderD7::DrawText(0, 70, mt_txtSize, mt_txtcolor, "GPU: " + std::to_string(C3D_GetDrawingTime()*6.0f) + "/" + std::to_string(C3D_GetDrawingTime()));
RenderD7::DrawText(0, 50, mt_txtSize, mt_txtcolor, "CPU: " + std::to_string(C3D_GetProcessingTime()*6.0f) + "/" + std::to_string(C3D_GetProcessingTime()));
RenderD7::DrawText(0, 70, mt_txtSize, mt_txtcolor, "GPU: " + std::to_string(C3D_GetDrawingTime()*6.0f) + "/" + std::to_string(C3D_GetDrawingTime()));
for (int z = 0; z < 320; z++)
{
C2D_DrawLine(z, 239 - mt_fpsgraph[z], mt_txtcolor, z + 1, 239 - mt_fpsgraph[z + 1], mt_txtcolor, 1, 1);
@ -864,9 +864,17 @@ bool RenderD7::DrawNFRect(float p1x, float p1y, float w, float h, u32 color, flo
void RenderD7::FrameEnd()
{
if (metrikd)RenderD7::DrawMetrikOvl();
for (int i = 0; i < (int))overlays.size(); i++)
{
overlays[i].Draw();
}
C3D_FrameEnd(0);
}
void AddOvl(Ovl overlay)
{
overlays.push_back(overlay);
}
/*RenderD7::Console::Console()
{
this->x = 0;

View File

@ -6,6 +6,7 @@
#include <stack>
#include <string>
#include <functional>
#include <map>
#include <vector>
#include <dirent.h>
#include <unistd.h>
@ -133,6 +134,12 @@ namespace RenderD7
//static void HandleOvl();
};
class Ovl {
public:
virtual ~Ovl(){}
virtual void Draw() const = 0;
};
void AddOvl(Ovl overlay);
namespace Color
{
struct rgba