Browse Source

Added mouse wheel scroll to GuiScrollPanel()

Reviewed GuiWindow() top status bar
raysan5 6 years ago
parent
commit
6b7352bc6c
1 changed files with 5 additions and 0 deletions
  1. 5 0
      src/raygui.h

+ 5 - 0
src/raygui.h

@@ -766,9 +766,12 @@ RAYGUIDEF bool GuiWindowBox(Rectangle bounds, const char *text)
 
 
     // Draw window header as status bar
     // Draw window header as status bar
     int defaultPadding = GuiGetStyle(DEFAULT, GROUP_PADDING);
     int defaultPadding = GuiGetStyle(DEFAULT, GROUP_PADDING);
+    int defaultTextAlign = GuiGetStyle(DEFAULT, TEXT_ALIGNMENT);
     GuiSetStyle(DEFAULT, INNER_PADDING, 8);
     GuiSetStyle(DEFAULT, INNER_PADDING, 8);
+    GuiSetStyle(DEFAULT, TEXT_ALIGNMENT, GUI_TEXT_ALIGN_LEFT);
     GuiStatusBar(statusBar, text);
     GuiStatusBar(statusBar, text);
     GuiSetStyle(DEFAULT, INNER_PADDING, defaultPadding);
     GuiSetStyle(DEFAULT, INNER_PADDING, defaultPadding);
+    GuiSetStyle(DEFAULT, TEXT_ALIGNMENT, defaultTextAlign);
 
 
     // Draw window close button
     // Draw window close button
     int buttonBorder = GuiGetStyle(BUTTON, BORDER_WIDTH);
     int buttonBorder = GuiGetStyle(BUTTON, BORDER_WIDTH);
@@ -908,6 +911,8 @@ RAYGUIDEF Rectangle GuiScrollPanel(Rectangle bounds, Rectangle content, Vector2
                 if (IsKeyDown(KEY_DOWN)) scrollPos.y -= GuiGetStyle(SCROLLBAR, SCROLLBAR_SCROLL_SPEED);
                 if (IsKeyDown(KEY_DOWN)) scrollPos.y -= GuiGetStyle(SCROLLBAR, SCROLLBAR_SCROLL_SPEED);
                 if (IsKeyDown(KEY_UP)) scrollPos.y += GuiGetStyle(SCROLLBAR, SCROLLBAR_SCROLL_SPEED);
                 if (IsKeyDown(KEY_UP)) scrollPos.y += GuiGetStyle(SCROLLBAR, SCROLLBAR_SCROLL_SPEED);
             }
             }
+            
+            scrollPos.y += GetMouseWheelMove()*20;
         }
         }
     }
     }