From abcee04f928613b554f46dbb6ee825dd1398f957 Mon Sep 17 00:00:00 2001 From: Arnaud Valensi Date: Tue, 14 Sep 2021 00:39:19 +0200 Subject: [PATCH] Set currentFbo to render size in EndTextureMode --- src/core.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/core.c b/src/core.c index 82923aa0bb46..59fb940e56fd 100644 --- a/src/core.c +++ b/src/core.c @@ -2147,8 +2147,8 @@ void EndTextureMode(void) SetupViewport(CORE.Window.render.width, CORE.Window.render.height); // Reset current fbo to screen size - CORE.Window.currentFbo.width = CORE.Window.screen.width; - CORE.Window.currentFbo.height = CORE.Window.screen.height; + CORE.Window.currentFbo.width = CORE.Window.render.width; + CORE.Window.currentFbo.height = CORE.Window.render.height; } // Begin custom shader mode @@ -2297,7 +2297,7 @@ Shader LoadShader(const char *vsFileName, const char *fsFileName) char *vShaderStr = NULL; char *fShaderStr = NULL; - + if (vsFileName != NULL) vShaderStr = LoadFileText(vsFileName); if (fsFileName != NULL) fShaderStr = LoadFileText(fsFileName); @@ -5304,10 +5304,10 @@ static int32_t AndroidInputCallback(struct android_app *app, AInputEvent *event) return 0; } - + // Register touch points count CORE.Input.Touch.pointCount = AMotionEvent_getPointerCount(event); - + for (int i = 0; (i < CORE.Input.Touch.pointCount) && (i < MAX_TOUCH_POINTS); i++) { // Register touch points id @@ -5315,7 +5315,7 @@ static int32_t AndroidInputCallback(struct android_app *app, AInputEvent *event) // Register touch points position CORE.Input.Touch.position[i] = (Vector2){ AMotionEvent_getX(event, i), AMotionEvent_getY(event, i) }; - + // Normalize gestureEvent.position[x] for screenWidth and screenHeight gestureEvent.position[i].x /= (float)GetScreenWidth(); gestureEvent.position[i].y /= (float)GetScreenHeight(); @@ -5329,7 +5329,7 @@ static int32_t AndroidInputCallback(struct android_app *app, AInputEvent *event) #if defined(SUPPORT_GESTURES_SYSTEM) // PLATFORM_ANDROID GestureEvent gestureEvent = { 0 }; - + gestureEvent.pointCount = CORE.Input.Touch.pointCount; // Register touch actions @@ -5364,14 +5364,14 @@ static EM_BOOL EmscriptenTouchCallback(int eventType, const EmscriptenTouchEvent { // Register touch points count CORE.Input.Touch.pointCount = touchEvent->numTouches; - + double canvasWidth = 0.0; double canvasHeight = 0.0; // NOTE: emscripten_get_canvas_element_size() returns canvas.width and canvas.height but // we are looking for actual CSS size: canvas.style.width and canvas.style.height //EMSCRIPTEN_RESULT res = emscripten_get_canvas_element_size("#canvas", &canvasWidth, &canvasHeight); emscripten_get_element_css_size("#canvas", &canvasWidth, &canvasHeight); - + for (int i = 0; (i < CORE.Input.Touch.pointCount) && (i < MAX_TOUCH_POINTS); i++) { // Register touch points id @@ -5383,14 +5383,14 @@ static EM_BOOL EmscriptenTouchCallback(int eventType, const EmscriptenTouchEvent // Normalize gestureEvent.position[x] for CORE.Window.screen.width and CORE.Window.screen.height CORE.Input.Touch.position[i].x *= ((float)GetScreenWidth()/(float)canvasWidth); CORE.Input.Touch.position[i].y *= ((float)GetScreenHeight()/(float)canvasHeight); - + if (eventType == EMSCRIPTEN_EVENT_TOUCHSTART) CORE.Input.Touch.currentTouchState[i] = 1; else if (eventType == EMSCRIPTEN_EVENT_TOUCHEND) CORE.Input.Touch.currentTouchState[i] = 0; } #if defined(SUPPORT_GESTURES_SYSTEM) // PLATFORM_WEB GestureEvent gestureEvent = { 0 }; - + gestureEvent.pointCount = CORE.Input.Touch.pointCount; // Register touch actions