From 5c86b9bc209f99670e4f35d02cdc3c2b10d81a86 Mon Sep 17 00:00:00 2001 From: Ronja Enseleit Date: Sat, 1 Jul 2023 17:26:52 +0200 Subject: [PATCH] ios port changes --- .../UserInterfaceState.xcuserstate | Bin 44527 -> 44411 bytes app/src/main/cpp/AssetManager.cpp | 4 ++- app/src/main/cpp/AssetManager.h | 2 +- app/src/main/cpp/Font.h | 7 +--- app/src/main/cpp/StringRepository.cpp | 1 + app/src/main/cpp/Texture.cpp | 31 +++++++++++++++++- app/src/main/cpp/Texture.h | 8 +++-- 7 files changed, 41 insertions(+), 12 deletions(-) diff --git a/app/src/main/KDE.xcodeproj/project.xcworkspace/xcuserdata/ronjaenseleit.xcuserdatad/UserInterfaceState.xcuserstate b/app/src/main/KDE.xcodeproj/project.xcworkspace/xcuserdata/ronjaenseleit.xcuserdatad/UserInterfaceState.xcuserstate index 7352f0a751affeaa5f52f47ed1ced42fd6dc4be8..ca017255e1f3f4cf8258363a4e273f882c15e8ec 100644 GIT binary patch delta 518 zcmaEVo9Xv0rVTr6`54m}^g*~GyP>Edd-5?`FJVS`)(s88jf`s-F)FccZU}8;TsK+S zPLB=BJZL7dIp1!d9!tB*%-+q0xo$G(hO~Bi@iEHtoCX@gd~6ZN1lG-y1-is1ACP6A z{JT?xar0(@u0_mDEMF#X=}lu)+$`N^!Kls9z|g=d*udYw*uWvc(7@IpB*-MRUO-q! zS5M!-(8$=t*4f3?J196LJZf@d{~9JMo5{W$Qi2OD8#otQH}EzHUbeG0cW`u?d}V?m zD^~+|1J7ixiKaGg?jD{|D#SqUvO}8QEF$cH&e1<0dAs@;3-H@J&8E(Nx>bJv0ocEj%+XCBGc1E!69hn|nlL zj9;)zW^zepeqLfx<)R3$$;y*5>Q6CVVEoP`!6e7z%oM>C$yCTx!PLOi%`}N=3ez;E z8BDX7<}fX0+Q)R6=_=E8rkl(R%)HD(%(BdC%%;p1%#O@n%sI@x%qy8!Gp}V{&wPsc zG4l)N@65lL|FiJ0@H2n`6C;FXh=$ToibbxGX|vqqByM&wJ4rh^JB7{d^Yr-`uWsJH SMvReZ(u&FF*UB+XS`7f3ZlTEl delta 632 zcmX|+OH30{7=?TPd#fOiPH6!V0)i$QAH|CG0d}zRkSY$yKwAn@%JdSdFk?D3gc#xC z4h&Mf8&@PW#t;Ky7#6NH#Kah*8!;|)UpPz_*X^_=%U- zHSFSVy`saqhN`B~DwEUJbyPEr98cxtB6 zng7bf@QVzVlQOYsxW_k-@8mycoM_z;X44p~BYb0S7}Xf%cTOT#4zn<;o!J;-d4h#) zW5sqTS`$hR9d^|oaUZQa)^Pgl`OZsSJ^hylqA@->zcO{IKCo9Ajp}-6Jg&yHaes3} za9*PcJ+3FIn)Js^i4VtVg6$A6%MC;%x!!%kT-A6coCVeB7!743)gwZsBzOMDd;Be` zqQz*eiw@HSRTY|U^o1n3W9SN1l3Pv9`#mk^{6R@}U8NIx*mN!P(U)3T{!$wgm~-nw zyXT_R!GkHcwSW~e8=p&gs=T7yJs`=llAu&=k4|XUlWE!aE)evDdiRC<`0v!9wTL;G zohu8TgI+N*Xtslyg@4--pE+Vk>6hf@xRQ)(YBVvC9`f<$3nNo+&=&du@De`57x)gpFu^u##|~VKOK}+$?!w(TfN$biJdYRg z5`KtZ@Cx3yS_!=B51(?!i2wiq diff --git a/app/src/main/cpp/AssetManager.cpp b/app/src/main/cpp/AssetManager.cpp index 0f4af65..c579009 100644 --- a/app/src/main/cpp/AssetManager.cpp +++ b/app/src/main/cpp/AssetManager.cpp @@ -1,6 +1,8 @@ #include "AssetManager.h" #include "Log.h" #include "Profiling.h" +#include "StringRepository.h" + #define STBI_NO_STDIO #define STB_IMAGE_IMPLEMENTATION #include "stb_image.h" @@ -135,7 +137,7 @@ bool AssetManager::loadFontBitmap(const char* path, float char_height, Texture* stbtt_PackFontRange(&context, reinterpret_cast(ttf_data.data), 0, STBTT_POINT_SIZE(char_height), 8364, 1, char_data + 225); stbtt_PackEnd(&context); - *p_texture = Texture(font_data.bitmap_size, font_data.bitmap_size, bitmap_memory, GL_R8); + *p_texture = Texture(font_data.bitmap_size, font_data.bitmap_size, bitmap_memory, 0); releaseFileBuffer(ttf_data); free(bitmap_memory); diff --git a/app/src/main/cpp/AssetManager.h b/app/src/main/cpp/AssetManager.h index a7ccd3f..731ff0d 100644 --- a/app/src/main/cpp/AssetManager.h +++ b/app/src/main/cpp/AssetManager.h @@ -5,8 +5,8 @@ /// @brief Access to asset files #include "Texture.h" -#include "Renderer.h" #include "Font.h" +#include "StringRepository.h" #include diff --git a/app/src/main/cpp/Font.h b/app/src/main/cpp/Font.h index 0b51595..64a922e 100644 --- a/app/src/main/cpp/Font.h +++ b/app/src/main/cpp/Font.h @@ -3,12 +3,7 @@ #include "stb_truetype.h" -#ifdef _WIN32 - #include "glad.h" -#else - #include -#endif - +#include /// Data that defines a font struct FontData diff --git a/app/src/main/cpp/StringRepository.cpp b/app/src/main/cpp/StringRepository.cpp index 7fc89c1..ec9a6dc 100644 --- a/app/src/main/cpp/StringRepository.cpp +++ b/app/src/main/cpp/StringRepository.cpp @@ -2,6 +2,7 @@ #include "Profiling.h" #include #include +#include static StringRepository g_global_repository; StringRepository* StringRepository::global = &g_global_repository; diff --git a/app/src/main/cpp/Texture.cpp b/app/src/main/cpp/Texture.cpp index 0e15273..970e5c1 100644 --- a/app/src/main/cpp/Texture.cpp +++ b/app/src/main/cpp/Texture.cpp @@ -1,6 +1,9 @@ #include "Texture.h" #include "Profiling.h" +#if defined(__ANDROID__) || defined(_WIN32) +Texture::Texture() : m_texture(0) {} + Texture::Texture(unsigned int width, unsigned int height, const void* data) : m_texture(0) { ZoneScoped; @@ -75,4 +78,30 @@ void Texture::getTextureSize(unsigned int* w, unsigned int* h) if (h != nullptr) { *h = height_px; } -} \ No newline at end of file +} + +#else + +Texture::Texture() {} + +Texture::Texture(unsigned int width, unsigned int height, const void* data) +{ +} + +Texture::Texture(unsigned int width, unsigned int height, const void* data, int dummy) +{ +} + +void Texture::destroy() +{ +} + +void Texture::bind() const +{ +} + +void Texture::getTextureSize(unsigned int* w, unsigned int* h) +{ +} + +#endif diff --git a/app/src/main/cpp/Texture.h b/app/src/main/cpp/Texture.h index 2e02886..5b74cf8 100644 --- a/app/src/main/cpp/Texture.h +++ b/app/src/main/cpp/Texture.h @@ -6,7 +6,7 @@ #ifdef _WIN32 #include "glad.h" -#else +#elif defined(__ANDROID__) #include #endif @@ -16,9 +16,9 @@ class Renderer; class Texture { public: - Texture() : m_texture(0) {} + Texture(); Texture(unsigned int width, unsigned int height, const void* data); - Texture(unsigned int width, unsigned int height, const void* data, GLint format); + Texture(unsigned int width, unsigned int height, const void* data, int format); Texture(const Texture&) = default; Texture(Texture&&) = default; @@ -38,7 +38,9 @@ public: unsigned int* h); private: +#if defined(_WIN32) || defined(__ANDROID__) GLuint m_texture; +#endif int width_px; int height_px;