From 3d755d617ab6f2a86c272ffb8ecddc2621269c19 Mon Sep 17 00:00:00 2001 From: Ray San Date: Thu, 2 Nov 2017 20:08:52 +0100 Subject: [PATCH] Some code tweaks... --- examples/text/text_ttf_loading.c | 2 +- src/core.c | 16 +++++++++++++--- src/text.c | 3 +-- src/textures.c | 2 ++ 4 files changed, 17 insertions(+), 6 deletions(-) diff --git a/examples/text/text_ttf_loading.c b/examples/text/text_ttf_loading.c index c9c2fb274..fedfbfb8e 100644 --- a/examples/text/text_ttf_loading.c +++ b/examples/text/text_ttf_loading.c @@ -32,7 +32,7 @@ int main() GenTextureMipmaps(&font.texture); float fontSize = font.baseSize; - Vector2 fontPosition = { 40, screenHeight/2 + 50 }; + Vector2 fontPosition = { 40, screenHeight/2 - 50 }; Vector2 textSize; SetTextureFilter(font.texture, FILTER_POINT); diff --git a/src/core.c b/src/core.c index 9f7f95d24..436a40844 100644 --- a/src/core.c +++ b/src/core.c @@ -81,7 +81,7 @@ #define SUPPORT_DEFAULT_FONT #define SUPPORT_MOUSE_GESTURES #define SUPPORT_CAMERA_SYSTEM -#define SUPPORT_GESTURES_SYSTEM +//#define SUPPORT_GESTURES_SYSTEM #define SUPPORT_BUSY_WAIT_LOOP #define SUPPORT_GIF_RECORDING //------------------------------------------------- @@ -2526,6 +2526,8 @@ static void WindowSizeCallback(GLFWwindow *window, int width, int height) rlClearScreenBuffers(); // Clear screen buffers (color and depth) // Window size must be updated to be used on 3D mode to get new aspect ratio (Begin3dMode()) + // NOTE: Be careful! GLFW3 will choose the closest fullscreen resolution supported by current monitor, + // for example, if reescaling back to 800x450 (desired), it could set 720x480 (closest fullscreen supported) screenWidth = width; screenHeight = height; renderWidth = width; @@ -2777,8 +2779,16 @@ static int32_t AndroidInputCallback(struct android_app *app, AInputEvent *event) ProcessGestureEvent(gestureEvent); #else - // TODO: Support only simple touch position - + // Support only simple touch position + if (flags == AMOTION_EVENT_ACTION_DOWN) + { + // Get first touch position + touchPosition[0].x = AMotionEvent_getX(event, 0); + touchPosition[0].y = AMotionEvent_getY(event, 0); + + touchPosition[0].x /= (float)GetScreenWidth(); + touchPosition[0].y /= (float)GetScreenHeight(); + } #endif return 0; diff --git a/src/text.c b/src/text.c index ff55ae6f2..8db2fc9f4 100644 --- a/src/text.c +++ b/src/text.c @@ -883,11 +883,10 @@ static SpriteFont LoadTTF(const char *fileName, int fontSize, int charsCount, in scale = stbtt_ScaleForPixelHeight(&fontInfo, fontSize); stbtt_GetFontVMetrics(&fontInfo, &ascent, 0, 0); baseline = (int)(ascent*scale); - if (fontChars[0] != 32) TraceLog(LOG_WARNING, "TTF spritefont loading: first character is not SPACE(32) character"); - // NOTE: Using stb_truetype crappy packing method, no guarante the font fits the image... + // NOTE: Using stb_truetype crappy packing method, no guarantee the font fits the image... // TODO: Replace this function by a proper packing method and support random chars order, // we already receive a list (fontChars) with the ordered expected characters int result = stbtt_BakeFontBitmap(ttfBuffer, 0, fontSize, dataBitmap, textureSize, textureSize, fontChars[0], charsCount, charData); diff --git a/src/textures.c b/src/textures.c index 5e71d0295..50d22c936 100644 --- a/src/textures.c +++ b/src/textures.c @@ -58,6 +58,8 @@ #define SUPPORT_FILEFORMAT_PNG #define SUPPORT_FILEFORMAT_DDS #define SUPPORT_FILEFORMAT_HDR +#define SUPPORT_FILEFORMAT_KTX +#define SUPPORT_FILEFORMAT_ASTC #define SUPPORT_IMAGE_MANIPULATION #define SUPPORT_IMAGE_GENERATION //-------------------------------------------------