# Rewrite Stage 1.5
- Added Overlays (Performance / Keyboaed) - Keyboard has Gamepad Movement WIP (kinda) - Work on UI7 Started - Added Input Manager - Added Message Boxes (Animated) - Added Signle Header Tween func for animated stuff (Keyboard Messages, etc) - Add FastHash (Maybe useful later) - Using const & for vec in lithium - Add ability to copy a command by a Ref - Make Lists in Commands OpenAccess for Modification (StaticObject) - Add Static Object (System to PreRender Suff that never changes) but can still be recolored or moved - Add Layer and Font change functions - Make Renderer Tools (RotateCorner, CreateRect, CreateLine, InBox, OptiCommandList) static (OpenAccess) - Add ReIndexing to PushCommand - Add Ability to Init vec3 and vec4 with vec2 and add .xy and .zw to vec4 - Fully Animated Keyboard that currently has problem of Top Down GamePad movement - Add Func to Get GamePad Icon Codepoints for TextRenderer - Made deltatime a float - Using filesystem::path().wstring for convertation (works) - Add a New InBox to Renderer that only checks if a point is inside a boundingbox - Disable Font loading on Renderer Init due to 3ds Freezes when using SystemFont - Make SystemFont lineheight 10% larger than it is to be nearly the same size as the ttf fonts - Fix Some SpaceOffsets between TTF and SystemFont Rendering - Cleanup the Update Rendermode Func - Use LayerRenderSystem by default now as it now runs faster even with ttf fonts
This commit is contained in:
@ -25,6 +25,7 @@ SOFTWARE.
|
||||
|
||||
#include <ctime>
|
||||
#include <pd.hpp>
|
||||
#include <pd/maths/tween.hpp>
|
||||
|
||||
using vec2 = PD::vec2;
|
||||
using vec3 = PD::vec3;
|
||||
@ -37,37 +38,36 @@ class Test : public PD::App {
|
||||
|
||||
void Init() override {
|
||||
test = PD::Texture::New("romfs:/icon.png");
|
||||
cpu = PD::TimeStats::New(100);
|
||||
Overlays()->Push(PD::New<PD::Performance>(dbg, dbg_screen));
|
||||
font = PD::LI::Font::New();
|
||||
// font->LoadSystemFont();
|
||||
font->LoadTTF("romfs:/ComicNeue.ttf", 32);
|
||||
Renderer()->Font(font);
|
||||
ui7 = PD::UI7::Context::New();
|
||||
}
|
||||
|
||||
bool MainLoop(unsigned long long delta, float time) override {
|
||||
cpu->Add(C3D_GetProcessingTime());
|
||||
hidScanInput();
|
||||
bool MainLoop(float delta, float time) override {
|
||||
DrawFancyBG(time);
|
||||
Renderer()->TextScale(0.6f);
|
||||
vec2 start(5, 100);
|
||||
DebugText(start, "FPS: " + std::to_string((int)GetFps()));
|
||||
DebugText(start, "DrawCalls: " + std::to_string(Renderer()->DrawCalls()));
|
||||
DebugText(start, "DrawCommands: " + std::to_string(Renderer()->Commands()));
|
||||
DebugText(start, "Vertices: " + std::to_string(Renderer()->Vertices()));
|
||||
DebugText(start, "Indices: " + std::to_string(Renderer()->Indices()));
|
||||
DebugText(start, "Ren [AVG]: " + PD::Strings::FormatNanos(
|
||||
PD::Sys::GetTraceRef("LI_RenderAll")
|
||||
->GetProtocol()
|
||||
->GetAverage()));
|
||||
DebugText(start, "App [AVG]: " + PD::Strings::FormatNanos(
|
||||
PD::Sys::GetTraceRef("App_MainLoop")
|
||||
->GetProtocol()
|
||||
->GetAverage()));
|
||||
Renderer()->DefaultTextScale();
|
||||
Renderer()->OnScreen(PD::Screen::Bottom);
|
||||
Renderer()->DrawRectSolid(0, vec2(320, 240), PD::Color("#222222"));
|
||||
Renderer()->UseTex(test);
|
||||
Renderer()->DrawImage(vec2(130, 90), test);
|
||||
Renderer()->Layer(Renderer()->Layer() + 1);
|
||||
Renderer()->DrawImage(
|
||||
Renderer()->GetViewport().zw() * 0.5 - test->GetSize() * 0.5, test);
|
||||
Renderer()->DrawText(5, 0xffffffff, "Hello World!", LITextFlags_None);
|
||||
if (hidKeysDown() & KEY_START) {
|
||||
if (Input()->IsDown(PD::Hid::Start)) {
|
||||
return false;
|
||||
}
|
||||
if (Input()->IsDown(Input()->A)) {
|
||||
Overlays()->Push(PD::New<PD::Performance>(dbg, dbg_screen));
|
||||
Messages()->Push("Test", "Oder SO");
|
||||
// what.To(vec2(5, 200)).From(vec2(-100,
|
||||
// 200)).In(0.5).As(what.EaseInQuad);
|
||||
}
|
||||
if (Input()->IsUp(Input()->B)) {
|
||||
Overlays()->Push(PD::New<PD::Keyboard>(text, state));
|
||||
// what.To(vec2(5, 180)).From(vec2(5, 200)).In(0.5).As(what.EaseOutQuad);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -97,16 +97,13 @@ class Test : public PD::App {
|
||||
.36f + .38f * color_effect));
|
||||
}
|
||||
|
||||
void DebugText(vec2& pos, const std::string& text) {
|
||||
auto tbs = Renderer()->GetTextDimensions(text);
|
||||
Renderer()->DrawRectSolid(pos, tbs, 0xaa000000);
|
||||
Renderer()->DrawText(pos, 0xffff00ff, text);
|
||||
pos[1] += tbs[1]; // Auto set new pos
|
||||
}
|
||||
|
||||
private:
|
||||
PD::Texture::Ref test;
|
||||
PD::TimeStats::Ref cpu;
|
||||
bool dbg = false, dbg_screen = false;
|
||||
std::string text;
|
||||
PD::Keyboard::State state;
|
||||
PD::UI7::Context::Ref ui7;
|
||||
PD::LI::Font::Ref font;
|
||||
};
|
||||
|
||||
int main() {
|
||||
|
Reference in New Issue
Block a user