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 "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<const unsigned char*>(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);

View File

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

View File

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

View File

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

View File

@ -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;
}
}
}
#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
#include "glad.h"
#else
#elif defined(__ANDROID__)
#include <GLES3/gl3.h>
#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;