ios port changes

This commit is contained in:
Ronja Enseleit 2023-07-01 17:26:52 +02:00
parent a3a5a5807f
commit 5c86b9bc20
7 changed files with 41 additions and 12 deletions

View File

@ -1,6 +1,8 @@
#include "AssetManager.h" #include "AssetManager.h"
#include "Log.h" #include "Log.h"
#include "Profiling.h" #include "Profiling.h"
#include "StringRepository.h"
#define STBI_NO_STDIO #define STBI_NO_STDIO
#define STB_IMAGE_IMPLEMENTATION #define STB_IMAGE_IMPLEMENTATION
#include "stb_image.h" #include "stb_image.h"
@ -135,7 +137,7 @@ bool AssetManager::loadFontBitmap(const char* path, float char_height, Texture*
stbtt_PackFontRange(&context, reinterpret_cast<const unsigned char*>(ttf_data.data), stbtt_PackFontRange(&context, reinterpret_cast<const unsigned char*>(ttf_data.data),
0, STBTT_POINT_SIZE(char_height), 8364, 1, char_data + 225); 0, STBTT_POINT_SIZE(char_height), 8364, 1, char_data + 225);
stbtt_PackEnd(&context); 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); releaseFileBuffer(ttf_data);
free(bitmap_memory); free(bitmap_memory);

View File

@ -5,8 +5,8 @@
/// @brief Access to asset files /// @brief Access to asset files
#include "Texture.h" #include "Texture.h"
#include "Renderer.h"
#include "Font.h" #include "Font.h"
#include "StringRepository.h"
#include <map> #include <map>

View File

@ -3,12 +3,7 @@
#include "stb_truetype.h" #include "stb_truetype.h"
#ifdef _WIN32 #include <stddef.h>
#include "glad.h"
#else
#include <GLES3/gl3.h>
#endif
/// Data that defines a font /// Data that defines a font
struct FontData struct FontData

View File

@ -2,6 +2,7 @@
#include "Profiling.h" #include "Profiling.h"
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h>
static StringRepository g_global_repository; static StringRepository g_global_repository;
StringRepository* StringRepository::global = &g_global_repository; StringRepository* StringRepository::global = &g_global_repository;

View File

@ -1,6 +1,9 @@
#include "Texture.h" #include "Texture.h"
#include "Profiling.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) Texture::Texture(unsigned int width, unsigned int height, const void* data) : m_texture(0)
{ {
ZoneScoped; ZoneScoped;
@ -76,3 +79,29 @@ void Texture::getTextureSize(unsigned int* w, unsigned int* h)
*h = height_px; *h = height_px;
} }
} }
#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

View File

@ -6,7 +6,7 @@
#ifdef _WIN32 #ifdef _WIN32
#include "glad.h" #include "glad.h"
#else #elif defined(__ANDROID__)
#include <GLES3/gl3.h> #include <GLES3/gl3.h>
#endif #endif
@ -16,9 +16,9 @@ class Renderer;
class Texture class Texture
{ {
public: 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);
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(const Texture&) = default;
Texture(Texture&&) = default; Texture(Texture&&) = default;
@ -38,7 +38,9 @@ public:
unsigned int* h); unsigned int* h);
private: private:
#if defined(_WIN32) || defined(__ANDROID__)
GLuint m_texture; GLuint m_texture;
#endif
int width_px; int width_px;
int height_px; int height_px;