mirror of
https://github.com/raysan5/raygui.git
synced 2025-12-25 10:22:33 -05:00
Compare commits
24 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| aa81c167f1 | |||
| 37992af28a | |||
| 9cf37c5e51 | |||
| 60e216283d | |||
| 7f46aa5929 | |||
| b54733ec12 | |||
| 7da92d224d | |||
| 1c7ceb6fda | |||
| 251f7fde3a | |||
| 80e802b18d | |||
| 6fc9337cd8 | |||
| 38a3d100e1 | |||
| 628f2e0290 | |||
| ab209bc5d1 | |||
| 8c14e61214 | |||
| 27caba8834 | |||
| 31b097ee3e | |||
| b0d7073551 | |||
| 731bae72d5 | |||
| 4ad311bd6f | |||
| c4d71e1c0b | |||
| d04c68b915 | |||
| 42aaec6640 | |||
| d05586ef0f |
@ -28,12 +28,12 @@
|
||||
### basic controls
|
||||
```
|
||||
Label | Button | LabelButton | Toggle | ToggleGroup | CheckBox
|
||||
ComboBox | DropdownBox | TextBox | TextBoxMulti | ValueBox | Spinner
|
||||
ComboBox | DropdownBox | TextBox | ValueBox | Spinner
|
||||
Slider | SliderBar | ProgressBar | StatusBar | DummyRec | Grid
|
||||
```
|
||||
### container/separator controls
|
||||
```
|
||||
WindowBox | GroupBox | Line | Panel | ScrollPanel
|
||||
WindowBox | GroupBox | Line | Panel | ScrollPanel | TabBar
|
||||
```
|
||||
### advanced controls
|
||||
```
|
||||
|
||||
@ -144,7 +144,7 @@ int main()
|
||||
// raygui: controls drawing
|
||||
//----------------------------------------------------------------------------------
|
||||
// Check all possible events that require GuiLock
|
||||
if (dropDown000EditMode ||
|
||||
if (dropDown000EditMode ||
|
||||
dropDown001EditMode) GuiLock();
|
||||
|
||||
// First GUI column
|
||||
|
||||
@ -29,11 +29,11 @@ float GuiVerticalSliderPro(Rectangle bounds, const char *textTop, const char *te
|
||||
|
||||
bool GuiSliderOwning(Rectangle bounds, const char *textLeft, const char *textRight, float *value, float minValue, float maxValue, bool editMode);
|
||||
bool GuiSliderBarOwning(Rectangle bounds, const char *textLeft, const char *textRight, float *value, float minValue, float maxValue, bool editMode);
|
||||
float GuiSliderProOwning(Rectangle bounds, const char *textLeft, const char *textRight, float *value, float minValue, float maxValue, int sliderWidth, bool editMode);
|
||||
bool GuiSliderProOwning(Rectangle bounds, const char *textLeft, const char *textRight, float *value, float minValue, float maxValue, int sliderWidth, bool editMode);
|
||||
|
||||
bool GuiVerticalSliderOwning(Rectangle bounds, const char *textTop, const char *textBottom, float *value, float minValue, float maxValue, bool editMode);
|
||||
bool GuiVerticalSliderBarOwning(Rectangle bounds, const char *textTop, const char *textBottom, float *value, float minValue, float maxValue, bool editMode);
|
||||
float GuiVerticalSliderProOwning(Rectangle bounds, const char *textTop, const char *textBottom, float *value, float minValue, float maxValue, int sliderHeight, bool editMode);
|
||||
bool GuiVerticalSliderProOwning(Rectangle bounds, const char *textTop, const char *textBottom, float *value, float minValue, float maxValue, int sliderHeight, bool editMode);
|
||||
|
||||
//------------------------------------------------------------------------------------
|
||||
// Program main entry point
|
||||
@ -67,7 +67,7 @@ int main()
|
||||
//----------------------------------------------------------------------------------
|
||||
BeginDrawing();
|
||||
|
||||
ClearBackground(GetColor(GuiGetStyle(DEFAULT, BACKGROUND_COLOR)));
|
||||
ClearBackground(GetColor(GuiGetStyle(DEFAULT, BACKGROUND_COLOR)));
|
||||
|
||||
if (vSliderEditMode || vSliderBarEditMode) GuiLock();
|
||||
else GuiUnlock();
|
||||
@ -106,13 +106,13 @@ float GuiVerticalSliderPro(Rectangle bounds, const char *textTop, const char *te
|
||||
|
||||
int sliderValue = (int)(((value - minValue)/(maxValue - minValue)) * (bounds.height - 2 * GuiGetStyle(SLIDER, BORDER_WIDTH)));
|
||||
|
||||
Rectangle slider = {
|
||||
bounds.x + GuiGetStyle(SLIDER, BORDER_WIDTH) + GuiGetStyle(SLIDER, SLIDER_PADDING),
|
||||
Rectangle slider = {
|
||||
bounds.x + GuiGetStyle(SLIDER, BORDER_WIDTH) + GuiGetStyle(SLIDER, SLIDER_PADDING),
|
||||
bounds.y + bounds.height - sliderValue,
|
||||
bounds.width - 2*GuiGetStyle(SLIDER, BORDER_WIDTH) - 2*GuiGetStyle(SLIDER, SLIDER_PADDING),
|
||||
0.0f,
|
||||
};
|
||||
|
||||
|
||||
if (sliderHeight > 0) // Slider
|
||||
{
|
||||
slider.y -= sliderHeight/2;
|
||||
@ -142,7 +142,7 @@ float GuiVerticalSliderPro(Rectangle bounds, const char *textTop, const char *te
|
||||
if (sliderHeight > 0) slider.y = mousePoint.y - slider.height / 2; // Slider
|
||||
else if (sliderHeight == 0) // SliderBar
|
||||
{
|
||||
slider.y = mousePoint.y;
|
||||
slider.y = mousePoint.y;
|
||||
slider.height = bounds.y + bounds.height - slider.y - GuiGetStyle(SLIDER, BORDER_WIDTH);
|
||||
}
|
||||
}
|
||||
@ -162,7 +162,7 @@ float GuiVerticalSliderPro(Rectangle bounds, const char *textTop, const char *te
|
||||
}
|
||||
else if (sliderHeight == 0) // SliderBar
|
||||
{
|
||||
if (slider.y < (bounds.y + GuiGetStyle(SLIDER, BORDER_WIDTH)))
|
||||
if (slider.y < (bounds.y + GuiGetStyle(SLIDER, BORDER_WIDTH)))
|
||||
{
|
||||
slider.y = bounds.y + GuiGetStyle(SLIDER, BORDER_WIDTH);
|
||||
slider.height = bounds.height - 2*GuiGetStyle(SLIDER, BORDER_WIDTH);
|
||||
@ -215,7 +215,7 @@ float GuiVerticalSliderBar(Rectangle bounds, const char *textTop, const char *te
|
||||
return GuiVerticalSliderPro(bounds, textTop, textBottom, value, minValue, maxValue, 0);
|
||||
}
|
||||
|
||||
float GuiSliderProOwning(Rectangle bounds, const char *textLeft, const char *textRight, float *value, float minValue, float maxValue, int sliderWidth, bool editMode)
|
||||
bool GuiSliderProOwning(Rectangle bounds, const char *textLeft, const char *textRight, float *value, float minValue, float maxValue, int sliderWidth, bool editMode)
|
||||
{
|
||||
GuiState state = (GuiState)GuiGetState();
|
||||
|
||||
@ -224,10 +224,10 @@ float GuiSliderProOwning(Rectangle bounds, const char *textLeft, const char *tex
|
||||
|
||||
int sliderValue = (int)(((tempValue - minValue)/(maxValue - minValue))*(bounds.width - 2*GuiGetStyle(SLIDER, BORDER_WIDTH)));
|
||||
|
||||
Rectangle slider = {
|
||||
bounds.x,
|
||||
bounds.y + GuiGetStyle(SLIDER, BORDER_WIDTH) + GuiGetStyle(SLIDER, SLIDER_PADDING),
|
||||
0,
|
||||
Rectangle slider = {
|
||||
bounds.x,
|
||||
bounds.y + GuiGetStyle(SLIDER, BORDER_WIDTH) + GuiGetStyle(SLIDER, SLIDER_PADDING),
|
||||
0,
|
||||
bounds.height - 2*GuiGetStyle(SLIDER, BORDER_WIDTH) - 2*GuiGetStyle(SLIDER, SLIDER_PADDING)
|
||||
};
|
||||
|
||||
@ -247,7 +247,7 @@ float GuiSliderProOwning(Rectangle bounds, const char *textLeft, const char *tex
|
||||
if ((state != STATE_DISABLED) && (editMode || !guiLocked))
|
||||
{
|
||||
Vector2 mousePoint = GetMousePosition();
|
||||
|
||||
|
||||
if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON))
|
||||
{
|
||||
if (CheckCollisionPointRec(mousePoint, bounds))
|
||||
@ -266,7 +266,7 @@ float GuiSliderProOwning(Rectangle bounds, const char *textLeft, const char *tex
|
||||
|
||||
if (sliderWidth > 0) slider.x = mousePoint.x - slider.width/2; // Slider
|
||||
else if (sliderWidth == 0) slider.width = (float)sliderValue; // SliderBar
|
||||
|
||||
|
||||
}
|
||||
else if (CheckCollisionPointRec(mousePoint, bounds))
|
||||
{
|
||||
@ -295,9 +295,9 @@ float GuiSliderProOwning(Rectangle bounds, const char *textLeft, const char *tex
|
||||
GuiDrawRectangle(bounds, GuiGetStyle(SLIDER, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(SLIDER, BORDER + (state*3))), guiAlpha), Fade(GetColor(GuiGetStyle(SLIDER, (state != STATE_DISABLED)? BASE_COLOR_NORMAL : BASE_COLOR_DISABLED)), guiAlpha));
|
||||
|
||||
// Draw slider internal bar (depends on state)
|
||||
if ((state == STATE_NORMAL) || (state == STATE_PRESSED))
|
||||
if ((state == STATE_NORMAL) || (state == STATE_PRESSED))
|
||||
GuiDrawRectangle(slider, 0, BLANK, Fade(GetColor(GuiGetStyle(SLIDER, BASE_COLOR_PRESSED)), guiAlpha));
|
||||
else if (state == STATE_FOCUSED)
|
||||
else if (state == STATE_FOCUSED)
|
||||
GuiDrawRectangle(slider, 0, BLANK, Fade(GetColor(GuiGetStyle(SLIDER, TEXT_COLOR_FOCUSED)), guiAlpha));
|
||||
|
||||
// Draw left/right text if provided
|
||||
@ -323,7 +323,7 @@ float GuiSliderProOwning(Rectangle bounds, const char *textLeft, const char *tex
|
||||
GuiDrawText(textRight, textBounds, TEXT_ALIGN_LEFT, Fade(GetColor(GuiGetStyle(SLIDER, TEXT + (state*3))), guiAlpha));
|
||||
}
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
|
||||
*value = tempValue;
|
||||
return pressed;
|
||||
}
|
||||
@ -338,7 +338,7 @@ bool GuiSliderBarOwning(Rectangle bounds, const char *textLeft, const char *text
|
||||
return GuiSliderProOwning(bounds, textLeft, textRight, value, minValue, maxValue, 0, editMode);
|
||||
}
|
||||
|
||||
float GuiVerticalSliderProOwning(Rectangle bounds, const char *textTop, const char *textBottom, float *value, float minValue, float maxValue, int sliderHeight, bool editMode)
|
||||
bool GuiVerticalSliderProOwning(Rectangle bounds, const char *textTop, const char *textBottom, float *value, float minValue, float maxValue, int sliderHeight, bool editMode)
|
||||
{
|
||||
GuiState state = (GuiState)GuiGetState();
|
||||
|
||||
@ -347,13 +347,13 @@ float GuiVerticalSliderProOwning(Rectangle bounds, const char *textTop, const ch
|
||||
|
||||
int sliderValue = (int)(((tempValue - minValue)/(maxValue - minValue)) * (bounds.height - 2 * GuiGetStyle(SLIDER, BORDER_WIDTH)));
|
||||
|
||||
Rectangle slider = {
|
||||
bounds.x + GuiGetStyle(SLIDER, BORDER_WIDTH) + GuiGetStyle(SLIDER, SLIDER_PADDING),
|
||||
Rectangle slider = {
|
||||
bounds.x + GuiGetStyle(SLIDER, BORDER_WIDTH) + GuiGetStyle(SLIDER, SLIDER_PADDING),
|
||||
bounds.y + bounds.height - sliderValue,
|
||||
bounds.width - 2*GuiGetStyle(SLIDER, BORDER_WIDTH) - 2*GuiGetStyle(SLIDER, SLIDER_PADDING),
|
||||
0.0f,
|
||||
};
|
||||
|
||||
|
||||
if (sliderHeight > 0) // Slider
|
||||
{
|
||||
slider.y -= sliderHeight/2;
|
||||
@ -369,7 +369,7 @@ float GuiVerticalSliderProOwning(Rectangle bounds, const char *textTop, const ch
|
||||
if ((state != STATE_DISABLED) && (editMode || !guiLocked))
|
||||
{
|
||||
Vector2 mousePoint = GetMousePosition();
|
||||
|
||||
|
||||
if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON))
|
||||
{
|
||||
if (CheckCollisionPointRec(mousePoint, bounds))
|
||||
@ -387,11 +387,11 @@ float GuiVerticalSliderProOwning(Rectangle bounds, const char *textTop, const ch
|
||||
|
||||
float normalizedValue = (bounds.y + bounds.height - mousePoint.y - (float)(sliderHeight / 2)) / (bounds.height - (float)sliderHeight);
|
||||
tempValue = (maxValue - minValue) * normalizedValue + minValue;
|
||||
|
||||
|
||||
if (sliderHeight > 0) slider.y = mousePoint.y - slider.height / 2; // Slider
|
||||
else if (sliderHeight == 0) // SliderBar
|
||||
{
|
||||
slider.y = mousePoint.y;
|
||||
slider.y = mousePoint.y;
|
||||
slider.height = bounds.y + bounds.height - slider.y - GuiGetStyle(SLIDER, BORDER_WIDTH);
|
||||
}
|
||||
}
|
||||
@ -413,7 +413,7 @@ float GuiVerticalSliderProOwning(Rectangle bounds, const char *textTop, const ch
|
||||
}
|
||||
else if (sliderHeight == 0) // SliderBar
|
||||
{
|
||||
if (slider.y < (bounds.y + GuiGetStyle(SLIDER, BORDER_WIDTH)))
|
||||
if (slider.y < (bounds.y + GuiGetStyle(SLIDER, BORDER_WIDTH)))
|
||||
{
|
||||
slider.y = bounds.y + GuiGetStyle(SLIDER, BORDER_WIDTH);
|
||||
slider.height = bounds.height - 2*GuiGetStyle(SLIDER, BORDER_WIDTH);
|
||||
@ -426,9 +426,9 @@ float GuiVerticalSliderProOwning(Rectangle bounds, const char *textTop, const ch
|
||||
GuiDrawRectangle(bounds, GuiGetStyle(SLIDER, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(SLIDER, BORDER + (state*3))), guiAlpha), Fade(GetColor(GuiGetStyle(SLIDER, (state != STATE_DISABLED)? BASE_COLOR_NORMAL : BASE_COLOR_DISABLED)), guiAlpha));
|
||||
|
||||
// Draw slider internal bar (depends on state)
|
||||
if ((state == STATE_NORMAL) || (state == STATE_PRESSED))
|
||||
if ((state == STATE_NORMAL) || (state == STATE_PRESSED))
|
||||
GuiDrawRectangle(slider, 0, BLANK, Fade(GetColor(GuiGetStyle(SLIDER, BASE_COLOR_PRESSED)), guiAlpha));
|
||||
else if (state == STATE_FOCUSED)
|
||||
else if (state == STATE_FOCUSED)
|
||||
GuiDrawRectangle(slider, 0, BLANK, Fade(GetColor(GuiGetStyle(SLIDER, TEXT_COLOR_FOCUSED)), guiAlpha));
|
||||
|
||||
// Draw top/bottom text if provided
|
||||
@ -454,7 +454,7 @@ float GuiVerticalSliderProOwning(Rectangle bounds, const char *textTop, const ch
|
||||
GuiDrawText(textBottom, textBounds, TEXT_ALIGN_LEFT, Fade(GetColor(GuiGetStyle(SLIDER, TEXT + (state*3))), guiAlpha));
|
||||
}
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
|
||||
*value = tempValue;
|
||||
return pressed;
|
||||
}
|
||||
|
||||
574
src/raygui.h
574
src/raygui.h
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user