Skip to content

Is GuiCheckBox drawn at the correct x coordinate with TEXT_ALIGN_LEFT #513

@jwwilk

Description

@jwwilk

The x coordinate of a GuiCheckBox specifies the location of the check button and doesn't take into account a control's text. In the screen shot below the red line shows the controls' x coordinate:

Image

Is this intended? I find it inconvenient as you have to work out the width of the text to line up left aligned checkboxes with other controls.

This is the code I use for the screenshot:

    bool dummy;

    int x = 150;

    DrawLine( x, 0, x, 500, RED );

    GuiSetStyle( CHECKBOX, TEXT_ALIGNMENT, TEXT_ALIGN_RIGHT );
    const Rectangle toggle_rect_1{ x, 295, 24.0f, 24.0f };
    GuiCheckBox( toggle_rect_1, "right align", &dummy );

    GuiSetStyle( CHECKBOX, TEXT_ALIGNMENT, TEXT_ALIGN_LEFT );
    const Rectangle toggle_rect_2{ x, 350, 24.0f, 24.0f };
    GuiCheckBox( toggle_rect_2, "left align", &dummy );

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions