mirror of
https://github.com/raysan5/raygui.git
synced 2026-01-30 02:39:17 -05:00
Review blinking cursor on GuiTextBoxMulti()
This commit is contained in:
29
src/raygui.h
29
src/raygui.h
@ -72,7 +72,9 @@
|
|||||||
* text selection support and text copy/cut/paste support
|
* text selection support and text copy/cut/paste support
|
||||||
*
|
*
|
||||||
* VERSIONS HISTORY:
|
* VERSIONS HISTORY:
|
||||||
* 2.6 (16-Aug-2019) Redesigned GuiListView*(), GuiDropdownBox(), GuiSlider*(), GuiProgressBar()
|
* 2.6 (25-Aug-2019) Redesigned GuiListView*(), GuiDropdownBox(), GuiSlider*(), GuiProgressBar(), GuiMessageBox(), GuiTextInputBox()
|
||||||
|
* Reviewed GuiTextBox*(), GuiSpinner(), GuiValueBox(), GuiLoadStyle()
|
||||||
|
* Added 8 new custom styles ready to use
|
||||||
* 2.5 (28-May-2019) Implemented extended GuiTextBox(), GuiValueBox(), GuiSpinner()
|
* 2.5 (28-May-2019) Implemented extended GuiTextBox(), GuiValueBox(), GuiSpinner()
|
||||||
* 2.3 (29-Apr-2019) Added rIcons auxiliar library and support for it, multiple controls reviewed
|
* 2.3 (29-Apr-2019) Added rIcons auxiliar library and support for it, multiple controls reviewed
|
||||||
* Refactor all controls drawing mechanism to use control state
|
* Refactor all controls drawing mechanism to use control state
|
||||||
@ -2979,19 +2981,20 @@ RAYGUIDEF bool GuiTextBoxMulti(Rectangle bounds, char *text, int textSize, bool
|
|||||||
{
|
{
|
||||||
DrawRectangle(bounds.x + GuiGetStyle(TEXTBOX, BORDER_WIDTH), bounds.y + GuiGetStyle(TEXTBOX, BORDER_WIDTH), bounds.width - 2*GuiGetStyle(TEXTBOX, BORDER_WIDTH), bounds.height - 2*GuiGetStyle(TEXTBOX, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(TEXTBOX, BASE_COLOR_PRESSED)), guiAlpha));
|
DrawRectangle(bounds.x + GuiGetStyle(TEXTBOX, BORDER_WIDTH), bounds.y + GuiGetStyle(TEXTBOX, BORDER_WIDTH), bounds.width - 2*GuiGetStyle(TEXTBOX, BORDER_WIDTH), bounds.height - 2*GuiGetStyle(TEXTBOX, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(TEXTBOX, BASE_COLOR_PRESSED)), guiAlpha));
|
||||||
|
|
||||||
if (editMode)
|
// Draw blinking cursor
|
||||||
|
if (editMode && ((framesCounter/20)%2 == 0))
|
||||||
{
|
{
|
||||||
if ((framesCounter/20)%2 == 0)
|
char *line = NULL;
|
||||||
{
|
if (currentLine > 0) line = strrchr(text, '\n');
|
||||||
char *line = NULL;
|
else line = text;
|
||||||
if (currentLine > 0) line = strrchr(text, '\n');
|
|
||||||
else line = text;
|
Rectangle cursor = {
|
||||||
|
bounds.x + GuiGetStyle(TEXTBOX, BORDER_WIDTH) + GuiGetStyle(TEXTBOX, INNER_PADDING) + GetTextWidth(line),
|
||||||
// Draw text cursor
|
bounds.y + GuiGetStyle(TEXTBOX, BORDER_WIDTH) + GuiGetStyle(TEXTBOX, INNER_PADDING)/2 + ((GuiGetStyle(DEFAULT, TEXT_SIZE) + GuiGetStyle(TEXTBOX, INNER_PADDING))*currentLine),
|
||||||
DrawRectangle(bounds.x + GuiGetStyle(TEXTBOX, BORDER_WIDTH) + GuiGetStyle(TEXTBOX, INNER_PADDING) + GetTextWidth(line),
|
1, GuiGetStyle(DEFAULT, TEXT_SIZE) + GuiGetStyle(TEXTBOX, INNER_PADDING)
|
||||||
bounds.y + GuiGetStyle(TEXTBOX, BORDER_WIDTH) + GuiGetStyle(TEXTBOX, INNER_PADDING)/2 + ((GuiGetStyle(DEFAULT, TEXT_SIZE) + GuiGetStyle(TEXTBOX, INNER_PADDING))*currentLine),
|
};
|
||||||
1, GuiGetStyle(DEFAULT, TEXT_SIZE) + GuiGetStyle(TEXTBOX, INNER_PADDING), Fade(GetColor(GuiGetStyle(TEXTBOX, BORDER_COLOR_FOCUSED)), guiAlpha));
|
|
||||||
}
|
DrawRectangleRec(cursor, Fade(GetColor(GuiGetStyle(TEXTBOX, BORDER_COLOR_PRESSED)), guiAlpha));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (state == GUI_STATE_DISABLED)
|
else if (state == GUI_STATE_DISABLED)
|
||||||
|
|||||||
Reference in New Issue
Block a user