# Changes -> 0.5.1

- 3ds
  - Remove Gfx values that are present in Backend Tamplate
  - Move to default Palladium Namespace
  - Set the Input Flags
- Desktop
  - Move to PD Namespace
  - Comment out old keyboard stuff
  - HidDriver needs a rewrite but is functional enough
- Core
  - Add u128 class (only used in input driver so far
- Drivers (Core)
  - Move Gfx to PD namespace
  - Move Vertex/Index Pos and Projection Mtx to Gfx template
  - Add Keyboard support with u128 to Hid
  - Add a Update func if no hiddriver is specified (to prevent crashes when requestign inputs)
- Image
   - Add RGBA -> BGRA support (used in windows bitmaps iirc)
- Lithium
  - Add Vertex/Index counters to drawlist
  - Add a LoadTTF from Mem func and let the loadfile func use PD::IO::LoadFile2Mem (looks cleaner)
  - Add LoadDefaultFont (which loads one of the integrated fonts if the PD_LI_INCLUDE_FONTS flag was passed on palaldium build) !!! Note that there are no fonts integrated yet due to i dont know how to handle licensing...
- UI7
  - Add MouseLeft support to Input handler
  - Use xy coords of the Viewport to create Menus inside it
  - Get num of Vertices/Indices out of FinalDrawList
  - Add some Palladium Info to metrics Menu
  - Readd Compiler string
- pdfm
  - New tool that creates fonts.cpp/fonts.hpp
This commit is contained in:
2025-08-14 20:37:55 +02:00
parent 87910b57de
commit 310b44caf5
38 changed files with 644 additions and 166 deletions

View File

@ -40,8 +40,6 @@ class LinearAlloc : public Allocator<T> {
T* Allocate(size_t n) override { return (T*)linearAlloc(n * sizeof(T)); }
void Deallocate(T* ptr) { linearFree(ptr); }
};
namespace Li {
class GfxC3D : public GfxDriver {
public:
GfxC3D() : GfxDriver("Citro3D") {}
@ -63,16 +61,9 @@ class GfxC3D : public GfxDriver {
Vec<Vertex, LinearAlloc<Vertex>> VertexBuffer;
Vec<u16, LinearAlloc<u16>> IndexBuffer;
size_t CurrentVertex = 0;
size_t CurrentIndex = 0;
Mat4 Projection;
int pLocProjection = 0;
DVLB_s* ShaderCode;
shaderProgram_s Shader;
C3D_AttrInfo ShaderInfo;
// Stats oder so IDNK zu lange her
PD::u32 NumVtx;
PD::u32 NumIdx;
};
} // namespace Li
} // namespace PD

View File

@ -25,6 +25,9 @@ SOFTWARE.
#include <pd-3ds/bknd-gfx.hpp>
/// @brief Shader Code (Unused as i dont want to use libpicasso here (yet))
/// Update: Picasso breaks the linearRam or ram for somereason
/// as far as i found out loading anything into linear ram after
/// using libpicasso to compile a shader leads into a system freeze
const char* LIShaderCTR = R"(
; LI7 Shader
; Constants
@ -70,7 +73,6 @@ unsigned char li_shader[] = {
size_t li_shader_size = 0x124;
namespace PD {
namespace Li {
GPU_TEXCOLOR GetTexFmt(Texture::Type type) {
if (type == Texture::RGBA32)
return GPU_RGBA8;
@ -249,5 +251,4 @@ PD::Li::Texture::Ref GfxC3D::LoadTex(const std::vector<PD::u8>& pixels, int w,
<< std::endl;
return res;
}
} // namespace Li
} // namespace PD

View File

@ -28,6 +28,8 @@ SOFTWARE.
namespace PD {
Hid3DS::Hid3DS() : HidDriver("Hid3DS") {
this->Flags |= Flags_HasTouch;
this->Flags |= FLags_HasGamepad;
pBinds[KEY_A] = A;
pBinds[KEY_B] = B;
pBinds[KEY_X] = X;

View File

@ -30,7 +30,7 @@ void Init(void* data) {
// Dekstop Init Stage
// First use default OS Driver
PD::OS::Init();
PD::Li::Gfx::Init(PD::Li::GfxC3D::New());
PD::Gfx::Init(PD::GfxC3D::New());
PD::Hid::Init(PD::Hid3DS::New());
}
} // namespace PD

View File

@ -33,7 +33,6 @@ SOFTWARE.
#include <pd/lithium/lithium.hpp>
namespace PD {
namespace Li {
class GfxGL2 : public GfxDriver {
public:
GfxGL2() : GfxDriver("OpenGL2") {}
@ -53,18 +52,11 @@ class GfxGL2 : public GfxDriver {
PD::Li::Texture::Filter filter =
PD::Li::Texture::Filter::LINEAR) override;
PD::Vec<Vertex> VertexBuffer;
PD::Vec<Li::Vertex> VertexBuffer;
PD::Vec<PD::u16> IndexBuffer;
size_t CurrentVertex = 0;
size_t CurrentIndex = 0;
GLuint Shader;
GLuint pLocProjection;
GLuint pLocTex;
Mat4 Projection;
GLuint VBO, IBO;
// Stats oder so IDNK zu lange her
PD::u32 NumVtx;
PD::u32 NumIdx;
};
} // namespace Li
} // namespace PD

View File

@ -25,7 +25,6 @@ SOFTWARE.
#include <pd-desktop/bknd-gfx.hpp>
namespace PD {
namespace Li {
const char* vertex_shader = R"(
#version 120
@ -161,13 +160,11 @@ void GfxGL2::NewFrame() {
glUniformMatrix4fv(pLocProjection, 1, GL_FALSE, Projection.m.data());
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
CurrentIndex = 0;
CurrentVertex = 0;
FrameCounter++;
VertexCounter = NumVtx;
IndexCounter = NumIdx;
NumVtx = 0;
NumIdx = 0;
VertexCounter = CurrentVertex;
IndexCounter = CurrentIndex;
CurrentVertex = 0;
CurrentIndex = 0;
}
void GfxGL2::BindTex(PD::Li::TexAddress addr) {
@ -194,11 +191,9 @@ void GfxGL2::RenderDrawData(const std::vector<PD::Li::Command::Ref>& Commands) {
Commands[index]->ScissorRect == ScissorRect) {
auto c = Commands[index].get();
for (size_t i = 0; i < c->IndexBuffer.Size(); i++) {
NumIdx++;
IndexBuffer[CurrentIndex++] = CurrentVertex + c->IndexBuffer.At(i);
}
for (size_t i = 0; i < c->VertexBuffer.Size(); i++) {
NumVtx++;
VertexBuffer[CurrentVertex++] = c->VertexBuffer.At(i);
}
index++;
@ -258,5 +253,4 @@ PD::Li::Texture::Ref GfxGL2::LoadTex(const std::vector<PD::u8>& pixels, int w,
auto res = PD::Li::Texture::New(texID, PD::ivec2(w, h));
return res;
}
} // namespace Li
} // namespace PD

View File

@ -40,7 +40,7 @@ HidGLFW::HidGLFW(GLFWwindow* win) : HidDriver("HidGLFW") {
Flags |= Flags_HasKeyboard;
Flags |= Flags_HasMouse;
pBinds[GLFW_MOUSE_BUTTON_LEFT] = Touch;
pBinds[GLFW_KEY_F3] = Kb_3;
/*pBinds[GLFW_KEY_F3] = Kb_3;
pBinds[GLFW_KEY_ESCAPE] = Kb_Escape;
pBinds[GLFW_KEY_F11] = Kb_F11;
pBinds[GLFW_KEY_ESCAPE] = Kb_Escape;
@ -94,7 +94,7 @@ HidGLFW::HidGLFW(GLFWwindow* win) : HidDriver("HidGLFW") {
pBinds[GLFW_KEY_9] = Kb_9;
pBinds[GLFW_KEY_0] = Kb_0;
pBinds[GLFW_KEY_BACKSPACE] = Kb_Backspace;
pBinds[GLFW_KEY_ENTER] = Kb_Enter;
pBinds[GLFW_KEY_ENTER] = Kb_Enter;*/
}
void HidGLFW::Update() {
@ -108,7 +108,7 @@ void HidGLFW::Update() {
}
}
// Keyboard Logic
for (auto& it : pBinds) {
/*for (auto& it : pBinds) {
int kbstate = glfwGetKey(Window, it.first);
if (kbstate == GLFW_PRESS) {
if (PrevStates[it.first] == GLFW_RELEASE) {
@ -119,7 +119,7 @@ void HidGLFW::Update() {
KbKeyEvents[0][it.second] = Event_Up;
}
PrevStates[it.first] = kbstate;
}
}*/
// Mouse Logic (Todo: Support all mouse buttons)
int state = glfwGetMouseButton(Window, GLFW_MOUSE_BUTTON_LEFT);
if (state == GLFW_PRESS) {
@ -155,12 +155,12 @@ void HidGLFW::HandleTextOps() {
if (!pText) {
return;
}
if (pTimedHeld(Kb_Backspace)) {
/*if (pTimedHeld(Kb_Backspace)) {
if (!pText->empty()) {
pText->pop_back();
}
} else if (pTimedHeld(Kb_Enter)) {
*pText += '\n';
}
}*/
}
} // namespace PD

View File

@ -37,7 +37,7 @@ void Init(void* data) {
// Dekstop Init Stage
// First use default OS Driver
PD::OS::Init();
PD::Li::Gfx::Init(PD::Li::GfxGL2::New());
PD::Gfx::Init(PD::GfxGL2::New());
PD::Hid::Init(PD::HidGLFW::New(reinterpret_cast<GLFWwindow*>(data)));
}
} // namespace PD