mirror of
https://github.com/raysan5/raygui.git
synced 2026-02-01 11:49:18 -05:00
remove LOCKED state. Create guiLocked boolean. Improve FOCUSED state.
This commit is contained in:
@ -39,7 +39,7 @@ int main()
|
|||||||
int Spinner001Value = 0;
|
int Spinner001Value = 0;
|
||||||
int ValueBox002Value = 0;
|
int ValueBox002Value = 0;
|
||||||
char TextBox003Text[64] = "SAMPLE TEXT";
|
char TextBox003Text[64] = "SAMPLE TEXT";
|
||||||
int ListView004Active = 1;
|
int ListView004Active = -1;
|
||||||
const char *ListView004TextList[6] = { "Charmander", "Bulbasaur", "Squirtel", "Pikachu", "Eevee", "Pidgey" };
|
const char *ListView004TextList[6] = { "Charmander", "Bulbasaur", "Squirtel", "Pikachu", "Eevee", "Pidgey" };
|
||||||
char TextBox006Text[141] = "SAMPLE TEXT";
|
char TextBox006Text[141] = "SAMPLE TEXT";
|
||||||
|
|
||||||
@ -54,7 +54,7 @@ int main()
|
|||||||
bool dropDown001EditMode = false;
|
bool dropDown001EditMode = false;
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
Font font = LoadFontEx("fonts/pixelpoiiz10.ttf", 10, 0, 0);
|
Font font = LoadFontEx("fonts/NorthernLights.ttf", 30, 0, 0);
|
||||||
GuiFont(font);
|
GuiFont(font);
|
||||||
|
|
||||||
SetTargetFPS(60);
|
SetTargetFPS(60);
|
||||||
@ -92,6 +92,12 @@ int main()
|
|||||||
|
|
||||||
if (GuiDropdownBox((Rectangle){ 25, 25, 125, 30 }, DropdownBox000TextList, 3, &DropdownBox000Active, dropDown000EditMode)) dropDown000EditMode = !dropDown000EditMode;
|
if (GuiDropdownBox((Rectangle){ 25, 25, 125, 30 }, DropdownBox000TextList, 3, &DropdownBox000Active, dropDown000EditMode)) dropDown000EditMode = !dropDown000EditMode;
|
||||||
|
|
||||||
|
GuiLock();
|
||||||
|
GuiState(0); if (GuiButton((Rectangle){ 25, 400, 125, 30 }, "SAMPLE TEXT")) Button005();
|
||||||
|
GuiState(1); if (GuiButton((Rectangle){ 25, 440, 125, 30 }, "SAMPLE TEXT")) Button005();
|
||||||
|
GuiState(2); if (GuiButton((Rectangle){ 25, 480, 125, 30 }, "SAMPLE TEXT")) Button005();
|
||||||
|
GuiState(3); if (GuiButton((Rectangle){ 25, 520, 125, 30 }, "SAMPLE TEXT")) Button005();
|
||||||
|
GuiState(1);
|
||||||
GuiUnlock();
|
GuiUnlock();
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|||||||
BIN
examples/controls_review/fonts/NorthernLights.ttf
Normal file
BIN
examples/controls_review/fonts/NorthernLights.ttf
Normal file
Binary file not shown.
183
src/raygui.h
183
src/raygui.h
@ -360,8 +360,9 @@ typedef enum GuiProperty {
|
|||||||
// Global gui modification functions
|
// Global gui modification functions
|
||||||
RAYGUIDEF void GuiEnable(void); // Enable gui controls (global state)
|
RAYGUIDEF void GuiEnable(void); // Enable gui controls (global state)
|
||||||
RAYGUIDEF void GuiDisable(void); // Disable gui controls (global state)
|
RAYGUIDEF void GuiDisable(void); // Disable gui controls (global state)
|
||||||
RAYGUIDEF void GuiLock(void); // Disable gui controls (global state)
|
RAYGUIDEF void GuiLock(void); // Lock gui controls (global state)
|
||||||
RAYGUIDEF void GuiUnlock(void); // Disable gui controls (global state)
|
RAYGUIDEF void GuiUnlock(void); // Unlock gui controls (global state)
|
||||||
|
RAYGUIDEF void GuiState(int state); // Set gui state (global state)
|
||||||
RAYGUIDEF void GuiFont(Font font); // Define custom gui font (global state)
|
RAYGUIDEF void GuiFont(Font font); // Define custom gui font (global state)
|
||||||
RAYGUIDEF void GuiFade(float alpha); // Set gui controls alpha (global state), alpha goes from 0.0f to 1.0f
|
RAYGUIDEF void GuiFade(float alpha); // Set gui controls alpha (global state), alpha goes from 0.0f to 1.0f
|
||||||
|
|
||||||
@ -450,14 +451,14 @@ typedef enum GuiControlState {
|
|||||||
DISABLED = 0,
|
DISABLED = 0,
|
||||||
NORMAL,
|
NORMAL,
|
||||||
FOCUSED,
|
FOCUSED,
|
||||||
PRESSED,
|
PRESSED
|
||||||
LOCKED
|
|
||||||
} GuiControlState;
|
} GuiControlState;
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
// Global Variables Definition
|
// Global Variables Definition
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
static GuiControlState guiState = NORMAL;
|
static GuiControlState guiState = NORMAL;
|
||||||
|
static bool guiLocked = false;
|
||||||
static float guiAlpha = 1.0f;
|
static float guiAlpha = 1.0f;
|
||||||
static Font guiFont = { 0 };
|
static Font guiFont = { 0 };
|
||||||
|
|
||||||
@ -803,7 +804,6 @@ static int style[NUM_PROPERTIES] = {
|
|||||||
|
|
||||||
#define WHITE CLITERAL{ 255, 255, 255, 255 } // White
|
#define WHITE CLITERAL{ 255, 255, 255, 255 } // White
|
||||||
#define BLACK CLITERAL{ 0, 0, 0, 255 } // Black
|
#define BLACK CLITERAL{ 0, 0, 0, 255 } // Black
|
||||||
#define LIGHTGRAY CLITERAL{ 200, 200, 200, 255 } // Light Gray
|
|
||||||
#define RAYWHITE CLITERAL{ 245, 245, 245, 255 } // My own White (raylib logo)
|
#define RAYWHITE CLITERAL{ 245, 245, 245, 255 } // My own White (raylib logo)
|
||||||
|
|
||||||
// This functions are directly implemented in raygui
|
// This functions are directly implemented in raygui
|
||||||
@ -886,10 +886,13 @@ RAYGUIDEF void GuiEnable(void) { guiState = NORMAL; }
|
|||||||
RAYGUIDEF void GuiDisable(void) { guiState = DISABLED; }
|
RAYGUIDEF void GuiDisable(void) { guiState = DISABLED; }
|
||||||
|
|
||||||
// Lock gui global state
|
// Lock gui global state
|
||||||
RAYGUIDEF void GuiLock(void) { guiState = LOCKED; }
|
RAYGUIDEF void GuiLock(void) { guiLocked = true; }
|
||||||
|
|
||||||
// Unlock gui global state
|
// Unlock gui global state
|
||||||
RAYGUIDEF void GuiUnlock(void) { guiState = NORMAL; }
|
RAYGUIDEF void GuiUnlock(void) { guiLocked = false; }
|
||||||
|
|
||||||
|
// Set gui state (global state)
|
||||||
|
RAYGUIDEF void GuiState(int state) { guiState = (GuiControlState)state; }
|
||||||
|
|
||||||
// Define custom gui font
|
// Define custom gui font
|
||||||
RAYGUIDEF void GuiFont(Font font)
|
RAYGUIDEF void GuiFont(Font font)
|
||||||
@ -936,7 +939,7 @@ RAYGUIDEF bool GuiWindowBox(Rectangle bounds, const char *text)
|
|||||||
|
|
||||||
// Update control
|
// Update control
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
if ((state != DISABLED) && (state != LOCKED))
|
if ((state != DISABLED) && !guiLocked)
|
||||||
{
|
{
|
||||||
Vector2 mousePoint = GetMousePosition();
|
Vector2 mousePoint = GetMousePosition();
|
||||||
|
|
||||||
@ -955,7 +958,6 @@ RAYGUIDEF bool GuiWindowBox(Rectangle bounds, const char *text)
|
|||||||
switch (state)
|
switch (state)
|
||||||
{
|
{
|
||||||
case NORMAL:
|
case NORMAL:
|
||||||
case LOCKED:
|
|
||||||
{
|
{
|
||||||
DrawRectangleLinesEx(bounds, WINDOWBOX_BORDER_WIDTH, Fade(GetColor(style[DEFAULT_BORDER_COLOR_NORMAL]), guiAlpha));
|
DrawRectangleLinesEx(bounds, WINDOWBOX_BORDER_WIDTH, Fade(GetColor(style[DEFAULT_BORDER_COLOR_NORMAL]), guiAlpha));
|
||||||
DrawRectangleRec((Rectangle){ bounds.x + WINDOWBOX_BORDER_WIDTH, bounds.y + WINDOWBOX_BORDER_WIDTH, bounds.width - WINDOWBOX_BORDER_WIDTH*2, bounds.height - WINDOWBOX_BORDER_WIDTH*2 }, Fade(GetColor(style[DEFAULT_BACKGROUND_COLOR]), guiAlpha));
|
DrawRectangleRec((Rectangle){ bounds.x + WINDOWBOX_BORDER_WIDTH, bounds.y + WINDOWBOX_BORDER_WIDTH, bounds.width - WINDOWBOX_BORDER_WIDTH*2, bounds.height - WINDOWBOX_BORDER_WIDTH*2 }, Fade(GetColor(style[DEFAULT_BACKGROUND_COLOR]), guiAlpha));
|
||||||
@ -1008,9 +1010,7 @@ RAYGUIDEF void GuiGroupBox(Rectangle bounds, const char *text)
|
|||||||
switch (state)
|
switch (state)
|
||||||
{
|
{
|
||||||
case NORMAL:
|
case NORMAL:
|
||||||
case LOCKED:
|
|
||||||
{
|
{
|
||||||
|
|
||||||
DrawRectangle(bounds.x, bounds.y, GROUPBOX_LINE_THICK, bounds.height, Fade(GetColor(style[DEFAULT_LINES_COLOR]), guiAlpha));
|
DrawRectangle(bounds.x, bounds.y, GROUPBOX_LINE_THICK, bounds.height, Fade(GetColor(style[DEFAULT_LINES_COLOR]), guiAlpha));
|
||||||
DrawRectangle(bounds.x, bounds.y + bounds.height - 1, bounds.width, GROUPBOX_LINE_THICK, Fade(GetColor(style[DEFAULT_LINES_COLOR]), guiAlpha));
|
DrawRectangle(bounds.x, bounds.y + bounds.height - 1, bounds.width, GROUPBOX_LINE_THICK, Fade(GetColor(style[DEFAULT_LINES_COLOR]), guiAlpha));
|
||||||
DrawRectangle(bounds.x + bounds.width - 1, bounds.y, GROUPBOX_LINE_THICK, bounds.height, Fade(GetColor(style[DEFAULT_LINES_COLOR]), guiAlpha));
|
DrawRectangle(bounds.x + bounds.width - 1, bounds.y, GROUPBOX_LINE_THICK, bounds.height, Fade(GetColor(style[DEFAULT_LINES_COLOR]), guiAlpha));
|
||||||
@ -1056,7 +1056,6 @@ RAYGUIDEF void GuiLine(Rectangle bounds, int thick)
|
|||||||
switch (state)
|
switch (state)
|
||||||
{
|
{
|
||||||
case NORMAL:
|
case NORMAL:
|
||||||
case LOCKED:
|
|
||||||
case FOCUSED:
|
case FOCUSED:
|
||||||
case PRESSED: DrawRectangleLinesEx(line, thick, Fade(GetColor(style[DEFAULT_LINES_COLOR]), guiAlpha));break;
|
case PRESSED: DrawRectangleLinesEx(line, thick, Fade(GetColor(style[DEFAULT_LINES_COLOR]), guiAlpha));break;
|
||||||
case DISABLED: DrawRectangleLinesEx(line, thick, Fade(GetColor(style[DEFAULT_BORDER_COLOR_DISABLED]), guiAlpha));break;
|
case DISABLED: DrawRectangleLinesEx(line, thick, Fade(GetColor(style[DEFAULT_BORDER_COLOR_DISABLED]), guiAlpha));break;
|
||||||
@ -1077,7 +1076,6 @@ RAYGUIDEF void GuiPanel(Rectangle bounds)
|
|||||||
switch (state)
|
switch (state)
|
||||||
{
|
{
|
||||||
case NORMAL:
|
case NORMAL:
|
||||||
case LOCKED:
|
|
||||||
case FOCUSED:
|
case FOCUSED:
|
||||||
case PRESSED:
|
case PRESSED:
|
||||||
{
|
{
|
||||||
@ -1123,7 +1121,6 @@ RAYGUIDEF void GuiLabel(Rectangle bounds, const char *text)
|
|||||||
switch (state)
|
switch (state)
|
||||||
{
|
{
|
||||||
case NORMAL:
|
case NORMAL:
|
||||||
case LOCKED:
|
|
||||||
case FOCUSED:
|
case FOCUSED:
|
||||||
case PRESSED: GuiDrawText(text, bounds.x, bounds.y + bounds.height/2 - textHeight/2 + VALIGN_OFFSET(bounds.height), Fade(GetColor(style[LABEL_TEXT_COLOR_NORMAL]), guiAlpha)); break;
|
case PRESSED: GuiDrawText(text, bounds.x, bounds.y + bounds.height/2 - textHeight/2 + VALIGN_OFFSET(bounds.height), Fade(GetColor(style[LABEL_TEXT_COLOR_NORMAL]), guiAlpha)); break;
|
||||||
case DISABLED: GuiDrawText(text, bounds.x, bounds.y + bounds.height/2 - textHeight/2 + VALIGN_OFFSET(bounds.height), Fade(GetColor(style[LABEL_TEXT_COLOR_DISABLED]), guiAlpha)); break;
|
case DISABLED: GuiDrawText(text, bounds.x, bounds.y + bounds.height/2 - textHeight/2 + VALIGN_OFFSET(bounds.height), Fade(GetColor(style[LABEL_TEXT_COLOR_DISABLED]), guiAlpha)); break;
|
||||||
@ -1146,7 +1143,7 @@ RAYGUIDEF bool GuiButton(Rectangle bounds, const char *text)
|
|||||||
|
|
||||||
// Update control
|
// Update control
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
if ((state != DISABLED) && (state != LOCKED))
|
if ((state != DISABLED) && !guiLocked)
|
||||||
{
|
{
|
||||||
Vector2 mousePoint = GetMousePosition();
|
Vector2 mousePoint = GetMousePosition();
|
||||||
|
|
||||||
@ -1166,7 +1163,6 @@ RAYGUIDEF bool GuiButton(Rectangle bounds, const char *text)
|
|||||||
switch (state)
|
switch (state)
|
||||||
{
|
{
|
||||||
case NORMAL:
|
case NORMAL:
|
||||||
case LOCKED:
|
|
||||||
{
|
{
|
||||||
DrawRectangleLinesEx(bounds, style[BUTTON_BORDER_WIDTH], Fade(GetColor(style[BUTTON_BORDER_COLOR_NORMAL]), guiAlpha));
|
DrawRectangleLinesEx(bounds, style[BUTTON_BORDER_WIDTH], Fade(GetColor(style[BUTTON_BORDER_COLOR_NORMAL]), guiAlpha));
|
||||||
DrawRectangle(bounds.x + style[BUTTON_BORDER_WIDTH], bounds.y + style[BUTTON_BORDER_WIDTH], bounds.width - 2*style[BUTTON_BORDER_WIDTH], bounds.height - 2*style[BUTTON_BORDER_WIDTH], Fade(GetColor(style[BUTTON_BASE_COLOR_NORMAL]), guiAlpha));
|
DrawRectangle(bounds.x + style[BUTTON_BORDER_WIDTH], bounds.y + style[BUTTON_BORDER_WIDTH], bounds.width - 2*style[BUTTON_BORDER_WIDTH], bounds.height - 2*style[BUTTON_BORDER_WIDTH], Fade(GetColor(style[BUTTON_BASE_COLOR_NORMAL]), guiAlpha));
|
||||||
@ -1211,7 +1207,7 @@ RAYGUIDEF bool GuiLabelButton(Rectangle bounds, const char *text)
|
|||||||
|
|
||||||
// Update control
|
// Update control
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
if ((state != DISABLED) && (state != LOCKED))
|
if ((state != DISABLED) && !guiLocked)
|
||||||
{
|
{
|
||||||
Vector2 mousePoint = GetMousePosition();
|
Vector2 mousePoint = GetMousePosition();
|
||||||
|
|
||||||
@ -1229,7 +1225,7 @@ RAYGUIDEF bool GuiLabelButton(Rectangle bounds, const char *text)
|
|||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
switch (state)
|
switch (state)
|
||||||
{
|
{
|
||||||
case NORMAL: case LOCKED: GuiDrawText(text, bounds.x, bounds.y + bounds.height/2 - textHeight/2, Fade(GetColor(style[LABEL_TEXT_COLOR_NORMAL]), guiAlpha)); break;
|
case NORMAL: GuiDrawText(text, bounds.x, bounds.y + bounds.height/2 - textHeight/2, Fade(GetColor(style[LABEL_TEXT_COLOR_NORMAL]), guiAlpha)); break;
|
||||||
case FOCUSED: GuiDrawText(text, bounds.x, bounds.y + bounds.height/2 - textHeight/2, Fade(GetColor(style[LABEL_TEXT_COLOR_FOCUSED]), guiAlpha)); break;
|
case FOCUSED: GuiDrawText(text, bounds.x, bounds.y + bounds.height/2 - textHeight/2, Fade(GetColor(style[LABEL_TEXT_COLOR_FOCUSED]), guiAlpha)); break;
|
||||||
case PRESSED: GuiDrawText(text, bounds.x, bounds.y + bounds.height/2 - textHeight/2, Fade(GetColor(style[LABEL_TEXT_COLOR_PRESSED]), guiAlpha)); break;
|
case PRESSED: GuiDrawText(text, bounds.x, bounds.y + bounds.height/2 - textHeight/2, Fade(GetColor(style[LABEL_TEXT_COLOR_PRESSED]), guiAlpha)); break;
|
||||||
case DISABLED: GuiDrawText(text, bounds.x, bounds.y + bounds.height/2 - textHeight/2, Fade(GetColor(style[LABEL_TEXT_COLOR_DISABLED]), guiAlpha)); break;
|
case DISABLED: GuiDrawText(text, bounds.x, bounds.y + bounds.height/2 - textHeight/2, Fade(GetColor(style[LABEL_TEXT_COLOR_DISABLED]), guiAlpha)); break;
|
||||||
@ -1272,7 +1268,7 @@ RAYGUIDEF bool GuiImageButtonEx(Rectangle bounds, Texture2D texture, Rectangle t
|
|||||||
|
|
||||||
// Update control
|
// Update control
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
if ((state != DISABLED) && (state != LOCKED))
|
if ((state != DISABLED) && !guiLocked)
|
||||||
{
|
{
|
||||||
Vector2 mousePoint = GetMousePosition();
|
Vector2 mousePoint = GetMousePosition();
|
||||||
|
|
||||||
@ -1291,7 +1287,6 @@ RAYGUIDEF bool GuiImageButtonEx(Rectangle bounds, Texture2D texture, Rectangle t
|
|||||||
switch (state)
|
switch (state)
|
||||||
{
|
{
|
||||||
case NORMAL:
|
case NORMAL:
|
||||||
case LOCKED:
|
|
||||||
{
|
{
|
||||||
DrawRectangleLinesEx(bounds, style[BUTTON_BORDER_WIDTH], Fade(GetColor(style[BUTTON_BORDER_COLOR_NORMAL]), guiAlpha));
|
DrawRectangleLinesEx(bounds, style[BUTTON_BORDER_WIDTH], Fade(GetColor(style[BUTTON_BORDER_COLOR_NORMAL]), guiAlpha));
|
||||||
DrawRectangle(bounds.x + style[BUTTON_BORDER_WIDTH], bounds.y + style[BUTTON_BORDER_WIDTH], bounds.width - 2*style[BUTTON_BORDER_WIDTH], bounds.height - 2*style[BUTTON_BORDER_WIDTH], Fade(GetColor(style[BUTTON_BASE_COLOR_NORMAL]), guiAlpha));
|
DrawRectangle(bounds.x + style[BUTTON_BORDER_WIDTH], bounds.y + style[BUTTON_BORDER_WIDTH], bounds.width - 2*style[BUTTON_BORDER_WIDTH], bounds.height - 2*style[BUTTON_BORDER_WIDTH], Fade(GetColor(style[BUTTON_BASE_COLOR_NORMAL]), guiAlpha));
|
||||||
@ -1339,7 +1334,7 @@ RAYGUIDEF bool GuiToggleButton(Rectangle bounds, const char *text, bool active)
|
|||||||
|
|
||||||
// Update control
|
// Update control
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
if ((state != DISABLED) && (state != LOCKED))
|
if ((state != DISABLED) && !guiLocked)
|
||||||
{
|
{
|
||||||
Vector2 mousePoint = GetMousePosition();
|
Vector2 mousePoint = GetMousePosition();
|
||||||
|
|
||||||
@ -1362,7 +1357,6 @@ RAYGUIDEF bool GuiToggleButton(Rectangle bounds, const char *text, bool active)
|
|||||||
switch (state)
|
switch (state)
|
||||||
{
|
{
|
||||||
case NORMAL:
|
case NORMAL:
|
||||||
case LOCKED:
|
|
||||||
{
|
{
|
||||||
if (active)
|
if (active)
|
||||||
{
|
{
|
||||||
@ -1421,7 +1415,7 @@ RAYGUIDEF bool GuiCheckBox(Rectangle bounds, bool checked)
|
|||||||
|
|
||||||
// Update control
|
// Update control
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
if ((state != DISABLED) && (state != LOCKED))
|
if ((state != DISABLED) && !guiLocked)
|
||||||
{
|
{
|
||||||
Vector2 mousePoint = GetMousePosition();
|
Vector2 mousePoint = GetMousePosition();
|
||||||
|
|
||||||
@ -1440,7 +1434,6 @@ RAYGUIDEF bool GuiCheckBox(Rectangle bounds, bool checked)
|
|||||||
switch (state)
|
switch (state)
|
||||||
{
|
{
|
||||||
case NORMAL:
|
case NORMAL:
|
||||||
case LOCKED:
|
|
||||||
{
|
{
|
||||||
DrawRectangleLinesEx(bounds, style[CHECKBOX_BORDER_WIDTH], Fade(GetColor(style[CHECKBOX_BORDER_COLOR_NORMAL]), guiAlpha));
|
DrawRectangleLinesEx(bounds, style[CHECKBOX_BORDER_WIDTH], Fade(GetColor(style[CHECKBOX_BORDER_COLOR_NORMAL]), guiAlpha));
|
||||||
DrawRectangle(bounds.x + style[CHECKBOX_BORDER_WIDTH], bounds.y + style[CHECKBOX_BORDER_WIDTH], bounds.width - 2*style[CHECKBOX_BORDER_WIDTH], bounds.height - 2*style[CHECKBOX_BORDER_WIDTH], Fade(GetColor(style[CHECKBOX_BASE_COLOR_NORMAL]), guiAlpha));
|
DrawRectangle(bounds.x + style[CHECKBOX_BORDER_WIDTH], bounds.y + style[CHECKBOX_BORDER_WIDTH], bounds.width - 2*style[CHECKBOX_BORDER_WIDTH], bounds.height - 2*style[CHECKBOX_BORDER_WIDTH], Fade(GetColor(style[CHECKBOX_BASE_COLOR_NORMAL]), guiAlpha));
|
||||||
@ -1494,7 +1487,7 @@ RAYGUIDEF bool GuiCheckBoxEx(Rectangle bounds, bool checked, const char *text)
|
|||||||
|
|
||||||
// Update control
|
// Update control
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
if ((state != DISABLED) && (state != LOCKED))
|
if ((state != DISABLED) && !guiLocked)
|
||||||
{
|
{
|
||||||
Vector2 mousePoint = GetMousePosition();
|
Vector2 mousePoint = GetMousePosition();
|
||||||
|
|
||||||
@ -1515,7 +1508,6 @@ RAYGUIDEF bool GuiCheckBoxEx(Rectangle bounds, bool checked, const char *text)
|
|||||||
switch (state)
|
switch (state)
|
||||||
{
|
{
|
||||||
case NORMAL:
|
case NORMAL:
|
||||||
case LOCKED:
|
|
||||||
{
|
{
|
||||||
DrawRectangleLinesEx(bounds, style[CHECKBOX_BORDER_WIDTH], Fade(GetColor(style[CHECKBOX_BORDER_COLOR_NORMAL]), guiAlpha));
|
DrawRectangleLinesEx(bounds, style[CHECKBOX_BORDER_WIDTH], Fade(GetColor(style[CHECKBOX_BORDER_COLOR_NORMAL]), guiAlpha));
|
||||||
DrawRectangle(bounds.x + style[CHECKBOX_BORDER_WIDTH], bounds.y + style[CHECKBOX_BORDER_WIDTH], bounds.width - 2*style[CHECKBOX_BORDER_WIDTH], bounds.height - 2*style[CHECKBOX_BORDER_WIDTH], Fade(GetColor(style[CHECKBOX_BASE_COLOR_NORMAL]), guiAlpha));
|
DrawRectangle(bounds.x + style[CHECKBOX_BORDER_WIDTH], bounds.y + style[CHECKBOX_BORDER_WIDTH], bounds.width - 2*style[CHECKBOX_BORDER_WIDTH], bounds.height - 2*style[CHECKBOX_BORDER_WIDTH], Fade(GetColor(style[CHECKBOX_BASE_COLOR_NORMAL]), guiAlpha));
|
||||||
@ -1580,7 +1572,7 @@ RAYGUIDEF int GuiComboBox(Rectangle bounds, const char **text, int count, int ac
|
|||||||
|
|
||||||
// Update control
|
// Update control
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
if ((state != DISABLED) && (state != LOCKED))
|
if ((state != DISABLED) && !guiLocked)
|
||||||
{
|
{
|
||||||
Vector2 mousePoint = GetMousePosition();
|
Vector2 mousePoint = GetMousePosition();
|
||||||
|
|
||||||
@ -1604,7 +1596,6 @@ RAYGUIDEF int GuiComboBox(Rectangle bounds, const char **text, int count, int ac
|
|||||||
switch (state)
|
switch (state)
|
||||||
{
|
{
|
||||||
case NORMAL:
|
case NORMAL:
|
||||||
case LOCKED:
|
|
||||||
{
|
{
|
||||||
DrawRectangleLinesEx(bounds, style[COMBOBOX_BORDER_WIDTH], Fade(GetColor(style[COMBOBOX_BORDER_COLOR_NORMAL]), guiAlpha));
|
DrawRectangleLinesEx(bounds, style[COMBOBOX_BORDER_WIDTH], Fade(GetColor(style[COMBOBOX_BORDER_COLOR_NORMAL]), guiAlpha));
|
||||||
DrawRectangle(bounds.x + style[COMBOBOX_BORDER_WIDTH], bounds.y + style[COMBOBOX_BORDER_WIDTH], bounds.width - 2*style[COMBOBOX_BORDER_WIDTH], bounds.height - 2*style[COMBOBOX_BORDER_WIDTH], Fade(GetColor(style[COMBOBOX_BASE_COLOR_NORMAL]), guiAlpha));
|
DrawRectangle(bounds.x + style[COMBOBOX_BORDER_WIDTH], bounds.y + style[COMBOBOX_BORDER_WIDTH], bounds.width - 2*style[COMBOBOX_BORDER_WIDTH], bounds.height - 2*style[COMBOBOX_BORDER_WIDTH], Fade(GetColor(style[COMBOBOX_BASE_COLOR_NORMAL]), guiAlpha));
|
||||||
@ -1677,10 +1668,11 @@ RAYGUIDEF bool GuiDropdownBox(Rectangle bounds, const char **text, int count, in
|
|||||||
Rectangle openBounds = bounds;
|
Rectangle openBounds = bounds;
|
||||||
openBounds.height *= (count + 1);
|
openBounds.height *= (count + 1);
|
||||||
|
|
||||||
if (state == LOCKED && editMode) state = NORMAL;
|
|
||||||
// Update control
|
// Update control
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
if ((state != DISABLED) && (state != LOCKED))
|
if (guiLocked && editMode) guiLocked = false;
|
||||||
|
|
||||||
|
if ((state != DISABLED) && !guiLocked)
|
||||||
{
|
{
|
||||||
Vector2 mousePoint = GetMousePosition();
|
Vector2 mousePoint = GetMousePosition();
|
||||||
|
|
||||||
@ -1728,7 +1720,6 @@ RAYGUIDEF bool GuiDropdownBox(Rectangle bounds, const char **text, int count, in
|
|||||||
switch (state)
|
switch (state)
|
||||||
{
|
{
|
||||||
case NORMAL:
|
case NORMAL:
|
||||||
case LOCKED:
|
|
||||||
{
|
{
|
||||||
DrawRectangle(bounds.x, bounds.y, bounds.width, bounds.height, Fade(GetColor(style[DEFAULT_BASE_COLOR_NORMAL]), guiAlpha));
|
DrawRectangle(bounds.x, bounds.y, bounds.width, bounds.height, Fade(GetColor(style[DEFAULT_BASE_COLOR_NORMAL]), guiAlpha));
|
||||||
DrawRectangleLinesEx(bounds, DROPDOWNBOX_BORDER_WIDTH, Fade(GetColor(style[LISTVIEW_BORDER_COLOR_NORMAL]), guiAlpha));
|
DrawRectangleLinesEx(bounds, DROPDOWNBOX_BORDER_WIDTH, Fade(GetColor(style[LISTVIEW_BORDER_COLOR_NORMAL]), guiAlpha));
|
||||||
@ -1844,7 +1835,7 @@ RAYGUIDEF bool GuiValueBox(Rectangle bounds, int *value, int minValue, int maxVa
|
|||||||
|
|
||||||
// Update control
|
// Update control
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
if ((state != DISABLED) && (state != LOCKED))
|
if ((state != DISABLED) && !guiLocked)
|
||||||
{
|
{
|
||||||
Vector2 mousePoint = GetMousePosition();
|
Vector2 mousePoint = GetMousePosition();
|
||||||
|
|
||||||
@ -1852,7 +1843,7 @@ RAYGUIDEF bool GuiValueBox(Rectangle bounds, int *value, int minValue, int maxVa
|
|||||||
|
|
||||||
if (editMode)
|
if (editMode)
|
||||||
{
|
{
|
||||||
state = FOCUSED; // NOTE: PRESSED state is not used on this control
|
state = PRESSED;
|
||||||
|
|
||||||
framesCounter++;
|
framesCounter++;
|
||||||
|
|
||||||
@ -1904,7 +1895,11 @@ RAYGUIDEF bool GuiValueBox(Rectangle bounds, int *value, int minValue, int maxVa
|
|||||||
// Note: Changing editMode
|
// Note: Changing editMode
|
||||||
if (!editMode)
|
if (!editMode)
|
||||||
{
|
{
|
||||||
if (CheckCollisionPointRec(mousePoint, bounds) && IsMouseButtonPressed(0)) pressed = true;
|
if (CheckCollisionPointRec(mousePoint, bounds))
|
||||||
|
{
|
||||||
|
state = FOCUSED;
|
||||||
|
if (IsMouseButtonPressed(0)) pressed = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1920,7 +1915,6 @@ RAYGUIDEF bool GuiValueBox(Rectangle bounds, int *value, int minValue, int maxVa
|
|||||||
switch (state)
|
switch (state)
|
||||||
{
|
{
|
||||||
case NORMAL:
|
case NORMAL:
|
||||||
case LOCKED:
|
|
||||||
{
|
{
|
||||||
DrawRectangleLinesEx(bounds, style[TEXTBOX_BORDER_WIDTH], Fade(GetColor(style[VALUEBOX_BORDER_COLOR_NORMAL]), guiAlpha));
|
DrawRectangleLinesEx(bounds, style[TEXTBOX_BORDER_WIDTH], Fade(GetColor(style[VALUEBOX_BORDER_COLOR_NORMAL]), guiAlpha));
|
||||||
DrawRectangle(bounds.x + style[TEXTBOX_BORDER_WIDTH], bounds.y + style[TEXTBOX_BORDER_WIDTH], bounds.width - 2*style[TEXTBOX_BORDER_WIDTH], bounds.height - 2*style[TEXTBOX_BORDER_WIDTH], Fade(GetColor(style[VALUEBOX_BASE_COLOR_NORMAL]), guiAlpha));
|
DrawRectangle(bounds.x + style[TEXTBOX_BORDER_WIDTH], bounds.y + style[TEXTBOX_BORDER_WIDTH], bounds.width - 2*style[TEXTBOX_BORDER_WIDTH], bounds.height - 2*style[TEXTBOX_BORDER_WIDTH], Fade(GetColor(style[VALUEBOX_BASE_COLOR_NORMAL]), guiAlpha));
|
||||||
@ -1929,12 +1923,17 @@ RAYGUIDEF bool GuiValueBox(Rectangle bounds, int *value, int minValue, int maxVa
|
|||||||
case FOCUSED:
|
case FOCUSED:
|
||||||
{
|
{
|
||||||
DrawRectangleLinesEx(bounds, style[TEXTBOX_BORDER_WIDTH], Fade(GetColor(style[VALUEBOX_BORDER_COLOR_FOCUSED]), guiAlpha));
|
DrawRectangleLinesEx(bounds, style[TEXTBOX_BORDER_WIDTH], Fade(GetColor(style[VALUEBOX_BORDER_COLOR_FOCUSED]), guiAlpha));
|
||||||
DrawRectangle(bounds.x + style[TEXTBOX_BORDER_WIDTH], bounds.y + style[TEXTBOX_BORDER_WIDTH], bounds.width - 2*style[TEXTBOX_BORDER_WIDTH], bounds.height - 2*style[TEXTBOX_BORDER_WIDTH], Fade(GetColor(style[VALUEBOX_BASE_COLOR_FOCUSED]), guiAlpha));
|
DrawRectangle(bounds.x + style[TEXTBOX_BORDER_WIDTH], bounds.y + style[TEXTBOX_BORDER_WIDTH], bounds.width - 2*style[TEXTBOX_BORDER_WIDTH], bounds.height - 2*style[TEXTBOX_BORDER_WIDTH], Fade(GetColor(style[VALUEBOX_BASE_COLOR_NORMAL]), guiAlpha));
|
||||||
GuiDrawText(text, bounds.x + bounds.width/2 - textWidth/2, bounds.y + bounds.height/2 - style[DEFAULT_TEXT_SIZE]/2 + VALIGN_OFFSET(bounds.height), Fade(GetColor(style[VALUEBOX_TEXT_COLOR_FOCUSED]), guiAlpha));
|
GuiDrawText(text, bounds.x + bounds.width/2 - textWidth/2, bounds.y + bounds.height/2 - style[DEFAULT_TEXT_SIZE]/2 + VALIGN_OFFSET(bounds.height), Fade(GetColor(style[VALUEBOX_TEXT_COLOR_FOCUSED]), guiAlpha));
|
||||||
|
} break;
|
||||||
|
case PRESSED:
|
||||||
|
{
|
||||||
|
DrawRectangleLinesEx(bounds, style[TEXTBOX_BORDER_WIDTH], Fade(GetColor(style[VALUEBOX_BORDER_COLOR_PRESSED]), guiAlpha));
|
||||||
|
DrawRectangle(bounds.x + style[TEXTBOX_BORDER_WIDTH], bounds.y + style[TEXTBOX_BORDER_WIDTH], bounds.width - 2*style[TEXTBOX_BORDER_WIDTH], bounds.height - 2*style[TEXTBOX_BORDER_WIDTH], Fade(GetColor(style[VALUEBOX_BASE_COLOR_FOCUSED]), guiAlpha));
|
||||||
|
GuiDrawText(text, bounds.x + bounds.width/2 - textWidth/2, bounds.y + bounds.height/2 - style[DEFAULT_TEXT_SIZE]/2 + VALIGN_OFFSET(bounds.height), Fade(GetColor(style[VALUEBOX_TEXT_COLOR_PRESSED]), guiAlpha));
|
||||||
|
|
||||||
if (editMode && ((framesCounter/20)%2 == 0)) DrawRectangle(bounds.x + 2 /*+ DEFAULT_TEXT_LINE_PADDING */+ GuiTextWidth(text)/2 + bounds.width/2, bounds.y + DEFAULT_TEXT_LINE_PADDING/2, 1, bounds.height - DEFAULT_TEXT_LINE_PADDING, Fade(GetColor(style[TEXTBOX_BORDER_COLOR_FOCUSED]), guiAlpha));
|
if (editMode && ((framesCounter/20)%2 == 0)) DrawRectangle(bounds.x + 2 /*+ DEFAULT_TEXT_LINE_PADDING */+ GuiTextWidth(text)/2 + bounds.width/2, bounds.y + DEFAULT_TEXT_LINE_PADDING/2, 1, bounds.height - DEFAULT_TEXT_LINE_PADDING, Fade(GetColor(style[TEXTBOX_BORDER_COLOR_FOCUSED]), guiAlpha));
|
||||||
} break;
|
} break;
|
||||||
case PRESSED: break; // NOTE: State not used on this control
|
|
||||||
case DISABLED:
|
case DISABLED:
|
||||||
{
|
{
|
||||||
DrawRectangleLinesEx(bounds, style[TEXTBOX_BORDER_WIDTH], Fade(GetColor(style[VALUEBOX_BORDER_COLOR_DISABLED]), guiAlpha));
|
DrawRectangleLinesEx(bounds, style[TEXTBOX_BORDER_WIDTH], Fade(GetColor(style[VALUEBOX_BORDER_COLOR_DISABLED]), guiAlpha));
|
||||||
@ -1959,7 +1958,7 @@ RAYGUIDEF bool GuiTextBox(Rectangle bounds, char *text, int textSize, bool editM
|
|||||||
|
|
||||||
// Update control
|
// Update control
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
if ((state != DISABLED) && (state != LOCKED))
|
if ((state != DISABLED) && !guiLocked)
|
||||||
{
|
{
|
||||||
Vector2 mousePoint = GetMousePosition();
|
Vector2 mousePoint = GetMousePosition();
|
||||||
|
|
||||||
@ -1967,7 +1966,7 @@ RAYGUIDEF bool GuiTextBox(Rectangle bounds, char *text, int textSize, bool editM
|
|||||||
|
|
||||||
if (editMode)
|
if (editMode)
|
||||||
{
|
{
|
||||||
state = FOCUSED; // NOTE: PRESSED state is not used on this control
|
state = PRESSED;
|
||||||
|
|
||||||
framesCounter++;
|
framesCounter++;
|
||||||
|
|
||||||
@ -2010,7 +2009,11 @@ RAYGUIDEF bool GuiTextBox(Rectangle bounds, char *text, int textSize, bool editM
|
|||||||
// Note: Changing editMode
|
// Note: Changing editMode
|
||||||
if (!editMode)
|
if (!editMode)
|
||||||
{
|
{
|
||||||
if (CheckCollisionPointRec(mousePoint, bounds) && IsMouseButtonPressed(0)) pressed = true;
|
if (CheckCollisionPointRec(mousePoint, bounds))
|
||||||
|
{
|
||||||
|
state = FOCUSED;
|
||||||
|
if (IsMouseButtonPressed(0)) pressed = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -2026,7 +2029,6 @@ RAYGUIDEF bool GuiTextBox(Rectangle bounds, char *text, int textSize, bool editM
|
|||||||
switch (state)
|
switch (state)
|
||||||
{
|
{
|
||||||
case NORMAL:
|
case NORMAL:
|
||||||
case LOCKED:
|
|
||||||
{
|
{
|
||||||
DrawRectangleLinesEx(bounds, style[TEXTBOX_BORDER_WIDTH], Fade(GetColor(style[TEXTBOX_BORDER_COLOR_NORMAL]), guiAlpha));
|
DrawRectangleLinesEx(bounds, style[TEXTBOX_BORDER_WIDTH], Fade(GetColor(style[TEXTBOX_BORDER_COLOR_NORMAL]), guiAlpha));
|
||||||
DrawRectangle(bounds.x + style[TEXTBOX_BORDER_WIDTH], bounds.y + style[TEXTBOX_BORDER_WIDTH], bounds.width - 2*style[TEXTBOX_BORDER_WIDTH], bounds.height - 2*style[TEXTBOX_BORDER_WIDTH], Fade(GetColor(style[TEXTBOX_BASE_COLOR_NORMAL]), guiAlpha));
|
DrawRectangle(bounds.x + style[TEXTBOX_BORDER_WIDTH], bounds.y + style[TEXTBOX_BORDER_WIDTH], bounds.width - 2*style[TEXTBOX_BORDER_WIDTH], bounds.height - 2*style[TEXTBOX_BORDER_WIDTH], Fade(GetColor(style[TEXTBOX_BASE_COLOR_NORMAL]), guiAlpha));
|
||||||
@ -2035,12 +2037,17 @@ RAYGUIDEF bool GuiTextBox(Rectangle bounds, char *text, int textSize, bool editM
|
|||||||
case FOCUSED:
|
case FOCUSED:
|
||||||
{
|
{
|
||||||
DrawRectangleLinesEx(bounds, style[TEXTBOX_BORDER_WIDTH], Fade(GetColor(style[TEXTBOX_BORDER_COLOR_FOCUSED]), guiAlpha));
|
DrawRectangleLinesEx(bounds, style[TEXTBOX_BORDER_WIDTH], Fade(GetColor(style[TEXTBOX_BORDER_COLOR_FOCUSED]), guiAlpha));
|
||||||
|
DrawRectangle(bounds.x + style[TEXTBOX_BORDER_WIDTH], bounds.y + style[TEXTBOX_BORDER_WIDTH], bounds.width - 2*style[TEXTBOX_BORDER_WIDTH], bounds.height - 2*style[TEXTBOX_BORDER_WIDTH], Fade(GetColor(style[TEXTBOX_BASE_COLOR_NORMAL]), guiAlpha));
|
||||||
|
GuiDrawText(text, bounds.x + DEFAULT_TEXT_PADDING, bounds.y + bounds.height/2 - style[DEFAULT_TEXT_SIZE]/2, Fade(GetColor(style[TEXTBOX_TEXT_COLOR_FOCUSED]), guiAlpha));
|
||||||
|
} break;
|
||||||
|
case PRESSED:
|
||||||
|
{
|
||||||
|
DrawRectangleLinesEx(bounds, style[TEXTBOX_BORDER_WIDTH], Fade(GetColor(style[TEXTBOX_BORDER_COLOR_PRESSED]), guiAlpha));
|
||||||
DrawRectangle(bounds.x + style[TEXTBOX_BORDER_WIDTH], bounds.y + style[TEXTBOX_BORDER_WIDTH], bounds.width - 2*style[TEXTBOX_BORDER_WIDTH], bounds.height - 2*style[TEXTBOX_BORDER_WIDTH], Fade(GetColor(style[TEXTBOX_BASE_COLOR_FOCUSED]), guiAlpha));
|
DrawRectangle(bounds.x + style[TEXTBOX_BORDER_WIDTH], bounds.y + style[TEXTBOX_BORDER_WIDTH], bounds.width - 2*style[TEXTBOX_BORDER_WIDTH], bounds.height - 2*style[TEXTBOX_BORDER_WIDTH], Fade(GetColor(style[TEXTBOX_BASE_COLOR_FOCUSED]), guiAlpha));
|
||||||
GuiDrawText(text, bounds.x + DEFAULT_TEXT_PADDING, bounds.y + bounds.height/2 - style[DEFAULT_TEXT_SIZE]/2, Fade(GetColor(style[TEXTBOX_TEXT_COLOR_PRESSED]), guiAlpha));
|
GuiDrawText(text, bounds.x + DEFAULT_TEXT_PADDING, bounds.y + bounds.height/2 - style[DEFAULT_TEXT_SIZE]/2, Fade(GetColor(style[TEXTBOX_TEXT_COLOR_PRESSED]), guiAlpha));
|
||||||
|
|
||||||
if (editMode && ((framesCounter/20)%2 == 0)) DrawRectangle(bounds.x + DEFAULT_TEXT_LINE_PADDING + GuiTextWidth(text), bounds.y + DEFAULT_TEXT_LINE_PADDING/2, 1, bounds.height - DEFAULT_TEXT_LINE_PADDING, Fade(GetColor(style[TEXTBOX_BORDER_COLOR_FOCUSED]), guiAlpha));
|
if (editMode && ((framesCounter/20)%2 == 0)) DrawRectangle(bounds.x + DEFAULT_TEXT_LINE_PADDING + GuiTextWidth(text), bounds.y + DEFAULT_TEXT_LINE_PADDING/2, 1, bounds.height - DEFAULT_TEXT_LINE_PADDING, Fade(GetColor(style[TEXTBOX_BORDER_COLOR_PRESSED]), guiAlpha));
|
||||||
} break;
|
} break;
|
||||||
case PRESSED: break; // NOTE: State not used on this control
|
|
||||||
case DISABLED:
|
case DISABLED:
|
||||||
{
|
{
|
||||||
DrawRectangleLinesEx(bounds, style[TEXTBOX_BORDER_WIDTH], Fade(GetColor(style[TEXTBOX_BORDER_COLOR_DISABLED]), guiAlpha));
|
DrawRectangleLinesEx(bounds, style[TEXTBOX_BORDER_WIDTH], Fade(GetColor(style[TEXTBOX_BORDER_COLOR_DISABLED]), guiAlpha));
|
||||||
@ -2074,7 +2081,7 @@ RAYGUIDEF bool GuiTextBoxMulti(Rectangle bounds, char *text, int textSize, bool
|
|||||||
|
|
||||||
// Update control
|
// Update control
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
if ((state != DISABLED) && (state != LOCKED))
|
if ((state != DISABLED) && !guiLocked)
|
||||||
{
|
{
|
||||||
Vector2 mousePoint = GetMousePosition();
|
Vector2 mousePoint = GetMousePosition();
|
||||||
|
|
||||||
@ -2082,7 +2089,7 @@ RAYGUIDEF bool GuiTextBoxMulti(Rectangle bounds, char *text, int textSize, bool
|
|||||||
|
|
||||||
if (editMode)
|
if (editMode)
|
||||||
{
|
{
|
||||||
state = FOCUSED;
|
state = PRESSED;
|
||||||
|
|
||||||
framesCounter++;
|
framesCounter++;
|
||||||
|
|
||||||
@ -2207,7 +2214,11 @@ RAYGUIDEF bool GuiTextBoxMulti(Rectangle bounds, char *text, int textSize, bool
|
|||||||
// Changing editMode
|
// Changing editMode
|
||||||
if (!editMode)
|
if (!editMode)
|
||||||
{
|
{
|
||||||
if (CheckCollisionPointRec(mousePoint, bounds) && IsMouseButtonPressed(0)) pressed = true;
|
if (CheckCollisionPointRec(mousePoint, bounds))
|
||||||
|
{
|
||||||
|
state = FOCUSED;
|
||||||
|
if (IsMouseButtonPressed(0)) pressed = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -2223,7 +2234,6 @@ RAYGUIDEF bool GuiTextBoxMulti(Rectangle bounds, char *text, int textSize, bool
|
|||||||
switch (state)
|
switch (state)
|
||||||
{
|
{
|
||||||
case NORMAL:
|
case NORMAL:
|
||||||
case LOCKED:
|
|
||||||
{
|
{
|
||||||
DrawRectangleLinesEx(bounds, style[TEXTBOX_BORDER_WIDTH], Fade(GetColor(style[TEXTBOX_BORDER_COLOR_NORMAL]), guiAlpha));
|
DrawRectangleLinesEx(bounds, style[TEXTBOX_BORDER_WIDTH], Fade(GetColor(style[TEXTBOX_BORDER_COLOR_NORMAL]), guiAlpha));
|
||||||
DrawRectangle(bounds.x + style[TEXTBOX_BORDER_WIDTH], bounds.y + style[TEXTBOX_BORDER_WIDTH], bounds.width - 2*style[TEXTBOX_BORDER_WIDTH], bounds.height - 2*style[TEXTBOX_BORDER_WIDTH], Fade(GetColor(style[TEXTBOX_BASE_COLOR_NORMAL]), guiAlpha));
|
DrawRectangle(bounds.x + style[TEXTBOX_BORDER_WIDTH], bounds.y + style[TEXTBOX_BORDER_WIDTH], bounds.width - 2*style[TEXTBOX_BORDER_WIDTH], bounds.height - 2*style[TEXTBOX_BORDER_WIDTH], Fade(GetColor(style[TEXTBOX_BASE_COLOR_NORMAL]), guiAlpha));
|
||||||
@ -2232,6 +2242,12 @@ RAYGUIDEF bool GuiTextBoxMulti(Rectangle bounds, char *text, int textSize, bool
|
|||||||
case FOCUSED:
|
case FOCUSED:
|
||||||
{
|
{
|
||||||
DrawRectangleLinesEx(bounds, style[TEXTBOX_BORDER_WIDTH], Fade(GetColor(style[TEXTBOX_BORDER_COLOR_FOCUSED]), guiAlpha));
|
DrawRectangleLinesEx(bounds, style[TEXTBOX_BORDER_WIDTH], Fade(GetColor(style[TEXTBOX_BORDER_COLOR_FOCUSED]), guiAlpha));
|
||||||
|
DrawRectangle(bounds.x + style[TEXTBOX_BORDER_WIDTH], bounds.y + style[TEXTBOX_BORDER_WIDTH], bounds.width - 2*style[TEXTBOX_BORDER_WIDTH], bounds.height - 2*style[TEXTBOX_BORDER_WIDTH], Fade(GetColor(style[TEXTBOX_BASE_COLOR_NORMAL]), guiAlpha));
|
||||||
|
GuiDrawText(text, bounds.x + GUITEXTBOXMULTI_PADDING, bounds.y + GUITEXTBOXMULTI_PADDING, Fade(GetColor(style[TEXTBOX_TEXT_COLOR_FOCUSED]), guiAlpha));
|
||||||
|
} break;
|
||||||
|
case PRESSED:
|
||||||
|
{
|
||||||
|
DrawRectangleLinesEx(bounds, style[TEXTBOX_BORDER_WIDTH], Fade(GetColor(style[TEXTBOX_BORDER_COLOR_PRESSED]), guiAlpha));
|
||||||
DrawRectangle(bounds.x + style[TEXTBOX_BORDER_WIDTH], bounds.y + style[TEXTBOX_BORDER_WIDTH], bounds.width - 2*style[TEXTBOX_BORDER_WIDTH], bounds.height - 2*style[TEXTBOX_BORDER_WIDTH], Fade(GetColor(style[TEXTBOX_BASE_COLOR_FOCUSED]), guiAlpha));
|
DrawRectangle(bounds.x + style[TEXTBOX_BORDER_WIDTH], bounds.y + style[TEXTBOX_BORDER_WIDTH], bounds.width - 2*style[TEXTBOX_BORDER_WIDTH], bounds.height - 2*style[TEXTBOX_BORDER_WIDTH], Fade(GetColor(style[TEXTBOX_BASE_COLOR_FOCUSED]), guiAlpha));
|
||||||
GuiDrawText(text, bounds.x + GUITEXTBOXMULTI_PADDING, bounds.y + GUITEXTBOXMULTI_PADDING, Fade(GetColor(style[TEXTBOX_TEXT_COLOR_PRESSED]), guiAlpha));
|
GuiDrawText(text, bounds.x + GUITEXTBOXMULTI_PADDING, bounds.y + GUITEXTBOXMULTI_PADDING, Fade(GetColor(style[TEXTBOX_TEXT_COLOR_PRESSED]), guiAlpha));
|
||||||
|
|
||||||
@ -2250,7 +2266,6 @@ RAYGUIDEF bool GuiTextBoxMulti(Rectangle bounds, char *text, int textSize, bool
|
|||||||
}
|
}
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case PRESSED: break; // NOTE: State not used on this control
|
|
||||||
case DISABLED:
|
case DISABLED:
|
||||||
{
|
{
|
||||||
DrawRectangleLinesEx(bounds, style[TEXTBOX_BORDER_WIDTH], Fade(GetColor(style[TEXTBOX_BORDER_COLOR_DISABLED]), guiAlpha));
|
DrawRectangleLinesEx(bounds, style[TEXTBOX_BORDER_WIDTH], Fade(GetColor(style[TEXTBOX_BORDER_COLOR_DISABLED]), guiAlpha));
|
||||||
@ -2276,7 +2291,7 @@ RAYGUIDEF float GuiSlider(Rectangle bounds, float value, float minValue, float m
|
|||||||
|
|
||||||
// Update control
|
// Update control
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
if ((state != DISABLED) && (state != LOCKED))
|
if ((state != DISABLED) && !guiLocked)
|
||||||
{
|
{
|
||||||
Vector2 mousePoint = GetMousePosition();
|
Vector2 mousePoint = GetMousePosition();
|
||||||
|
|
||||||
@ -2306,7 +2321,6 @@ RAYGUIDEF float GuiSlider(Rectangle bounds, float value, float minValue, float m
|
|||||||
switch (state)
|
switch (state)
|
||||||
{
|
{
|
||||||
case NORMAL:
|
case NORMAL:
|
||||||
case LOCKED:
|
|
||||||
{
|
{
|
||||||
DrawRectangleLinesEx(bounds, style[SLIDER_BORDER_WIDTH], Fade(GetColor(style[SLIDER_BORDER_COLOR_NORMAL]), guiAlpha));
|
DrawRectangleLinesEx(bounds, style[SLIDER_BORDER_WIDTH], Fade(GetColor(style[SLIDER_BORDER_COLOR_NORMAL]), guiAlpha));
|
||||||
DrawRectangle(bounds.x + style[SLIDER_BORDER_WIDTH], bounds.y + style[SLIDER_BORDER_WIDTH], bounds.width - 2*style[SLIDER_BORDER_WIDTH], bounds.height - 2*style[SLIDER_BORDER_WIDTH], Fade(GetColor(style[SLIDER_BASE_COLOR_NORMAL]), guiAlpha));
|
DrawRectangle(bounds.x + style[SLIDER_BORDER_WIDTH], bounds.y + style[SLIDER_BORDER_WIDTH], bounds.width - 2*style[SLIDER_BORDER_WIDTH], bounds.height - 2*style[SLIDER_BORDER_WIDTH], Fade(GetColor(style[SLIDER_BASE_COLOR_NORMAL]), guiAlpha));
|
||||||
@ -2356,7 +2370,7 @@ RAYGUIDEF float GuiSliderEx(Rectangle bounds, float value, float minValue, float
|
|||||||
|
|
||||||
// Update control
|
// Update control
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
if ((state != DISABLED) && (state != LOCKED))
|
if ((state != DISABLED) && !guiLocked)
|
||||||
{
|
{
|
||||||
Vector2 mousePoint = GetMousePosition();
|
Vector2 mousePoint = GetMousePosition();
|
||||||
|
|
||||||
@ -2392,7 +2406,6 @@ RAYGUIDEF float GuiSliderEx(Rectangle bounds, float value, float minValue, float
|
|||||||
switch (state)
|
switch (state)
|
||||||
{
|
{
|
||||||
case NORMAL:
|
case NORMAL:
|
||||||
case LOCKED:
|
|
||||||
{
|
{
|
||||||
DrawRectangleLinesEx(bounds, style[SLIDER_BORDER_WIDTH], Fade(GetColor(style[SLIDER_BORDER_COLOR_NORMAL]), guiAlpha));
|
DrawRectangleLinesEx(bounds, style[SLIDER_BORDER_WIDTH], Fade(GetColor(style[SLIDER_BORDER_COLOR_NORMAL]), guiAlpha));
|
||||||
DrawRectangle(bounds.x + style[SLIDER_BORDER_WIDTH], bounds.y + style[SLIDER_BORDER_WIDTH], bounds.width - 2*style[SLIDER_BORDER_WIDTH], bounds.height - 2*style[SLIDER_BORDER_WIDTH], Fade(GetColor(style[SLIDER_BASE_COLOR_NORMAL]), guiAlpha));
|
DrawRectangle(bounds.x + style[SLIDER_BORDER_WIDTH], bounds.y + style[SLIDER_BORDER_WIDTH], bounds.width - 2*style[SLIDER_BORDER_WIDTH], bounds.height - 2*style[SLIDER_BORDER_WIDTH], Fade(GetColor(style[SLIDER_BASE_COLOR_NORMAL]), guiAlpha));
|
||||||
@ -2445,7 +2458,7 @@ RAYGUIDEF float GuiSliderBar(Rectangle bounds, float value, float minValue, floa
|
|||||||
|
|
||||||
// Update control
|
// Update control
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
if ((state != DISABLED) && (state != LOCKED))
|
if ((state != DISABLED) && !guiLocked)
|
||||||
{
|
{
|
||||||
Vector2 mousePoint = GetMousePosition();
|
Vector2 mousePoint = GetMousePosition();
|
||||||
|
|
||||||
@ -2471,7 +2484,6 @@ RAYGUIDEF float GuiSliderBar(Rectangle bounds, float value, float minValue, floa
|
|||||||
switch (state)
|
switch (state)
|
||||||
{
|
{
|
||||||
case NORMAL:
|
case NORMAL:
|
||||||
case LOCKED:
|
|
||||||
{
|
{
|
||||||
DrawRectangleLinesEx(bounds, style[SLIDERBAR_BORDER_WIDTH], Fade(GetColor(style[SLIDERBAR_BORDER_COLOR_NORMAL]), guiAlpha));
|
DrawRectangleLinesEx(bounds, style[SLIDERBAR_BORDER_WIDTH], Fade(GetColor(style[SLIDERBAR_BORDER_COLOR_NORMAL]), guiAlpha));
|
||||||
DrawRectangle(bounds.x + style[SLIDERBAR_BORDER_WIDTH], bounds.y + style[SLIDERBAR_BORDER_WIDTH], bounds.width - 2*style[SLIDERBAR_BORDER_WIDTH], bounds.height - 2*style[SLIDERBAR_BORDER_WIDTH], Fade(GetColor(style[SLIDERBAR_BASE_COLOR_NORMAL]), guiAlpha));
|
DrawRectangle(bounds.x + style[SLIDERBAR_BORDER_WIDTH], bounds.y + style[SLIDERBAR_BORDER_WIDTH], bounds.width - 2*style[SLIDERBAR_BORDER_WIDTH], bounds.height - 2*style[SLIDERBAR_BORDER_WIDTH], Fade(GetColor(style[SLIDERBAR_BASE_COLOR_NORMAL]), guiAlpha));
|
||||||
@ -2517,7 +2529,7 @@ RAYGUIDEF float GuiSliderBarEx(Rectangle bounds, float value, float minValue, fl
|
|||||||
|
|
||||||
// Update control
|
// Update control
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
if ((state != DISABLED) && (state != LOCKED))
|
if ((state != DISABLED) && !guiLocked)
|
||||||
{
|
{
|
||||||
Vector2 mousePoint = GetMousePosition();
|
Vector2 mousePoint = GetMousePosition();
|
||||||
|
|
||||||
@ -2543,7 +2555,6 @@ RAYGUIDEF float GuiSliderBarEx(Rectangle bounds, float value, float minValue, fl
|
|||||||
switch (state)
|
switch (state)
|
||||||
{
|
{
|
||||||
case NORMAL:
|
case NORMAL:
|
||||||
case LOCKED:
|
|
||||||
{
|
{
|
||||||
DrawRectangleLinesEx(bounds, style[SLIDERBAR_BORDER_WIDTH], Fade(GetColor(style[SLIDERBAR_BORDER_COLOR_NORMAL]), guiAlpha));
|
DrawRectangleLinesEx(bounds, style[SLIDERBAR_BORDER_WIDTH], Fade(GetColor(style[SLIDERBAR_BORDER_COLOR_NORMAL]), guiAlpha));
|
||||||
DrawRectangle(bounds.x + style[SLIDERBAR_BORDER_WIDTH], bounds.y + style[SLIDERBAR_BORDER_WIDTH], bounds.width - 2*style[SLIDERBAR_BORDER_WIDTH], bounds.height - 2*style[SLIDERBAR_BORDER_WIDTH], Fade(GetColor(style[SLIDERBAR_BASE_COLOR_NORMAL]), guiAlpha));
|
DrawRectangle(bounds.x + style[SLIDERBAR_BORDER_WIDTH], bounds.y + style[SLIDERBAR_BORDER_WIDTH], bounds.width - 2*style[SLIDERBAR_BORDER_WIDTH], bounds.height - 2*style[SLIDERBAR_BORDER_WIDTH], Fade(GetColor(style[SLIDERBAR_BASE_COLOR_NORMAL]), guiAlpha));
|
||||||
@ -2608,7 +2619,6 @@ RAYGUIDEF float GuiProgressBar(Rectangle bounds, float value, float minValue, fl
|
|||||||
switch (state)
|
switch (state)
|
||||||
{
|
{
|
||||||
case NORMAL:
|
case NORMAL:
|
||||||
case LOCKED:
|
|
||||||
{
|
{
|
||||||
DrawRectangleLinesEx(bounds, style[PROGRESSBAR_BORDER_WIDTH], Fade(GetColor(style[PROGRESSBAR_BORDER_COLOR_NORMAL]), guiAlpha));
|
DrawRectangleLinesEx(bounds, style[PROGRESSBAR_BORDER_WIDTH], Fade(GetColor(style[PROGRESSBAR_BORDER_COLOR_NORMAL]), guiAlpha));
|
||||||
DrawRectangle(bounds.x + style[PROGRESSBAR_BORDER_WIDTH], bounds.y + style[PROGRESSBAR_BORDER_WIDTH], bounds.width - 2*style[PROGRESSBAR_BORDER_WIDTH], bounds.height - 2*style[PROGRESSBAR_BORDER_WIDTH], Fade(GetColor(style[DEFAULT_BACKGROUND_COLOR]), guiAlpha));
|
DrawRectangle(bounds.x + style[PROGRESSBAR_BORDER_WIDTH], bounds.y + style[PROGRESSBAR_BORDER_WIDTH], bounds.width - 2*style[PROGRESSBAR_BORDER_WIDTH], bounds.height - 2*style[PROGRESSBAR_BORDER_WIDTH], Fade(GetColor(style[DEFAULT_BACKGROUND_COLOR]), guiAlpha));
|
||||||
@ -2660,7 +2670,6 @@ RAYGUIDEF float GuiProgressBarEx(Rectangle bounds, float value, float minValue,
|
|||||||
switch (state)
|
switch (state)
|
||||||
{
|
{
|
||||||
case NORMAL:
|
case NORMAL:
|
||||||
case LOCKED:
|
|
||||||
{
|
{
|
||||||
DrawRectangleLinesEx(bounds, style[PROGRESSBAR_BORDER_WIDTH], Fade(GetColor(style[PROGRESSBAR_BORDER_COLOR_NORMAL]), guiAlpha));
|
DrawRectangleLinesEx(bounds, style[PROGRESSBAR_BORDER_WIDTH], Fade(GetColor(style[PROGRESSBAR_BORDER_COLOR_NORMAL]), guiAlpha));
|
||||||
DrawRectangle(bounds.x + style[PROGRESSBAR_BORDER_WIDTH], bounds.y + style[PROGRESSBAR_BORDER_WIDTH], bounds.width - 2*style[PROGRESSBAR_BORDER_WIDTH], bounds.height - 2*style[PROGRESSBAR_BORDER_WIDTH], Fade(GetColor(style[DEFAULT_BACKGROUND_COLOR]), guiAlpha));
|
DrawRectangle(bounds.x + style[PROGRESSBAR_BORDER_WIDTH], bounds.y + style[PROGRESSBAR_BORDER_WIDTH], bounds.width - 2*style[PROGRESSBAR_BORDER_WIDTH], bounds.height - 2*style[PROGRESSBAR_BORDER_WIDTH], Fade(GetColor(style[DEFAULT_BACKGROUND_COLOR]), guiAlpha));
|
||||||
@ -2699,7 +2708,6 @@ RAYGUIDEF void GuiStatusBar(Rectangle bounds, const char *text, int offsetX)
|
|||||||
switch (state)
|
switch (state)
|
||||||
{
|
{
|
||||||
case NORMAL:
|
case NORMAL:
|
||||||
case LOCKED:
|
|
||||||
case FOCUSED:
|
case FOCUSED:
|
||||||
case PRESSED:
|
case PRESSED:
|
||||||
{
|
{
|
||||||
@ -2730,7 +2738,7 @@ RAYGUIDEF void GuiDummyRec(Rectangle bounds, const char *text)
|
|||||||
|
|
||||||
// Update control
|
// Update control
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
if ((state != DISABLED) && (state != LOCKED))
|
if ((state != DISABLED) && !guiLocked)
|
||||||
{
|
{
|
||||||
Vector2 mousePoint = GetMousePosition();
|
Vector2 mousePoint = GetMousePosition();
|
||||||
|
|
||||||
@ -2748,7 +2756,6 @@ RAYGUIDEF void GuiDummyRec(Rectangle bounds, const char *text)
|
|||||||
switch (state)
|
switch (state)
|
||||||
{
|
{
|
||||||
case NORMAL:
|
case NORMAL:
|
||||||
case LOCKED:
|
|
||||||
case FOCUSED:
|
case FOCUSED:
|
||||||
case PRESSED:
|
case PRESSED:
|
||||||
{
|
{
|
||||||
@ -2779,10 +2786,11 @@ static bool GuiListElement(Rectangle bounds, const char *text, bool active, bool
|
|||||||
int textWidth = GuiTextWidth(text);
|
int textWidth = GuiTextWidth(text);
|
||||||
int textHeight = style[DEFAULT_TEXT_SIZE];
|
int textHeight = style[DEFAULT_TEXT_SIZE];
|
||||||
|
|
||||||
if (state == LOCKED && editMode) state = NORMAL;
|
if (!guiLocked && editMode) state = NORMAL;
|
||||||
|
|
||||||
// Update control
|
// Update control
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
if ((state != DISABLED) && (state != LOCKED))
|
if ((state != DISABLED) && !guiLocked)
|
||||||
{
|
{
|
||||||
if (bounds.width < textWidth)
|
if (bounds.width < textWidth)
|
||||||
{
|
{
|
||||||
@ -2816,7 +2824,6 @@ static bool GuiListElement(Rectangle bounds, const char *text, bool active, bool
|
|||||||
switch (state)
|
switch (state)
|
||||||
{
|
{
|
||||||
case NORMAL:
|
case NORMAL:
|
||||||
case LOCKED:
|
|
||||||
{
|
{
|
||||||
if (active)
|
if (active)
|
||||||
{
|
{
|
||||||
@ -2882,13 +2889,13 @@ RAYGUIDEF bool GuiListView(Rectangle bounds, const char **text, int count, int *
|
|||||||
|
|
||||||
// Update control
|
// Update control
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
if ((state != DISABLED) && (state != LOCKED))
|
if ((state != DISABLED) && !guiLocked) // && !guiLocked
|
||||||
{
|
{
|
||||||
Vector2 mousePoint = GetMousePosition();
|
Vector2 mousePoint = GetMousePosition();
|
||||||
|
|
||||||
if (editMode)
|
if (editMode)
|
||||||
{
|
{
|
||||||
state = FOCUSED;
|
state = PRESSED;
|
||||||
|
|
||||||
// Change active with keys
|
// Change active with keys
|
||||||
if (IsKeyPressed(KEY_UP))
|
if (IsKeyPressed(KEY_UP))
|
||||||
@ -2939,7 +2946,23 @@ RAYGUIDEF bool GuiListView(Rectangle bounds, const char **text, int count, int *
|
|||||||
// Note: Changing editMode
|
// Note: Changing editMode
|
||||||
if (!editMode)
|
if (!editMode)
|
||||||
{
|
{
|
||||||
if (CheckCollisionPointRec(mousePoint, bounds) && IsMouseButtonPressed(0)) pressed = true;
|
if (CheckCollisionPointRec(mousePoint, bounds))
|
||||||
|
{
|
||||||
|
state = FOCUSED;
|
||||||
|
if (IsMouseButtonPressed(0)) pressed = true;
|
||||||
|
|
||||||
|
int wheel = GetMouseWheelMove();
|
||||||
|
if (wheel)
|
||||||
|
{
|
||||||
|
startIndex -= wheel;
|
||||||
|
if (startIndex < 0) startIndex = 0;
|
||||||
|
else if (startIndex > (count - (endIndex - startIndex)))
|
||||||
|
{
|
||||||
|
startIndex = count - (endIndex - startIndex);
|
||||||
|
}
|
||||||
|
pressed = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -2984,22 +3007,25 @@ RAYGUIDEF bool GuiListView(Rectangle bounds, const char **text, int count, int *
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Draw scrollBar background
|
// Draw scrollBar background
|
||||||
if (useScrollBar) DrawRectangle(bounds.x, bounds.y, style[LISTVIEW_BAR_WIDTH], bounds.height, Fade(LIGHTGRAY, guiAlpha));
|
if (useScrollBar) DrawRectangle(bounds.x, bounds.y, style[LISTVIEW_BAR_WIDTH], bounds.height, Fade(GetColor(style[DEFAULT_BORDER_COLOR_DISABLED]), guiAlpha));
|
||||||
|
|
||||||
// Draw ListView states
|
// Draw ListView states
|
||||||
switch (state)
|
switch (state)
|
||||||
{
|
{
|
||||||
case NORMAL:
|
case NORMAL:
|
||||||
case LOCKED:
|
|
||||||
{
|
{
|
||||||
if (useScrollBar) DrawRectangle(bounds.x, barPosY, style[LISTVIEW_BAR_WIDTH], barHeight, Fade(GetColor(style[SLIDERBAR_BORDER_COLOR_NORMAL]), guiAlpha));
|
if (useScrollBar) DrawRectangle(bounds.x, barPosY, style[LISTVIEW_BAR_WIDTH], barHeight, Fade(GetColor(style[SLIDERBAR_BORDER_COLOR_NORMAL]), guiAlpha));
|
||||||
DrawRectangleLinesEx(bounds, LISTVIEW_LINE_THICK, Fade(GetColor(style[LISTVIEW_BORDER_COLOR_NORMAL]), guiAlpha));
|
DrawRectangleLinesEx(bounds, LISTVIEW_LINE_THICK, Fade(GetColor(style[LISTVIEW_BORDER_COLOR_NORMAL]), guiAlpha));
|
||||||
|
|
||||||
|
if(auxActive >= startIndex && auxActive < endIndex) GuiListElement((Rectangle){ posX, bounds.y + style[LISTVIEW_ELEMENTS_PADDING] + LISTVIEW_LINE_THICK + (auxActive - startIndex)*(style[LISTVIEW_ELEMENTS_HEIGHT] + style[LISTVIEW_ELEMENTS_PADDING]), elementWidth, style[LISTVIEW_ELEMENTS_HEIGHT] }, text[auxActive], true, false);
|
||||||
} break;
|
} break;
|
||||||
case FOCUSED:
|
case FOCUSED:
|
||||||
{
|
{
|
||||||
if (useScrollBar) DrawRectangle(bounds.x, barPosY, style[LISTVIEW_BAR_WIDTH], barHeight, Fade(GetColor(style[SLIDERBAR_BASE_COLOR_FOCUSED]), guiAlpha));
|
if (useScrollBar) DrawRectangle(bounds.x, barPosY, style[LISTVIEW_BAR_WIDTH], barHeight, Fade(GetColor(style[SLIDERBAR_BASE_COLOR_FOCUSED]), guiAlpha));
|
||||||
|
|
||||||
DrawRectangleLinesEx(bounds, LISTVIEW_LINE_THICK, Fade(GetColor(style[LISTVIEW_BORDER_COLOR_FOCUSED]), guiAlpha));
|
DrawRectangleLinesEx(bounds, LISTVIEW_LINE_THICK, Fade(GetColor(style[LISTVIEW_BORDER_COLOR_FOCUSED]), guiAlpha));
|
||||||
|
|
||||||
|
if(auxActive >= startIndex && auxActive < endIndex) GuiListElement((Rectangle){ posX, bounds.y + style[LISTVIEW_ELEMENTS_PADDING] + LISTVIEW_LINE_THICK + (auxActive - startIndex)*(style[LISTVIEW_ELEMENTS_HEIGHT] + style[LISTVIEW_ELEMENTS_PADDING]), elementWidth, style[LISTVIEW_ELEMENTS_HEIGHT] }, text[auxActive], true, false);
|
||||||
} break;
|
} break;
|
||||||
case PRESSED:
|
case PRESSED:
|
||||||
{
|
{
|
||||||
@ -3042,7 +3068,7 @@ RAYGUIDEF Color GuiColorPanel(Rectangle bounds, Color color)
|
|||||||
|
|
||||||
// Update control
|
// Update control
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
if ((state != DISABLED) && (state != LOCKED))
|
if ((state != DISABLED) && !guiLocked)
|
||||||
{
|
{
|
||||||
Vector2 mousePoint = GetMousePosition();
|
Vector2 mousePoint = GetMousePosition();
|
||||||
|
|
||||||
@ -3078,7 +3104,7 @@ RAYGUIDEF Color GuiColorPanel(Rectangle bounds, Color color)
|
|||||||
|
|
||||||
// Draw control
|
// Draw control
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
if ((state != DISABLED) && (state != LOCKED))
|
if ((state != DISABLED) && !guiLocked)
|
||||||
{
|
{
|
||||||
DrawRectangleGradientEx(bounds, Fade(WHITE, guiAlpha), Fade(WHITE, guiAlpha), Fade(maxHueCol, guiAlpha), Fade(maxHueCol, guiAlpha));
|
DrawRectangleGradientEx(bounds, Fade(WHITE, guiAlpha), Fade(WHITE, guiAlpha), Fade(maxHueCol, guiAlpha), Fade(maxHueCol, guiAlpha));
|
||||||
DrawRectangleGradientEx(bounds, Fade(BLACK, 0), Fade(BLACK, guiAlpha), Fade(BLACK, guiAlpha), Fade(BLACK, 0));
|
DrawRectangleGradientEx(bounds, Fade(BLACK, 0), Fade(BLACK, guiAlpha), Fade(BLACK, guiAlpha), Fade(BLACK, 0));
|
||||||
@ -3095,7 +3121,7 @@ RAYGUIDEF Color GuiColorPanel(Rectangle bounds, Color color)
|
|||||||
|
|
||||||
switch (state)
|
switch (state)
|
||||||
{
|
{
|
||||||
case NORMAL: case LOCKED: DrawRectangleLines(bounds.x, bounds.y, bounds.width, bounds.height, Fade(GetColor(style[COLORPICKER_BORDER_COLOR_NORMAL]), guiAlpha)); break;
|
case NORMAL: DrawRectangleLines(bounds.x, bounds.y, bounds.width, bounds.height, Fade(GetColor(style[COLORPICKER_BORDER_COLOR_NORMAL]), guiAlpha)); break;
|
||||||
case FOCUSED: DrawRectangleLines(bounds.x, bounds.y, bounds.width, bounds.height, Fade(GetColor(style[COLORPICKER_BORDER_COLOR_FOCUSED]), guiAlpha)); break;
|
case FOCUSED: DrawRectangleLines(bounds.x, bounds.y, bounds.width, bounds.height, Fade(GetColor(style[COLORPICKER_BORDER_COLOR_FOCUSED]), guiAlpha)); break;
|
||||||
case PRESSED: DrawRectangleLines(bounds.x, bounds.y, bounds.width, bounds.height, Fade(GetColor(style[COLORPICKER_BORDER_COLOR_PRESSED]), guiAlpha)); break;
|
case PRESSED: DrawRectangleLines(bounds.x, bounds.y, bounds.width, bounds.height, Fade(GetColor(style[COLORPICKER_BORDER_COLOR_PRESSED]), guiAlpha)); break;
|
||||||
case DISABLED: DrawRectangleLines(bounds.x, bounds.y, bounds.width, bounds.height, Fade(GetColor(style[COLORPICKER_BORDER_COLOR_DISABLED]), guiAlpha)); break;
|
case DISABLED: DrawRectangleLines(bounds.x, bounds.y, bounds.width, bounds.height, Fade(GetColor(style[COLORPICKER_BORDER_COLOR_DISABLED]), guiAlpha)); break;
|
||||||
@ -3121,7 +3147,7 @@ RAYGUIDEF float GuiColorBarAlpha(Rectangle bounds, float alpha)
|
|||||||
|
|
||||||
// Update control
|
// Update control
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
if ((state != DISABLED) && (state != LOCKED))
|
if ((state != DISABLED) && !guiLocked)
|
||||||
{
|
{
|
||||||
Vector2 mousePoint = GetMousePosition();
|
Vector2 mousePoint = GetMousePosition();
|
||||||
|
|
||||||
@ -3146,7 +3172,7 @@ RAYGUIDEF float GuiColorBarAlpha(Rectangle bounds, float alpha)
|
|||||||
// Draw control
|
// Draw control
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
// Draw alpha bar: checked background
|
// Draw alpha bar: checked background
|
||||||
if ((state != DISABLED) && (state != LOCKED))
|
if ((state != DISABLED) && !guiLocked)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < bounds.width/CHECKER_SIZE; i++) DrawRectangle(bounds.x + CHECKER_SIZE*(i%((int)bounds.width/CHECKER_SIZE)), bounds.y, bounds.width/(bounds.width/CHECKER_SIZE), CHECKER_SIZE, (i%2) ? Fade(Fade(GRAY, 0.4f), guiAlpha) : Fade(Fade(RAYWHITE, 0.4f), guiAlpha));
|
for (int i = 0; i < bounds.width/CHECKER_SIZE; i++) DrawRectangle(bounds.x + CHECKER_SIZE*(i%((int)bounds.width/CHECKER_SIZE)), bounds.y, bounds.width/(bounds.width/CHECKER_SIZE), CHECKER_SIZE, (i%2) ? Fade(Fade(GRAY, 0.4f), guiAlpha) : Fade(Fade(RAYWHITE, 0.4f), guiAlpha));
|
||||||
for (int i = 0; i < bounds.width/CHECKER_SIZE; i++) DrawRectangle(bounds.x + CHECKER_SIZE*(i%((int)bounds.width/CHECKER_SIZE)), bounds.y + CHECKER_SIZE, bounds.width/(bounds.width/CHECKER_SIZE), CHECKER_SIZE, (i%2) ? Fade(Fade(RAYWHITE, 0.4f), guiAlpha) : Fade(Fade(GRAY, 0.4f), guiAlpha));
|
for (int i = 0; i < bounds.width/CHECKER_SIZE; i++) DrawRectangle(bounds.x + CHECKER_SIZE*(i%((int)bounds.width/CHECKER_SIZE)), bounds.y + CHECKER_SIZE, bounds.width/(bounds.width/CHECKER_SIZE), CHECKER_SIZE, (i%2) ? Fade(Fade(RAYWHITE, 0.4f), guiAlpha) : Fade(Fade(GRAY, 0.4f), guiAlpha));
|
||||||
@ -3158,7 +3184,6 @@ RAYGUIDEF float GuiColorBarAlpha(Rectangle bounds, float alpha)
|
|||||||
switch (state)
|
switch (state)
|
||||||
{
|
{
|
||||||
case NORMAL:
|
case NORMAL:
|
||||||
case LOCKED:
|
|
||||||
{
|
{
|
||||||
DrawRectangleLines(bounds.x, bounds.y, bounds.width, bounds.height, Fade(GetColor(style[COLORPICKER_BORDER_COLOR_NORMAL]), guiAlpha));
|
DrawRectangleLines(bounds.x, bounds.y, bounds.width, bounds.height, Fade(GetColor(style[COLORPICKER_BORDER_COLOR_NORMAL]), guiAlpha));
|
||||||
DrawRectangle(selector.x , selector.y, selector.width, selector.height, Fade(GetColor(style[COLORPICKER_BORDER_COLOR_PRESSED]), guiAlpha));
|
DrawRectangle(selector.x , selector.y, selector.width, selector.height, Fade(GetColor(style[COLORPICKER_BORDER_COLOR_PRESSED]), guiAlpha));
|
||||||
@ -3197,7 +3222,7 @@ RAYGUIDEF float GuiColorBarHue(Rectangle bounds, float hue)
|
|||||||
|
|
||||||
// Update control
|
// Update control
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
if ((state != DISABLED) && (state != LOCKED))
|
if ((state != DISABLED) && !guiLocked)
|
||||||
{
|
{
|
||||||
Vector2 mousePoint = GetMousePosition();
|
Vector2 mousePoint = GetMousePosition();
|
||||||
|
|
||||||
@ -3231,7 +3256,7 @@ RAYGUIDEF float GuiColorBarHue(Rectangle bounds, float hue)
|
|||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
// Draw control
|
// Draw control
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
if ((state != DISABLED) && (state != LOCKED))
|
if ((state != DISABLED) && !guiLocked)
|
||||||
{
|
{
|
||||||
//Draw hue bar:color bars
|
//Draw hue bar:color bars
|
||||||
DrawRectangleGradientV(bounds.x + GUICOLORBARHUE_SELECTOR_PADDING/2, bounds.y + GUICOLORBARHUE_SELECTOR_PADDING/2, bounds.width - GUICOLORBARHUE_SELECTOR_PADDING, (int)bounds.height/6, Fade((Color){ 255,0,0,255 }, guiAlpha), Fade((Color){ 255,255,0,255 }, guiAlpha));
|
DrawRectangleGradientV(bounds.x + GUICOLORBARHUE_SELECTOR_PADDING/2, bounds.y + GUICOLORBARHUE_SELECTOR_PADDING/2, bounds.width - GUICOLORBARHUE_SELECTOR_PADDING, (int)bounds.height/6, Fade((Color){ 255,0,0,255 }, guiAlpha), Fade((Color){ 255,255,0,255 }, guiAlpha));
|
||||||
@ -3249,7 +3274,6 @@ RAYGUIDEF float GuiColorBarHue(Rectangle bounds, float hue)
|
|||||||
switch (state)
|
switch (state)
|
||||||
{
|
{
|
||||||
case NORMAL:
|
case NORMAL:
|
||||||
case LOCKED:
|
|
||||||
{
|
{
|
||||||
// Draw hue bar: selector
|
// Draw hue bar: selector
|
||||||
DrawRectangleLines(bounds.x, bounds.y, bounds.width, bounds.height, Fade(GetColor(style[COLORPICKER_BORDER_COLOR_NORMAL]), guiAlpha));
|
DrawRectangleLines(bounds.x, bounds.y, bounds.width, bounds.height, Fade(GetColor(style[COLORPICKER_BORDER_COLOR_NORMAL]), guiAlpha));
|
||||||
@ -3349,7 +3373,7 @@ RAYGUIDEF Vector2 GuiGrid(Rectangle bounds, int spacing, int subdivs)
|
|||||||
|
|
||||||
// Update control
|
// Update control
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
if ((state != DISABLED) && (state != LOCKED))
|
if ((state != DISABLED) && !guiLocked)
|
||||||
{
|
{
|
||||||
// Check mouse position if snap
|
// Check mouse position if snap
|
||||||
if (CheckCollisionPointRec(mousePoint, bounds))
|
if (CheckCollisionPointRec(mousePoint, bounds))
|
||||||
@ -3365,7 +3389,6 @@ RAYGUIDEF Vector2 GuiGrid(Rectangle bounds, int spacing, int subdivs)
|
|||||||
switch (state)
|
switch (state)
|
||||||
{
|
{
|
||||||
case NORMAL:
|
case NORMAL:
|
||||||
case LOCKED:
|
|
||||||
{
|
{
|
||||||
// Draw vertical grid lines
|
// Draw vertical grid lines
|
||||||
for (int i = 0; i < (bounds.width/spacing + 1)*subdivs; i++)
|
for (int i = 0; i < (bounds.width/spacing + 1)*subdivs; i++)
|
||||||
|
|||||||
Reference in New Issue
Block a user