Skip to content

Text alignment #535

@zeroredith

Description

@zeroredith

When using TEXT_ALIGN_CENTER and TEXT_WRAP_WORD I would expect that if the text is wrapped the alignment is still applied to it but this is what happens instead running this code:
`#include "raylib.h"
#define RAYGUI_IMPLEMENTATION
#include "raygui.h"

int screen_width = 800;
int screen_height = 600;

int main(void) {
char* text1 = "testing_text testing_text";
char* text2 = "testing_text";
Rectangle pos1 = {100, 100, 200, 100};
Rectangle pos2 = {300, 100, 200, 100};
InitWindow(screen_width, screen_height, "bugtest");
SetTargetFPS(60);
while(!WindowShouldClose()) {
BeginDrawing();
ClearBackground(WHITE);
GuiDrawRectangle(pos1, 2, GREEN, BLANK);
GuiSetStyle(DEFAULT, TEXT_SIZE, 24);
GuiSetStyle(DEFAULT, TEXT_WRAP_MODE, TEXT_WRAP_WORD);
GuiDrawText(text1, pos1, TEXT_ALIGN_CENTER, RED);

	GuiDrawRectangle(pos2, 2, GREEN, BLANK);
	GuiSetStyle(DEFAULT, TEXT_SIZE, 24);
	GuiSetStyle(DEFAULT, TEXT_WRAP_MODE, TEXT_WRAP_WORD);
	GuiDrawText(text2, pos2, TEXT_ALIGN_CENTER, RED);

	EndDrawing();
}
CloseWindow();

}`

But I get this, the first one is wrapped and the alignment becomes left
Image

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