mirror of
https://github.com/raysan5/raygui.git
synced 2025-12-25 10:22:33 -05:00
Some tweaks
This commit is contained in:
6
raygui.h
6
raygui.h
@ -425,8 +425,8 @@ static int style[NUM_PROPERTIES] = {
|
|||||||
0xffffffff, // CHECKBOX_HOVER_INSIDE_COLOR
|
0xffffffff, // CHECKBOX_HOVER_INSIDE_COLOR
|
||||||
0x66e7ffff, // CHECKBOX_CLICK_BORDER_COLOR
|
0x66e7ffff, // CHECKBOX_CLICK_BORDER_COLOR
|
||||||
0xddf5ffff, // CHECKBOX_CLICK_INSIDE_COLOR
|
0xddf5ffff, // CHECKBOX_CLICK_INSIDE_COLOR
|
||||||
0x7bb0d6ff, // CHECKBOX_STATUS_ACTIVE_COLOR
|
0xbcecffff, // CHECKBOX_STATUS_ACTIVE_COLOR
|
||||||
4, // CHECKBOX_INSIDE_WIDTH
|
1, // CHECKBOX_INSIDE_WIDTH
|
||||||
1, // TEXTBOX_BORDER_WIDTH
|
1, // TEXTBOX_BORDER_WIDTH
|
||||||
0x828282ff, // TEXTBOX_BORDER_COLOR
|
0x828282ff, // TEXTBOX_BORDER_COLOR
|
||||||
0xf5f5f5ff, // TEXTBOX_INSIDE_COLOR
|
0xf5f5f5ff, // TEXTBOX_INSIDE_COLOR
|
||||||
@ -939,7 +939,7 @@ RAYGUIDEF int GuiComboBox(Rectangle bounds, int comboNum, char **comboText, int
|
|||||||
if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON))
|
if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON))
|
||||||
{
|
{
|
||||||
comboActive += 1;
|
comboActive += 1;
|
||||||
if(comboActive >= comboNum) comboActive = 0;
|
if (comboActive >= comboNum) comboActive = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -67,16 +67,16 @@ int main()
|
|||||||
|
|
||||||
// Defines if the property to change is a Color or a value to update it accordingly
|
// Defines if the property to change is a Color or a value to update it accordingly
|
||||||
// NOTE: 0 - Color, 1 - value
|
// NOTE: 0 - Color, 1 - value
|
||||||
const unsigned char guiPropertyType[NUM_PROPERTIES] = { 0, 0, 0, 1, 1, 0, 1, 0, 1, 1,
|
const unsigned char guiPropertyType[NUM_PROPERTIES] = { 0, 0, 0, 1, 1, 0, 1, 1, 0, 1,
|
||||||
1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
||||||
1, 1, 0, 0, 0, 0, 0, 0, 0, 0,
|
1, 1, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 1, 1, 1, 0, 0, 0,
|
0, 1, 1, 0, 0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 1, 1, 1, 0, 0,
|
||||||
0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 1, 1, 1, 1,
|
0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0, 0, 1, 1, 1,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
0, 1, 1, 0, 0, 0, 0, 1 };
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 1, 1, 0, 0, 0, 0, 1 };
|
||||||
int aux = 0;
|
int aux = 0;
|
||||||
int guiPropertyPos[NUM_ELEMENTS];
|
int guiPropertyPos[NUM_ELEMENTS];
|
||||||
|
|
||||||
@ -139,19 +139,19 @@ int main()
|
|||||||
int sizeCursor = 16; // size must be POT
|
int sizeCursor = 16; // size must be POT
|
||||||
unsigned char *cursorData = (unsigned char *)malloc(sizeCursor*sizeCursor*2*sizeof(unsigned char));
|
unsigned char *cursorData = (unsigned char *)malloc(sizeCursor*sizeCursor*2*sizeof(unsigned char));
|
||||||
|
|
||||||
for(int w = 0; w < sizeCursor; w++)
|
for (int w = 0; w < sizeCursor; w++)
|
||||||
{
|
{
|
||||||
for (int h = 0; h < sizeCursor; h++)
|
for (int h = 0; h < sizeCursor; h++)
|
||||||
{
|
{
|
||||||
cursorData[w*sizeCursor*2 + 2*h] = 0;
|
cursorData[w*sizeCursor*2 + 2*h] = 0;
|
||||||
if((sizeCursor%2) == 0)
|
if ((sizeCursor%2) == 0)
|
||||||
{
|
{
|
||||||
if(((w == (sizeCursor/2 - 1)) || (w == sizeCursor/2)) && ((h == (sizeCursor/2 - 1)) || (h == sizeCursor/2)))
|
if (((w == (sizeCursor/2 - 1)) || (w == sizeCursor/2)) && ((h == (sizeCursor/2 - 1)) || (h == sizeCursor/2)))
|
||||||
{
|
{
|
||||||
cursorData[w*sizeCursor*2 + 2*h + 1] = 0;
|
cursorData[w*sizeCursor*2 + 2*h + 1] = 0;
|
||||||
}
|
}
|
||||||
else if((w == (sizeCursor/2 - 1)) || (w == sizeCursor/2)) cursorData[w*sizeCursor*2 + 2*h + 1] = 255;
|
else if ((w == (sizeCursor/2 - 1)) || (w == sizeCursor/2)) cursorData[w*sizeCursor*2 + 2*h + 1] = 255;
|
||||||
else if((h == (sizeCursor/2 - 1)) || (h == sizeCursor/2)) cursorData[w*sizeCursor*2 + 2*h + 1] = 255;
|
else if ((h == (sizeCursor/2 - 1)) || (h == sizeCursor/2)) cursorData[w*sizeCursor*2 + 2*h + 1] = 255;
|
||||||
else cursorData[w*sizeCursor*2 + 2*h + 1] = 0;
|
else cursorData[w*sizeCursor*2 + 2*h + 1] = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -368,7 +368,8 @@ int main()
|
|||||||
blueValue = colorPickerValue.b;
|
blueValue = colorPickerValue.b;
|
||||||
alphaValue = colorPickerValue.a;
|
alphaValue = colorPickerValue.a;
|
||||||
}
|
}
|
||||||
if (IsMouseButtonUp(MOUSE_LEFT_BUTTON)) if(IsCursorHidden()) ShowCursor();
|
|
||||||
|
if (IsMouseButtonUp(MOUSE_LEFT_BUTTON) && IsCursorHidden()) ShowCursor();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -394,7 +395,7 @@ int main()
|
|||||||
{
|
{
|
||||||
colorSelectedHover = true;
|
colorSelectedHover = true;
|
||||||
|
|
||||||
if(IsMouseButtonDown (MOUSE_RIGHT_BUTTON)) colorSample[sampleSelected] = colorPickerValue;
|
if (IsMouseButtonDown (MOUSE_RIGHT_BUTTON)) colorSample[sampleSelected] = colorPickerValue;
|
||||||
}
|
}
|
||||||
else colorSelectedHover = false;
|
else colorSelectedHover = false;
|
||||||
|
|
||||||
@ -546,7 +547,7 @@ int main()
|
|||||||
//DrawRectangleV(GetMousePosition(), (Vector2){ 4, 4 }, RED);
|
//DrawRectangleV(GetMousePosition(), (Vector2){ 4, 4 }, RED);
|
||||||
|
|
||||||
// -- Color value result
|
// -- Color value result
|
||||||
if(colorSelectedHover) DrawRectangle(colorPickerPos.x - 3, colorPickerPos.y - 3 + colorPickerTexture.height + 2*rgbDelta, 2*rgbWidthLabel + 6, 2*rgbWidthLabel + 6, BLACK);
|
if (colorSelectedHover) DrawRectangle(colorPickerPos.x - 3, colorPickerPos.y - 3 + colorPickerTexture.height + 2*rgbDelta, 2*rgbWidthLabel + 6, 2*rgbWidthLabel + 6, BLACK);
|
||||||
else DrawRectangle(colorPickerPos.x - 2, colorPickerPos.y - 2 + colorPickerTexture.height + 2*rgbDelta, 2*rgbWidthLabel + 4, 2*rgbWidthLabel + 4, Fade(COLOR_REC, 0.8f));
|
else DrawRectangle(colorPickerPos.x - 2, colorPickerPos.y - 2 + colorPickerTexture.height + 2*rgbDelta, 2*rgbWidthLabel + 4, 2*rgbWidthLabel + 4, Fade(COLOR_REC, 0.8f));
|
||||||
DrawRectangleRec (colorSelectedBoundsRec, WHITE);
|
DrawRectangleRec (colorSelectedBoundsRec, WHITE);
|
||||||
DrawRectangleRec (colorSelectedBoundsRec, colorPickerValue);
|
DrawRectangleRec (colorSelectedBoundsRec, colorPickerValue);
|
||||||
@ -589,7 +590,7 @@ int main()
|
|||||||
// -- Load and Save buttons
|
// -- Load and Save buttons
|
||||||
if (GuiButton((Rectangle){ colorPickerPos.x, screenHeight - 3*rgbWidthLabel - rgbDelta - STATUS_BAR_HEIGHT, colorPickerTexture.width, rgbWidthLabel}, "Load Style"))
|
if (GuiButton((Rectangle){ colorPickerPos.x, screenHeight - 3*rgbWidthLabel - rgbDelta - STATUS_BAR_HEIGHT, colorPickerTexture.width, rgbWidthLabel}, "Load Style"))
|
||||||
{
|
{
|
||||||
fileName = tinyfd_openFileDialog( "", "name.style", 0, NULL, NULL, 0);
|
fileName = tinyfd_openFileDialog("", "name.style", 0, NULL, NULL, 0);
|
||||||
|
|
||||||
if (fileName == NULL) fileName = "";
|
if (fileName == NULL) fileName = "";
|
||||||
else
|
else
|
||||||
@ -601,7 +602,7 @@ int main()
|
|||||||
|
|
||||||
if (GuiButton((Rectangle){ colorPickerPos.x, screenHeight - 2*rgbWidthLabel - STATUS_BAR_HEIGHT, colorPickerTexture.width, rgbWidthLabel}, "Save Style"))
|
if (GuiButton((Rectangle){ colorPickerPos.x, screenHeight - 2*rgbWidthLabel - STATUS_BAR_HEIGHT, colorPickerTexture.width, rgbWidthLabel}, "Save Style"))
|
||||||
{
|
{
|
||||||
fileName = tinyfd_saveFileDialog( "", "name.style", 0, NULL, NULL);
|
fileName = tinyfd_saveFileDialog("", "name.style", 0, NULL, NULL);
|
||||||
|
|
||||||
if (fileName == NULL) fileName = "";
|
if (fileName == NULL) fileName = "";
|
||||||
else saveStyle = true;
|
else saveStyle = true;
|
||||||
|
|||||||
Reference in New Issue
Block a user