Formatting tweaks

This commit is contained in:
raysan5 2019-08-27 14:03:56 +02:00
parent 5b2cef84a1
commit 3a50c1b711

View File

@ -811,8 +811,8 @@ RAYGUIDEF int GuiTextBoxGetCursor(void) { return guiTextBoxState.cursor; }
// Set selection of active textbox // Set selection of active textbox
RAYGUIDEF void GuiTextBoxSetSelection(int start, int length) RAYGUIDEF void GuiTextBoxSetSelection(int start, int length)
{ {
if(start < 0) start = 0; if (start < 0) start = 0;
if(length < 0) length = 0; if (length < 0) length = 0;
GuiTextBoxSetCursor(start + length); GuiTextBoxSetCursor(start + length);
guiTextBoxState.select = start; guiTextBoxState.select = start;
} }
@ -820,10 +820,8 @@ RAYGUIDEF void GuiTextBoxSetSelection(int start, int length)
// Get selection of active textbox // Get selection of active textbox
RAYGUIDEF Vector2 GuiTextBoxGetSelection(void) RAYGUIDEF Vector2 GuiTextBoxGetSelection(void)
{ {
if(guiTextBoxState.select == -1 || guiTextBoxState.select == guiTextBoxState.cursor) if (guiTextBoxState.select == -1 || guiTextBoxState.select == guiTextBoxState.cursor) return RAYGUI_CLITERAL(Vector2){ 0 };
return RAYGUI_CLITERAL(Vector2){ 0 }; else if (guiTextBoxState.cursor > guiTextBoxState.select) return RAYGUI_CLITERAL(Vector2){ guiTextBoxState.select, guiTextBoxState.cursor - guiTextBoxState.select };
else if(guiTextBoxState.cursor > guiTextBoxState.select)
return RAYGUI_CLITERAL(Vector2){ guiTextBoxState.select, guiTextBoxState.cursor - guiTextBoxState.select };
return RAYGUI_CLITERAL(Vector2){ guiTextBoxState.cursor, guiTextBoxState.select - guiTextBoxState.cursor }; return RAYGUI_CLITERAL(Vector2){ guiTextBoxState.cursor, guiTextBoxState.select - guiTextBoxState.cursor };
} }