Open
Description
When calling GetScreenHeight()
inside BeginTextureMode()
AND window is scaled, it returns 0.
Expected result after resizing: MAROON rectangle drawn at the bottom of the RenderTexture.
Result: MAROON rectangle not draw on screen (maybe drawn outside of screen)
Testing code:
#include "raylib.h"
int main(void)
{
const int windowWidth = 800;
const int windowHeight = 450;
SetConfigFlags(FLAG_WINDOW_RESIZABLE);
InitWindow(windowWidth, windowHeight, "raylib [core] example - window scale letterbox");
RenderTexture2D target = LoadRenderTexture(600, 400);
SetTargetFPS(60);
while (!WindowShouldClose())
{
BeginTextureMode(target);
ClearBackground(LIGHTGRAY);
DrawRectangle(0, GetScreenHeight() - 80, 200, 80, MAROON); // ISSUE: NOT DRAWN on resizing!
EndTextureMode();
BeginDrawing();
ClearBackground(RAYWHITE);
DrawTextureRec(target.texture, (Rectangle){ 0, 0, (float)target.texture.width,
-(float)target.texture.height }, (Vector2){ 0, 0 }, WHITE);
EndDrawing();
}
UnloadRenderTexture(target);
CloseWindow();
return 0;
}