mirror of
https://github.com/raysan5/raygui.git
synced 2025-12-25 10:22:33 -05:00
Compare commits
24 Commits
1736d71bd7
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 0b94b80c92 | |||
| 867ca4bf8d | |||
| 367e169ad3 | |||
| 1a74db2ab3 | |||
| 715baf250d | |||
| 3aea427fc8 | |||
| 773d1ec52b | |||
| ff4dbd0712 | |||
| aed63cedd1 | |||
| 4436a897f9 | |||
| d4ebcdc2be | |||
| 860e46d3f8 | |||
| b9971133b2 | |||
| 947ef5799d | |||
| 681393a423 | |||
| 9cdfec460b | |||
| 546b4bacf4 | |||
| cf3aab1e9f | |||
| 9193f38424 | |||
| 6530ee136b | |||
| 1b2612cf75 | |||
| 54ee53e7d7 | |||
| b4eb06657b | |||
| c4c87f2971 |
@ -203,11 +203,12 @@ int main()
|
||||
BeginDrawing();
|
||||
|
||||
ClearBackground(GetColor(GuiGetStyle(DEFAULT, BACKGROUND_COLOR)));
|
||||
|
||||
|
||||
// raygui: controls drawing
|
||||
//----------------------------------------------------------------------------------
|
||||
// Check all possible events that require GuiLock
|
||||
if (dropDown000EditMode || dropDown001EditMode) GuiLock();
|
||||
if (showTextInputBox) GuiLock();
|
||||
|
||||
// First GUI column
|
||||
//GuiSetStyle(CHECKBOX, TEXT_ALIGNMENT, TEXT_ALIGN_LEFT);
|
||||
@ -236,7 +237,9 @@ int main()
|
||||
GuiComboBox((Rectangle){ 25, 480, 125, 30 }, "default;Jungle;Lavanda;Dark;Bluish;Cyber;Terminal;Candy;Cherry;Ashes;Enefete;Sunny;Amber", &visualStyleActive);
|
||||
|
||||
// NOTE: GuiDropdownBox must draw after any other control that can be covered on unfolding
|
||||
GuiUnlock();
|
||||
if (dropDown000EditMode || dropDown001EditMode) GuiUnlock();
|
||||
if (showTextInputBox) GuiLock(); // Stay locked
|
||||
|
||||
GuiSetStyle(DROPDOWNBOX, TEXT_PADDING, 4);
|
||||
GuiSetStyle(DROPDOWNBOX, TEXT_ALIGNMENT, TEXT_ALIGN_LEFT);
|
||||
if (GuiDropdownBox((Rectangle){ 25, 65, 125, 30 }, "#01#ONE;#02#TWO;#03#THREE;#04#FOUR", &dropdownBox001Active, dropDown001EditMode)) dropDown001EditMode = !dropDown001EditMode;
|
||||
@ -300,6 +303,8 @@ int main()
|
||||
|
||||
if (showTextInputBox)
|
||||
{
|
||||
GuiUnlock();
|
||||
|
||||
DrawRectangle(0, 0, GetScreenWidth(), GetScreenHeight(), Fade(RAYWHITE, 0.8f));
|
||||
int result = GuiTextInputBox((Rectangle){ (float)GetScreenWidth()/2 - 120, (float)GetScreenHeight()/2 - 60, 240, 140 }, GuiIconText(ICON_FILE_SAVE, "Save file as..."), "Introduce output file name:", "Ok;Cancel", textInput, 255, NULL);
|
||||
|
||||
|
||||
@ -97,7 +97,7 @@ int GuiFloatBox(Rectangle bounds, const char* text, float* value, int minValue,
|
||||
Rectangle textBounds = { 0 };
|
||||
if (text != NULL)
|
||||
{
|
||||
textBounds.width = (float)GetTextWidth(text) + 2;
|
||||
textBounds.width = (float)GuiGetTextWidth(text) + 2;
|
||||
textBounds.height = (float)GuiGetStyle(DEFAULT, TEXT_SIZE);
|
||||
textBounds.x = bounds.x + bounds.width + GuiGetStyle(VALUEBOX, TEXT_PADDING);
|
||||
textBounds.y = bounds.y + bounds.height / 2.0f - GuiGetStyle(DEFAULT, TEXT_SIZE) / 2.0f;
|
||||
@ -124,7 +124,7 @@ int GuiFloatBox(Rectangle bounds, const char* text, float* value, int minValue,
|
||||
// Only allow keys in range [48..57]
|
||||
if (keyCount < RAYGUI_VALUEBOX_MAX_CHARS)
|
||||
{
|
||||
if (GetTextWidth(textValue) < bounds.width)
|
||||
if (GuiGetTextWidth(textValue) < bounds.width)
|
||||
{
|
||||
int key = GetCharPressed();
|
||||
if ((key >= 48) && (key <= 57) && guiFloatingPointIndex)
|
||||
@ -211,7 +211,7 @@ int GuiFloatBox(Rectangle bounds, const char* text, float* value, int minValue,
|
||||
if (editMode)
|
||||
{
|
||||
// NOTE: ValueBox internal text is always centered
|
||||
Rectangle cursor = { bounds.x + GetTextWidth(textValue) / 2.0f + bounds.width / 2.0f + 1, bounds.y + 2.0f * GuiGetStyle(VALUEBOX, BORDER_WIDTH), 4, bounds.height - 4 * GuiGetStyle(VALUEBOX, BORDER_WIDTH) };
|
||||
Rectangle cursor = { bounds.x + GuiGetTextWidth(textValue) / 2.0f + bounds.width / 2.0f + 1, bounds.y + 2.0f * GuiGetStyle(VALUEBOX, BORDER_WIDTH), 4, bounds.height - 4 * GuiGetStyle(VALUEBOX, BORDER_WIDTH) };
|
||||
GuiDrawRectangle(cursor, 0, BLANK, Fade(GetColor(GuiGetStyle(VALUEBOX, BORDER_COLOR_PRESSED)), guiAlpha));
|
||||
}
|
||||
|
||||
|
||||
@ -182,7 +182,7 @@ float GuiVerticalSliderPro(Rectangle bounds, const char *textTop, const char *te
|
||||
if (textTop != NULL)
|
||||
{
|
||||
Rectangle textBounds = { 0 };
|
||||
textBounds.width = (float)GetTextWidth(textTop);
|
||||
textBounds.width = (float)GuiGetTextWidth(textTop);
|
||||
textBounds.height = (float)GuiGetStyle(DEFAULT, TEXT_SIZE);
|
||||
textBounds.x = bounds.x + bounds.width/2 - textBounds.width/2;
|
||||
textBounds.y = bounds.y - textBounds.height - GuiGetStyle(SLIDER, TEXT_PADDING);
|
||||
@ -193,7 +193,7 @@ float GuiVerticalSliderPro(Rectangle bounds, const char *textTop, const char *te
|
||||
if (textBottom != NULL)
|
||||
{
|
||||
Rectangle textBounds = { 0 };
|
||||
textBounds.width = (float)GetTextWidth(textBottom);
|
||||
textBounds.width = (float)GuiGetTextWidth(textBottom);
|
||||
textBounds.height = (float)GuiGetStyle(DEFAULT, TEXT_SIZE);
|
||||
textBounds.x = bounds.x + bounds.width/2 - textBounds.width/2;
|
||||
textBounds.y = bounds.y + bounds.height + GuiGetStyle(SLIDER, TEXT_PADDING);
|
||||
@ -304,7 +304,7 @@ bool GuiSliderProOwning(Rectangle bounds, const char *textLeft, const char *text
|
||||
if (textLeft != NULL)
|
||||
{
|
||||
Rectangle textBounds = { 0 };
|
||||
textBounds.width = (float)GetTextWidth(textLeft);
|
||||
textBounds.width = (float)GuiGetTextWidth(textLeft);
|
||||
textBounds.height = (float)GuiGetStyle(DEFAULT, TEXT_SIZE);
|
||||
textBounds.x = bounds.x - textBounds.width - GuiGetStyle(SLIDER, TEXT_PADDING);
|
||||
textBounds.y = bounds.y + bounds.height/2 - GuiGetStyle(DEFAULT, TEXT_SIZE)/2;
|
||||
@ -315,7 +315,7 @@ bool GuiSliderProOwning(Rectangle bounds, const char *textLeft, const char *text
|
||||
if (textRight != NULL)
|
||||
{
|
||||
Rectangle textBounds = { 0 };
|
||||
textBounds.width = (float)GetTextWidth(textRight);
|
||||
textBounds.width = (float)GuiGetTextWidth(textRight);
|
||||
textBounds.height = (float)GuiGetStyle(DEFAULT, TEXT_SIZE);
|
||||
textBounds.x = bounds.x + bounds.width + GuiGetStyle(SLIDER, TEXT_PADDING);
|
||||
textBounds.y = bounds.y + bounds.height/2 - GuiGetStyle(DEFAULT, TEXT_SIZE)/2;
|
||||
@ -435,7 +435,7 @@ bool GuiVerticalSliderProOwning(Rectangle bounds, const char *textTop, const cha
|
||||
if (textTop != NULL)
|
||||
{
|
||||
Rectangle textBounds = { 0 };
|
||||
textBounds.width = (float)GetTextWidth(textTop);
|
||||
textBounds.width = (float)GuiGetTextWidth(textTop);
|
||||
textBounds.height = (float)GuiGetStyle(DEFAULT, TEXT_SIZE);
|
||||
textBounds.x = bounds.x + bounds.width/2 - textBounds.width/2;
|
||||
textBounds.y = bounds.y - textBounds.height - GuiGetStyle(SLIDER, TEXT_PADDING);
|
||||
@ -446,7 +446,7 @@ bool GuiVerticalSliderProOwning(Rectangle bounds, const char *textTop, const cha
|
||||
if (textBottom != NULL)
|
||||
{
|
||||
Rectangle textBounds = { 0 };
|
||||
textBounds.width = (float)GetTextWidth(textBottom);
|
||||
textBounds.width = (float)GuiGetTextWidth(textBottom);
|
||||
textBounds.height = (float)GuiGetStyle(DEFAULT, TEXT_SIZE);
|
||||
textBounds.x = bounds.x + bounds.width/2 - textBounds.width/2;
|
||||
textBounds.y = bounds.y + bounds.height + GuiGetStyle(SLIDER, TEXT_PADDING);
|
||||
|
||||
@ -38,10 +38,10 @@ int main(int argc, char *argv[])
|
||||
bool windowBoxActive = false;
|
||||
|
||||
int fileFormatActive = 0;
|
||||
char *fileFormatTextList[3] = { "IMAGE (.png)", "DATA (.raw)", "CODE (.h)" };
|
||||
const char *fileFormatTextList[3] = { "IMAGE (.png)", "DATA (.raw)", "CODE (.h)" };
|
||||
|
||||
int pixelFormatActive = 0;
|
||||
char *pixelFormatTextList[7] = { "GRAYSCALE", "GRAY ALPHA", "R5G6B5", "R8G8B8", "R5G5B5A1", "R4G4B4A4", "R8G8B8A8" };
|
||||
const char *pixelFormatTextList[7] = { "GRAYSCALE", "GRAY ALPHA", "R5G6B5", "R8G8B8", "R5G5B5A1", "R4G4B4A4", "R8G8B8A8" };
|
||||
|
||||
bool textBoxEditMode = false;
|
||||
char fileName[64] = "untitled";
|
||||
|
||||
@ -50,12 +50,12 @@ int main()
|
||||
bool heightEditMode = false;
|
||||
|
||||
int pixelFormatActive = 0;
|
||||
char *pixelFormatTextList[8] = { "CUSTOM", "GRAYSCALE", "GRAY ALPHA", "R5G6B5", "R8G8B8", "R5G5B5A1", "R4G4B4A4", "R8G8B8A8" };
|
||||
const char *pixelFormatTextList[8] = { "CUSTOM", "GRAYSCALE", "GRAY ALPHA", "R5G6B5", "R8G8B8", "R5G5B5A1", "R4G4B4A4", "R8G8B8A8" };
|
||||
|
||||
int channelsActive = 3;
|
||||
char *channelsTextList[4] = { "1", "2", "3", "4" };
|
||||
const char *channelsTextList[4] = { "1", "2", "3", "4" };
|
||||
int bitDepthActive = 0;
|
||||
char *bitDepthTextList[3] = { "8", "16", "32" };
|
||||
const char *bitDepthTextList[3] = { "8", "16", "32" };
|
||||
|
||||
int headerSizeValue = 0;
|
||||
bool headerSizeEditMode = false;
|
||||
|
||||
@ -323,7 +323,7 @@ double GuiDMValueBox(Rectangle bounds, double value, double minValue, double max
|
||||
Rectangle textBounds = {bounds.x + GuiGetStyle(VALUEBOX, BORDER_WIDTH) + textPadding, bounds.y + GuiGetStyle(VALUEBOX, BORDER_WIDTH),
|
||||
bounds.width - 2*(GuiGetStyle(VALUEBOX, BORDER_WIDTH) + textPadding), bounds.height - 2*GuiGetStyle(VALUEBOX, BORDER_WIDTH)};
|
||||
|
||||
int textWidth = GetTextWidth(textValue);
|
||||
int textWidth = GuiGetTextWidth(textValue);
|
||||
if(textWidth > textBounds.width) textBounds.width = textWidth;
|
||||
|
||||
if (state == STATE_PRESSED)
|
||||
@ -338,7 +338,7 @@ double GuiDMValueBox(Rectangle bounds, double value, double minValue, double max
|
||||
if(cursor > 0) {
|
||||
char c = textValue[cursor];
|
||||
textValue[cursor] = '\0';
|
||||
textWidthCursor = GetTextWidth(textValue);
|
||||
textWidthCursor = GuiGetTextWidth(textValue);
|
||||
textValue[cursor] = c;
|
||||
}
|
||||
//DrawRectangle(bounds.x + textWidthCursor + textPadding + 2, bounds.y + 2*GuiGetStyle(VALUEBOX, BORDER_WIDTH), 1, bounds.height - 4*GuiGetStyle(VALUEBOX, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(VALUEBOX, BORDER_COLOR_PRESSED)), guiAlpha));
|
||||
@ -608,7 +608,7 @@ void GuiDMPropertyList(Rectangle bounds, GuiDMProperty* props, int count, int* f
|
||||
// draw X, Y, Z, W values (only when expanded)
|
||||
if(!PROP_CHECK_FLAG(&props[p], GUI_PFLAG_COLLAPSED)) {
|
||||
Rectangle slotBounds = { propBounds.x, propBounds.y+GuiGetStyle(LISTVIEW, LIST_ITEMS_HEIGHT)+1, propBounds.width, GuiGetStyle(LISTVIEW, LIST_ITEMS_HEIGHT)-2};
|
||||
Rectangle lblBounds = { propBounds.x+PROPERTY_PADDING, slotBounds.y, GetTextWidth("A"), slotBounds.height};
|
||||
Rectangle lblBounds = { propBounds.x+PROPERTY_PADDING, slotBounds.y, GuiGetTextWidth("A"), slotBounds.height};
|
||||
Rectangle valBounds = { lblBounds.x+lblBounds.width+PROPERTY_PADDING, slotBounds.y, propBounds.width-lblBounds.width-2*PROPERTY_PADDING, slotBounds.height};
|
||||
GuiDrawText("X", lblBounds, TEXT_ALIGN_LEFT, textColor);
|
||||
props[p].value.v2.x = GuiDMSpinner(valBounds, props[p].value.v2.x, 0.0, 0.0, 1.0, PROPERTY_DECIMAL_DIGITS, (propState == STATE_FOCUSED) && CheckCollisionPointRec(mousePos, slotBounds) );
|
||||
@ -647,7 +647,7 @@ void GuiDMPropertyList(Rectangle bounds, GuiDMProperty* props, int count, int* f
|
||||
// draw X, Y, Width, Height values (only when expanded)
|
||||
if(!PROP_CHECK_FLAG(&props[p], GUI_PFLAG_COLLAPSED)) {
|
||||
Rectangle slotBounds = { propBounds.x, propBounds.y+GuiGetStyle(LISTVIEW, LIST_ITEMS_HEIGHT)+1, propBounds.width, GuiGetStyle(LISTVIEW, LIST_ITEMS_HEIGHT)-2};
|
||||
Rectangle lblBounds = { propBounds.x+PROPERTY_PADDING, slotBounds.y, GetTextWidth("Height"), slotBounds.height};
|
||||
Rectangle lblBounds = { propBounds.x+PROPERTY_PADDING, slotBounds.y, GuiGetTextWidth("Height"), slotBounds.height};
|
||||
Rectangle valBounds = { lblBounds.x+lblBounds.width+PROPERTY_PADDING, slotBounds.y, propBounds.width-lblBounds.width-2*PROPERTY_PADDING, slotBounds.height};
|
||||
GuiDrawText("X", lblBounds, TEXT_ALIGN_LEFT, textColor);
|
||||
props[p].value.vrect.x = GuiDMSpinner(valBounds, props[p].value.vrect.x, 0.0, 0.0, 1.0, 0, (propState == STATE_FOCUSED) && CheckCollisionPointRec(mousePos, slotBounds) );
|
||||
@ -685,8 +685,8 @@ void GuiDMPropertyList(Rectangle bounds, GuiDMProperty* props, int count, int* f
|
||||
// draw R, G, B, A values (only when expanded)
|
||||
if(!PROP_CHECK_FLAG(&props[p], GUI_PFLAG_COLLAPSED)) {
|
||||
Rectangle slotBounds = { propBounds.x, propBounds.y+GuiGetStyle(LISTVIEW, LIST_ITEMS_HEIGHT)+1, propBounds.width, GuiGetStyle(LISTVIEW, LIST_ITEMS_HEIGHT)-2};
|
||||
Rectangle lblBounds = { propBounds.x+PROPERTY_PADDING, slotBounds.y, GetTextWidth("A"), slotBounds.height};
|
||||
Rectangle valBounds = { lblBounds.x+lblBounds.width+PROPERTY_PADDING, slotBounds.y, GetTextWidth("000000"), slotBounds.height};
|
||||
Rectangle lblBounds = { propBounds.x+PROPERTY_PADDING, slotBounds.y, GuiGetTextWidth("A"), slotBounds.height};
|
||||
Rectangle valBounds = { lblBounds.x+lblBounds.width+PROPERTY_PADDING, slotBounds.y, GuiGetTextWidth("000000"), slotBounds.height};
|
||||
Rectangle sbarBounds = { valBounds.x + valBounds.width + PROPERTY_PADDING, slotBounds.y, slotBounds.width - 3*PROPERTY_PADDING - lblBounds.width - valBounds.width, slotBounds.height };
|
||||
|
||||
if(sbarBounds.width <= GuiGetStyle(LISTVIEW, LIST_ITEMS_HEIGHT)-2) valBounds.width = propBounds.width-lblBounds.width-2*PROPERTY_PADDING; // hide slider when no space
|
||||
@ -865,4 +865,4 @@ bool GuiDMSaveProperties(const char* file, GuiDMProperty* props, int count) {
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif // GUI_PROPERTY_LIST_IMPLEMENTATION
|
||||
#endif // GUI_PROPERTY_LIST_IMPLEMENTATION
|
||||
|
||||
@ -6,10 +6,10 @@ PRODUCTVERSION 4,0,0,0
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
//BLOCK "080904E4" // English UK
|
||||
BLOCK "040904E4" // English US
|
||||
//BLOCK "080904E4" // English UK
|
||||
BLOCK "040904E4" // English US
|
||||
BEGIN
|
||||
//VALUE "CompanyName", "raylib technologies"
|
||||
//VALUE "CompanyName", "raylib technologies"
|
||||
VALUE "FileDescription", "raygui application (www.raylib.com)"
|
||||
VALUE "FileVersion", "4.0.0"
|
||||
VALUE "InternalName", "raygui app"
|
||||
@ -21,7 +21,7 @@ BEGIN
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
//VALUE "Translation", 0x809, 1252 // English UK
|
||||
VALUE "Translation", 0x409, 1252 // English US
|
||||
//VALUE "Translation", 0x809, 1252 // English UK
|
||||
VALUE "Translation", 0x409, 1252 // English US
|
||||
END
|
||||
END
|
||||
|
||||
465
src/raygui.h
465
src/raygui.h
File diff suppressed because it is too large
Load Diff
@ -19,4 +19,4 @@ Several options are provided to add the style to a `raygui` application, choose
|
||||
|
||||
## about font
|
||||
|
||||
raylib font by Ramon Santamaria ([@raysan5](https://twitter.com/raysan5)).
|
||||
raylib font by Ramon Santamaria ([@raysan5](https://github.com/raysan5)).
|
||||
|
||||
Reference in New Issue
Block a user