c++game-developmentraylib

Making lines thicker when using DrawRectangleLines() in raylib


I came across a problem that I cannot change line thickness when using DrawRectangleLines(), and it would be stupid to create a texture with just thicker lines, I tried to search through internet and docs and I couldn't find anything Or I am just blind


Solution

  • Use this function - note the Ex suffix:

    void DrawRectangleLinesEx(Rectangle rec, float lineThick, Color color);


    Not every shape has a "LinesEx" counterpart. Sometimes you can call void rlSetLineWidth(float width); before drawing them, but that width isn't always used.

    Circles for example, are drawn pixel by pixel and will always have a thickness of 1. You're in luck with Rectangles though.