Skip to content

Commit

Permalink
Add UI2DSlider element
Browse files Browse the repository at this point in the history
Step 5 of splitting mega-PR #494 into smaller easier to review PRs

Co-authored-by: GimLala <[email protected]>
  • Loading branch information
MyreMylar and GimLala committed Mar 11, 2024
1 parent 6ce5ccf commit 47173fd
Show file tree
Hide file tree
Showing 5 changed files with 520 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pygame_gui/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from pygame_gui._constants import UI_BUTTON_ON_HOVERED, UI_BUTTON_ON_UNHOVERED
from pygame_gui._constants import UI_TEXT_ENTRY_FINISHED, UI_TEXT_ENTRY_CHANGED
from pygame_gui._constants import UI_TEXT_BOX_LINK_CLICKED
from pygame_gui._constants import UI_DROP_DOWN_MENU_CHANGED, UI_HORIZONTAL_SLIDER_MOVED
from pygame_gui._constants import UI_DROP_DOWN_MENU_CHANGED, UI_HORIZONTAL_SLIDER_MOVED, UI_2D_SLIDER_MOVED
from pygame_gui._constants import UI_SELECTION_LIST_NEW_SELECTION
from pygame_gui._constants import UI_SELECTION_LIST_DROPPED_SELECTION
from pygame_gui._constants import UI_SELECTION_LIST_DOUBLE_CLICKED_SELECTION
Expand Down Expand Up @@ -46,6 +46,7 @@
'UI_TEXT_ENTRY_FINISHED',
'UI_DROP_DOWN_MENU_CHANGED',
'UI_HORIZONTAL_SLIDER_MOVED',
'UI_2D_SLIDER_MOVED',
'UI_SELECTION_LIST_NEW_SELECTION',
'UI_SELECTION_LIST_DROPPED_SELECTION',
'UI_SELECTION_LIST_DOUBLE_CLICKED_SELECTION',
Expand Down
2 changes: 2 additions & 0 deletions pygame_gui/_constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ def __eq__(self, other):
UI_TEXT_ENTRY_FINISHED = custom_type()
UI_DROP_DOWN_MENU_CHANGED = custom_type()
UI_HORIZONTAL_SLIDER_MOVED = custom_type()
UI_2D_SLIDER_MOVED = custom_type()
UI_SELECTION_LIST_NEW_SELECTION = custom_type()
UI_SELECTION_LIST_DROPPED_SELECTION = custom_type()
UI_SELECTION_LIST_DOUBLE_CLICKED_SELECTION = custom_type()
Expand Down Expand Up @@ -244,6 +245,7 @@ def __eq__(self, other):
'UI_TEXT_ENTRY_FINISHED',
'UI_DROP_DOWN_MENU_CHANGED',
'UI_HORIZONTAL_SLIDER_MOVED',
'UI_2D_SLIDER_MOVED',
'UI_SELECTION_LIST_NEW_SELECTION',
'UI_SELECTION_LIST_DROPPED_SELECTION',
'UI_SELECTION_LIST_DOUBLE_CLICKED_SELECTION',
Expand Down
21 changes: 21 additions & 0 deletions pygame_gui/data/default_theme.json
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,27 @@
"shadow_width": "1"
}
},
"2d_slider":
{
"prototype": "#default_shape_style",
"misc":
{
"sliding_button_width": "20"
}
},
"2d_slider.button":
{
"prototype": "#no_frills_button"
},
"2d_slider.#sliding_button":
{
"misc":
{
"shape": "ellipse",
"border_width": "1",
"shadow_width": "1"
}
},
"label":
{
"misc":
Expand Down
2 changes: 2 additions & 0 deletions pygame_gui/elements/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from pygame_gui.elements.ui_image import UIImage
from pygame_gui.elements.ui_button import UIButton
from pygame_gui.elements.ui_horizontal_slider import UIHorizontalSlider
from pygame_gui.elements.ui_2d_slider import UI2DSlider
from pygame_gui.elements.ui_vertical_scroll_bar import UIVerticalScrollBar
from pygame_gui.elements.ui_horizontal_scroll_bar import UIHorizontalScrollBar
from pygame_gui.elements.ui_label import UILabel
Expand All @@ -22,6 +23,7 @@
__all__ = ['UIImage',
'UIButton',
'UIHorizontalSlider',
'UI2DSlider',
'UIVerticalScrollBar',
'UIHorizontalScrollBar',
'UILabel',
Expand Down
Loading

0 comments on commit 47173fd

Please sign in to comment.