diff --git a/src/raygui.h b/src/raygui.h index 49366ca..7b81a9d 100644 --- a/src/raygui.h +++ b/src/raygui.h @@ -19,8 +19,6 @@ * - Label * - Button * - LabelButton --> Label -* - ImageButton --> Button -* - ImageButtonEx --> Button * - Toggle * - ToggleGroup --> Toggle * - CheckBox @@ -117,7 +115,7 @@ * * 3.0 (xx-Sep-2021) Integrated ricons data to avoid external file * REDESIGNED: GuiTextBoxMulti() -* 2.9 (17-Mar-2021) Removed tooltip API +* REMOVED: GuiImageButton*() * 2.9 (17-Mar-2021) REMOVED: Tooltip API * 2.8 (03-May-2020) Centralized rectangles drawing to GuiDrawRectangle() * 2.7 (20-Feb-2020) ADDED: Possible tooltips API @@ -496,8 +494,6 @@ RAYGUIAPI Rectangle GuiScrollPanel(Rectangle bounds, Rectangle content, Vector2 RAYGUIAPI void GuiLabel(Rectangle bounds, const char *text); // Label control, shows text RAYGUIAPI bool GuiButton(Rectangle bounds, const char *text); // Button control, returns true when clicked RAYGUIAPI bool GuiLabelButton(Rectangle bounds, const char *text); // Label button control, show true when clicked -RAYGUIAPI bool GuiImageButton(Rectangle bounds, const char *text, Texture2D texture); // Image button control, returns true when clicked -RAYGUIAPI bool GuiImageButtonEx(Rectangle bounds, const char *text, Texture2D texture, Rectangle texSource); // Image button extended control, returns true when clicked RAYGUIAPI bool GuiToggle(Rectangle bounds, const char *text, bool active); // Toggle Button control, returns true when active RAYGUIAPI int GuiToggleGroup(Rectangle bounds, const char *text, int active); // Toggle Group control, returns active toggle index RAYGUIAPI bool GuiCheckBox(Rectangle bounds, const char *text, bool checked); // Check Box control, returns true when active @@ -1207,7 +1203,6 @@ static void DrawRectangle(int x, int y, int width, int height, Color color); static void DrawRectangleGradientEx(Rectangle rec, Color col1, Color col2, Color col3, Color col4); // -- GuiColorPicker() static void DrawTriangle(Vector2 v1, Vector2 v2, Vector2 v3, Color color); // -- GuiDropdownBox(), GuiScrollBar() -static void DrawTextureRec(Texture2D texture, Rectangle sourceRec, Vector2 position, Color tint); // -- GuiImageButtonEx() //static void DrawTextBoxed(Font font, const char *text, Rectangle rec, float fontSize, float spacing, bool wordWrap, Color tint); // -- GuiTextBoxMulti() //------------------------------------------------------------------------------- @@ -1638,45 +1633,6 @@ bool GuiLabelButton(Rectangle bounds, const char *text) return pressed; } -// Image button control, returns true when clicked -bool GuiImageButton(Rectangle bounds, const char *text, Texture2D texture) -{ - return GuiImageButtonEx(bounds, text, texture, RAYGUI_CLITERAL(Rectangle){ 0, 0, (float)texture.width, (float)texture.height }); -} - -// Image button control, returns true when clicked -bool GuiImageButtonEx(Rectangle bounds, const char *text, Texture2D texture, Rectangle texSource) -{ - GuiControlState state = guiState; - bool clicked = false; - - // Update control - //-------------------------------------------------------------------- - if ((state != GUI_STATE_DISABLED) && !guiLocked) - { - Vector2 mousePoint = GetMousePosition(); - - // Check button state - if (CheckCollisionPointRec(mousePoint, bounds)) - { - if (IsMouseButtonDown(MOUSE_LEFT_BUTTON)) state = GUI_STATE_PRESSED; - else if (IsMouseButtonReleased(MOUSE_LEFT_BUTTON)) clicked = true; - else state = GUI_STATE_FOCUSED; - } - } - //-------------------------------------------------------------------- - - // Draw control - //-------------------------------------------------------------------- - GuiDrawRectangle(bounds, GuiGetStyle(BUTTON, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(BUTTON, BORDER + (state*3))), guiAlpha), Fade(GetColor(GuiGetStyle(BUTTON, BASE + (state*3))), guiAlpha)); - - GuiDrawText(text, GetTextBounds(BUTTON, bounds), GuiGetStyle(BUTTON, TEXT_ALIGNMENT), Fade(GetColor(GuiGetStyle(BUTTON, TEXT + (state*3))), guiAlpha)); - if (texture.id > 0) DrawTextureRec(texture, texSource, RAYGUI_CLITERAL(Vector2){ bounds.x + bounds.width/2 - texSource.width/2, bounds.y + bounds.height/2 - texSource.height/2 }, Fade(GetColor(GuiGetStyle(BUTTON, TEXT + (state*3))), guiAlpha)); - //------------------------------------------------------------------ - - return clicked; -} - // Toggle Button control, returns true when active bool GuiToggle(Rectangle bounds, const char *text, bool active) {