WIP Backend System Redesign Step 1
- Created 1 Context for Backend Management and Sharing - Made every class that used a static Backend require the Context or specific Backend - Bring Back 3ds support
This commit is contained in:
@@ -34,7 +34,7 @@ SOFTWARE.
|
||||
namespace PD {
|
||||
class GfxGL2 : public GfxDriver {
|
||||
public:
|
||||
GfxGL2() : GfxDriver("OpenGL2") {}
|
||||
GfxGL2(PDDriverData data = nullptr) : GfxDriver("OpenGL2") {}
|
||||
~GfxGL2() = default;
|
||||
|
||||
PD_SHARED(GfxGL2);
|
||||
|
||||
@@ -30,7 +30,7 @@ SOFTWARE.
|
||||
namespace PD {
|
||||
class HidGLFW : public HidDriver {
|
||||
public:
|
||||
HidGLFW(GLFWwindow* win);
|
||||
HidGLFW(PDDriverData data);
|
||||
~HidGLFW() = default;
|
||||
|
||||
PD_SHARED(HidGLFW);
|
||||
@@ -44,7 +44,7 @@ class HidGLFW : public HidDriver {
|
||||
pTimings.erase(k);
|
||||
return false;
|
||||
}
|
||||
return (PD::OS::GetTime() - pTimings[k]) > 50;
|
||||
return 0; //(PD::OS::GetTime() - pTimings[k]) > 50;
|
||||
}
|
||||
if (!IsEvent(Event_Held, k)) {
|
||||
if (pTimings.count(k)) {
|
||||
@@ -53,7 +53,7 @@ class HidGLFW : public HidDriver {
|
||||
}
|
||||
}
|
||||
if (IsEvent(Event_Held, k)) {
|
||||
pTimings[k] = PD::OS::GetTime();
|
||||
pTimings[k] = 0; // PD::OS::GetTime();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -337,6 +337,8 @@ PD::Li::Texture::Ref GfxGL2::LoadTex(const std::vector<PD::u8>& pixels, int w,
|
||||
}
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
auto res = PD::Li::Texture::New(texID, PD::ivec2(w, h));
|
||||
std::cout << std::format("Texture loaded: {} {}", texID, PD::ivec2(w, h))
|
||||
<< std::endl;
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
@@ -43,8 +43,11 @@ void TextCB(GLFWwindow* win, unsigned int c) {
|
||||
}
|
||||
*HidGLFW::pText += (char)c;
|
||||
}
|
||||
HidGLFW::HidGLFW(GLFWwindow* win) : HidDriver("HidGLFW") {
|
||||
Window = win;
|
||||
HidGLFW::HidGLFW(PDDriverData data) : HidDriver("HidGLFW") {
|
||||
if (!data) {
|
||||
std::cout << "[HidGLFW] Error: Data pointer was null" << std::endl;
|
||||
}
|
||||
Window = reinterpret_cast<GLFWwindow*>(data);
|
||||
HidGLFW::pOldTextCB = glfwSetCharCallback(Window, NullTextCB);
|
||||
Flags |= Flags_HasKeyboard;
|
||||
Flags |= Flags_HasMouse;
|
||||
@@ -148,10 +151,10 @@ void HidGLFW::Update() {
|
||||
glfwGetCursorPos(Window, &x, &y);
|
||||
pMouse[1] = pMouse[0]; // Cycle pMouse pos
|
||||
pMouse[0] = fvec2(x, y);
|
||||
if (pInTextMode && (PD::OS::GetTime() - pLastUpdate) > 50) {
|
||||
pLastUpdate = PD::OS::GetTime();
|
||||
HandleTextOps();
|
||||
}
|
||||
/*if (pInTextMode && (PD::OS::GetTime() - pLastUpdate) > 50) {
|
||||
pLastUpdate = PD::OS::GetTime();
|
||||
HandleTextOps();
|
||||
}*/
|
||||
}
|
||||
|
||||
void HidGLFW::GetInputStr(std::string& str) {
|
||||
|
||||
@@ -26,7 +26,7 @@ SOFTWARE.
|
||||
|
||||
namespace PD {
|
||||
void Init(void* data) {
|
||||
if (!data) {
|
||||
/*if (!data) {
|
||||
std::cout << "[PD-DRIVERS] Error: pd-desktop requires GLFWwindow* "
|
||||
"reference as data "
|
||||
"input!"
|
||||
@@ -37,6 +37,6 @@ void Init(void* data) {
|
||||
// First use default OS Driver
|
||||
PD::OS::Init();
|
||||
PD::Gfx::Init(PD::GfxGL2::New());
|
||||
PD::Hid::Init(PD::HidGLFW::New(reinterpret_cast<GLFWwindow*>(data)));
|
||||
PD::Hid::Init(PD::HidGLFW::New(reinterpret_cast<GLFWwindow*>(data)));*/
|
||||
}
|
||||
} // namespace PD
|
||||
Reference in New Issue
Block a user