From 40e01ba1db1df181e1eb54d09819cd3acb047532 Mon Sep 17 00:00:00 2001 From: omigamedev Date: Sun, 11 Aug 2019 21:30:05 +0200 Subject: [PATCH] fix android main loop, scale font texture --- android/src/cpp/main.cpp | 2 +- src/font.cpp | 1 + src/font.h | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/android/src/cpp/main.cpp b/android/src/cpp/main.cpp index ec4341c..8233bf8 100644 --- a/android/src/cpp/main.cpp +++ b/android/src/cpp/main.cpp @@ -1110,7 +1110,7 @@ void android_main(struct android_app* state) { // If animating, we loop until all events are read, then continue // to draw the next frame of animation. bool used = false; - int timeout = g_engine.display != EGL_NO_DISPLAY ? 0 : -1; + int timeout = -1;//g_engine.display != EGL_NO_DISPLAY ? 0 : -1; while (!used && (ident=ALooper_pollOnce(timeout, NULL, &events, (void**)&source)) != ALOOPER_POLL_ERROR) { diff --git a/src/font.cpp b/src/font.cpp index 8e207cd..e5d4a59 100644 --- a/src/font.cpp +++ b/src/font.cpp @@ -15,6 +15,7 @@ bool Font::load(const std::string& ttf, int font_size, float font_scale) LOG("Font::load %s", ttf.c_str()); if (file.open(ttf.c_str()) && file.read_all()) { + w = h = 512 * ceilf(font_scale); path = ttf; scale = font_scale; LOG("Font::load loaded"); diff --git a/src/font.h b/src/font.h index 47dc0ba..9b9f7ad 100644 --- a/src/font.h +++ b/src/font.h @@ -12,8 +12,8 @@ enum class kFont : uint16_t class Font { public: - const int w = 512; - const int h = 512; + int w = 512; + int h = 512; const int num_chars = 96; const int start_char = 32; // {mix, max}