diff --git a/CMakeLists.txt b/CMakeLists.txt index 4c81c5e..003101e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,11 @@ cmake_minimum_required(VERSION 3.21) set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON) -set(CMAKE_OSX_ARCHITECTURES "arm64;x86_64") +if ("${GEODE_TARGET_PLATFORM}" STREQUAL "iOS" OR IOS) + set(CMAKE_OSX_ARCHITECTURES "arm64") +else() + set(CMAKE_OSX_ARCHITECTURES "arm64;x86_64") +endif() project(DevTools VERSION 1.0.0) diff --git a/mod.json b/mod.json index 343ad80..b217a83 100644 --- a/mod.json +++ b/mod.json @@ -1,10 +1,11 @@ { - "geode": "3.0.0-beta.5", + "geode": "3.4.0", "version": "v1.7.0", "gd": { "win": "*", "android": "*", - "mac": "2.206" + "mac": "2.206", + "ios": "2.206" }, "id": "geode.devtools", "name": "DevTools", diff --git a/src/backend.cpp b/src/backend.cpp index b73a08b..b0e1168 100644 --- a/src/backend.cpp +++ b/src/backend.cpp @@ -226,6 +226,8 @@ void DevTools::renderDrawData(ImDrawData* draw_data) { static float SCROLL_SENSITIVITY = 10; +#ifndef GEODE_IS_IOS + class $modify(CCMouseDispatcher) { bool dispatchScrollMSG(float y, float x) { if(!DevTools::get()->isSetup()) return true; @@ -241,6 +243,8 @@ class $modify(CCMouseDispatcher) { } }; +#endif + class $modify(CCTouchDispatcher) { void touches(CCSet* touches, CCEvent* event, unsigned int type) { auto& io = ImGui::GetIO(); @@ -300,6 +304,8 @@ class $modify(CCTouchDispatcher) { } }; +#ifndef GEODE_IS_IOS + class $modify(CCIMEDispatcher) { void dispatchInsertText(const char* text, int len, enumKeyCodes key) { auto& io = ImGui::GetIO(); @@ -320,3 +326,5 @@ class $modify(CCIMEDispatcher) { io.AddKeyEvent(ImGuiKey_Backspace, false); } }; + +#endif diff --git a/src/main.cpp b/src/main.cpp index 803de94..4dd7d41 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -3,7 +3,9 @@ #include #include #include +#ifndef GEODE_IS_IOS #include +#endif #include #include "DevTools.hpp" #include @@ -19,6 +21,8 @@ class $modify(CCNode) { } }; +#ifndef GEODE_IS_IOS + // todo: use shortcuts api once Geode has those class $modify(CCKeyboardDispatcher) { bool dispatchKeyboardMSG(enumKeyCodes key, bool down, bool arr) { @@ -30,6 +34,8 @@ class $modify(CCKeyboardDispatcher) { } }; +#endif + #ifdef GEODE_IS_MOBILE // lol #include @@ -76,7 +82,12 @@ class $modify(CCDirector) { shouldUpdateGDRenderBuffer() = false; } + #ifdef GEODE_IS_IOS + auto winSize = this->getOpenGLView()->m_obViewPortRect * geode::utils::getDisplayFactor(); + #else auto winSize = this->getOpenGLView()->getViewPortRect() * geode::utils::getDisplayFactor(); + #endif + if (!gdTexture) { gdTexture = new GLRenderCtx({ winSize.size.width, winSize.size.height }); } @@ -102,6 +113,8 @@ class $modify(CCDirector) { } }; +#ifndef GEODE_IS_IOS + class $modify(CCEGLView) { // this is needed for popout mode because we need to render after gd has rendered, // but before the buffers have been swapped, which is not possible with just a @@ -114,3 +127,5 @@ class $modify(CCEGLView) { CCEGLView::swapBuffers(); } }; + +#endif diff --git a/src/platform/Mac.mm b/src/platform/Mac.mm index da6df32..fcf7cab 100644 --- a/src/platform/Mac.mm +++ b/src/platform/Mac.mm @@ -1,6 +1,6 @@ #include -#ifdef GEODE_IS_MACOS +#ifdef __APPLE__ #include "utils.hpp" @@ -86,4 +86,4 @@ else return fmt::format("{:#x}", addr - base); } -#endif \ No newline at end of file +#endif diff --git a/src/platform/platform.cpp b/src/platform/platform.cpp index 6a7f9d3..29e094e 100644 --- a/src/platform/platform.cpp +++ b/src/platform/platform.cpp @@ -76,8 +76,10 @@ bool GLRenderCtx::begin() { 0,GL_RGB, GL_UNSIGNED_BYTE, 0 ); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); } if (!m_depthStencil) { diff --git a/src/platform/platform.hpp b/src/platform/platform.hpp index 2066da9..3d33eb2 100644 --- a/src/platform/platform.hpp +++ b/src/platform/platform.hpp @@ -3,9 +3,16 @@ #include #include #ifdef __APPLE__ + +#include +#if TARGET_OS_IPHONE +#include +#else #include #endif +#endif + ImRect& getGDWindowRect(); bool& shouldPassEventsToGDButTransformed(); bool& shouldUpdateGDRenderBuffer();