RobLoach / node-raylib

Node.js bindings for Raylib
https://robloach.github.io/node-raylib/
Other
237 stars 20 forks source link

DrawTextRec bug #85

Closed gtrxAC closed 3 years ago

gtrxAC commented 3 years ago

Using DrawTextRec causes the screen to glitch out, sometimes no text is drawn at all. The equivalent C program works fine. https://user-images.githubusercontent.com/59177874/112764993-b1ff2980-9013-11eb-8f39-86f4a59b4ae3.mp4

Using a custom font looks like this: screenshot000

RobLoach commented 3 years ago

Could you provide your example?

RobLoach commented 3 years ago

Like, in text rather than a vidoe?\

gtrxAC commented 3 years ago

JS:

const rl = require('raylib');
const rec = rl.Rectangle(100, 100, 500, 500);

rl.InitWindow(1024, 768, "test");

while (!rl.WindowShouldClose()) {
    rl.BeginDrawing();
    rl.ClearBackground(rl.BLACK);
    rl.DrawRectangleLinesEx(rec, 1, rl.RED);
    rl.DrawTextRec(rl.GetFontDefault(), "hello world", rec, 10, 1, true, rl.WHITE);
    rl.EndDrawing();
}

C equivalent:

#include "raylib.h"

Rectangle rec = {100, 100, 500, 500}

int main(void)
{
    InitWindow(1024, 768, "test");

    while (!WindowShouldClose()),
    {
        BeginDrawing();
        ClearBackground(BLACK);
        DrawRectangleLinesEx(rec, 1, RED);
        DrawTextRec(GetFontDefault(), "hello world", rec, 10, 1, true, WHITE);
        EndDrawing();
    }
}
gtrxAC commented 3 years ago

This issue is not specific to DrawTextRec, it also occurs with DrawTextCodepoint and probably other text functions that allow custom fonts.

RobLoach commented 3 years ago

Thanks! Found the issue on Fonts.