Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cross-Platform GUI API [v5] #106

Draft
wants to merge 117 commits into
base: v5.0.0
Choose a base branch
from
Draft
Changes from 1 commit
Commits
Show all changes
117 commits
Select commit Hold shift + click to select a range
bd0b42f
Added Platform enum
WolfyScript Jan 3, 2023
d10d52e
Added Platform getter to WolfyCore
WolfyScript Jan 3, 2023
b45d2d6
Renamed GUIInteractionDetails to InteractionDetails.
WolfyScript Jan 3, 2023
38a6081
Added abstract Data class
WolfyScript Jan 3, 2023
2e554af
Added ItemStack methods
WolfyScript Jan 3, 2023
c3ea8dc
Added Component, ComponentState and various other GUI lifecycle inter…
WolfyScript Jan 3, 2023
6c55f4d
Added StateSelector to select states of Components
WolfyScript Jan 3, 2023
b8872a3
Added other types of Components
WolfyScript Jan 3, 2023
857f1cb
Added ChildComponentBuilder and Cluster and Window builders
WolfyScript Jan 3, 2023
1b63689
Added GuiAPIManager
WolfyScript Jan 3, 2023
0091e8c
Added default ButtonState implementation
WolfyScript Jan 3, 2023
5af3dc0
Added Cluster and Window common implementation
WolfyScript Jan 3, 2023
50358a8
Added GuiAPIManager and GuiViewManager common implementation
WolfyScript Jan 3, 2023
2a59c7b
Removed Items#getItem
WolfyScript Jan 3, 2023
14fddab
Added docs to GuiAPIManager
WolfyScript Jan 12, 2023
808e72d
Implement common methods in GuiAPIManagerCommonImpl
WolfyScript Jan 12, 2023
b8573cf
Added docs to GuiViewManager
WolfyScript Jan 12, 2023
44ab910
Implement GuiViewManager common methods
WolfyScript Jan 12, 2023
f07a1fc
Added WindowType enum that contains all the possible GUI types.
WolfyScript Jan 12, 2023
a6d72fa
Added type, size and title methods to Window
WolfyScript Jan 12, 2023
70fd0f4
Added type and size builder methods to WindowComponentBuilder
WolfyScript Jan 12, 2023
8cbe621
Implemented type and size in WindowCommonImpl
WolfyScript Jan 12, 2023
c1c5287
Renamed GuiHolder#getHandler to GuiHolder#getViewManager
WolfyScript Jan 12, 2023
4479aa0
Implemented common methods in GuiHolderCommonImpl
WolfyScript Jan 12, 2023
af04737
Added more javadoc to Component, Window and various other interfaces.
WolfyScript Jan 18, 2023
8d151a6
Removed Component postInteract and preRender methods.
WolfyScript Jan 18, 2023
5606435
Added StateBuilder type to Component.Builder
WolfyScript Jan 18, 2023
12c7b1c
Update components to custom StateBuilder types
WolfyScript Jan 18, 2023
97aa8ad
Added WindowTitleUpdateCallback
WolfyScript Jan 18, 2023
90f41ee
Removed InteractionPostCallback
WolfyScript Jan 18, 2023
9bbb464
Various API additions and changes
WolfyScript Mar 6, 2023
57d0b75
Add separate RouterState interface
WolfyScript Apr 10, 2023
e10a950
Add ButtonIcon interface
WolfyScript Apr 10, 2023
41460e4
Add ButtonIcon getter to Button interface
WolfyScript Apr 10, 2023
0d111ea
Add ButtonBuilder interface to create Buttons
WolfyScript Apr 10, 2023
13434ae
Add ButtonComponentState
WolfyScript Apr 10, 2023
8c75839
Remove Component#getComponentStateType
WolfyScript Apr 10, 2023
347c573
Add Signal that handles updates and state values
WolfyScript Apr 10, 2023
2701397
Add Stateful#createState, #signals, and #getSignal
WolfyScript Apr 10, 2023
25e9355
Replace hooks with signals in ComponentState
WolfyScript Apr 10, 2023
7a12369
Remove common implementation of GuiViewManagerCommonImpl#openNew
WolfyScript Apr 10, 2023
94e392b
Add context creation and more open parameters to MenuComponent
WolfyScript Apr 10, 2023
4c23470
Make Renderable state generic
WolfyScript Apr 10, 2023
8840f51
Make RenderCallback state generic
WolfyScript Apr 10, 2023
2cc19bb
Add next component and util bound check to RenderContext
WolfyScript Apr 10, 2023
d4e2c90
Rename WindowComponentBuilder to WindowBuilder
WolfyScript Apr 10, 2023
934ac02
Make WindowChildComponentBuilder standalone
WolfyScript Apr 10, 2023
e083c60
Add WindowState#setComponent
WolfyScript Apr 10, 2023
2dacca9
Make WindowStateBuilder standalone
WolfyScript Apr 10, 2023
8ec1177
Remove state type getter from Window
WolfyScript Apr 10, 2023
c7f7a2f
Update Router to generic MenuComponent
WolfyScript Apr 10, 2023
79e71e1
Add useSignal to RouterBuilder
WolfyScript Apr 10, 2023
18d4321
Rename WindowBuilder in RouterChildBuilder
WolfyScript Apr 10, 2023
dfaa6d0
Add ComponentBuilderSettings for Builder implementations
WolfyScript Apr 12, 2023
50ea5d4
Add ComponentBuilder
WolfyScript Apr 12, 2023
30710b2
Add interface for RegistryGUIComponentBuilders
WolfyScript Apr 12, 2023
58be082
Add getters to Signal.Builder to get key and type
WolfyScript Apr 12, 2023
76b9632
Add util method to SizedComponent
WolfyScript Apr 12, 2023
b1edcb0
Use ComponentBuilder interface for Builders
WolfyScript Apr 12, 2023
9833052
Make Component Keyed to ues it in registries
WolfyScript Apr 12, 2023
29344f6
Add getters for component and builder registries
WolfyScript Apr 12, 2023
91d3b81
Use ComponentBuilder interface for RouterBuilder
WolfyScript Apr 12, 2023
1272bff
Add WindowChildComponentBuilder.custom
WolfyScript Apr 12, 2023
42752ab
Add docs to Signal interface & renamed occurrences of 'message' to 'v…
WolfyScript Apr 13, 2023
8b024cf
Rename & Add methods in WindowState
WolfyScript Apr 13, 2023
288a943
Added first few docs to ButtonBuilder
WolfyScript Apr 13, 2023
8a3a837
Add RenderOptions to Window
WolfyScript Apr 13, 2023
b915f46
Add RenderOptionsBuilder to WindowBuilder
WolfyScript Apr 13, 2023
6efd115
Add Json options to ComponentBuilder
WolfyScript Apr 17, 2023
e2bc64f
Fix GuiAPIManagerCommonImpl#getRouter breaking on null router
WolfyScript Apr 17, 2023
fcc58ae
Add KeyedBaseType to WindowBuilder and RouterBuilder
WolfyScript Apr 17, 2023
afae282
Add GuiAPIManager#registerRouterFromFile
WolfyScript Apr 17, 2023
2a6eee1
Start migrating from render callbacks to constructor callbacks.
WolfyScript May 10, 2023
a7ec379
Update progress
WolfyScript May 18, 2023
ec0b631
Remove unused StateHook, WindowChildComponentBuilder
WolfyScript Jun 4, 2023
5760861
Remove ButtonBuilder#useSignal
WolfyScript Jun 4, 2023
ac98f23
ButtonIcon can now have custom TagResolvers
WolfyScript Jun 4, 2023
468a752
No longer need Component#getPathToRoot
WolfyScript Jun 4, 2023
9187b49
Remove Signal.Value subclass
WolfyScript Jun 4, 2023
24dd3df
Move Router & Window out of components package
WolfyScript Jun 4, 2023
ea23aa7
Remove RouterChildBuilder
WolfyScript Jun 4, 2023
6ca6b38
Button no longer uses ButtonComponentState
WolfyScript Jun 4, 2023
b35a158
Rename GuiAPIManager "Router" occurrences to "Gui"
WolfyScript Jun 4, 2023
757072b
Rename GuiAPIManagerCommonImpl "Router" occurrences to "Gui"
WolfyScript Jun 4, 2023
910cea1
Update ComponentState to Signal changes
WolfyScript Jun 4, 2023
f2c9f5d
Remove unused imports
WolfyScript Jun 4, 2023
286c426
Rename GuiViewManagerCommonImpl#getRoot to #getRouter
WolfyScript Jun 4, 2023
57c2943
Add more getters to GuiViewManager
WolfyScript Jun 4, 2023
ebfafab
Fix RenderContext#checkIfSlotInBounds
WolfyScript Jun 4, 2023
05989fb
Remove signals from Stateful interface
WolfyScript Jun 4, 2023
253d7f1
Add ReactiveConsumer & ReactiveSupplier
WolfyScript Jun 4, 2023
581eb48
Add serializable functional interfaces
WolfyScript Jun 4, 2023
5fbaefe
Add signals getter to Renderer
WolfyScript Jun 4, 2023
11d095d
Replace position, render, etc. with reactive & useSignal methods
WolfyScript Jun 4, 2023
9e8fe28
Add title methods to WindowRenderer.Builder
WolfyScript Jun 7, 2023
5974814
Add resource export utils to WolfyUtils
WolfyScript Jun 21, 2023
71fd956
Change GuiAPIManager#registerGuiFromFile to only require the id and b…
WolfyScript Jun 21, 2023
da50bc2
Add StackInputSlot & StackInputSlotBuilder
WolfyScript Jun 27, 2023
24f97b7
Add GuiHolder#getPlayer to get player wrapper
WolfyScript Jun 28, 2023
d57d1f6
Add ComponentBuilder#getSlots for better json handling
WolfyScript Jun 28, 2023
0a7a019
Add ComponentCluster & ComponentClusterBuilder
WolfyScript Jun 28, 2023
e3220f2
Removed some unused interfaces
WolfyScript Jun 28, 2023
709ea63
Add fastutil dependency
WolfyScript Jul 15, 2023
d4bccfa
Fully migrated from render methods to signal based rendering
WolfyScript Jul 15, 2023
e00af75
Add AbstractComponentBuilderImpl & AbstractComponentImpl
WolfyScript Jul 20, 2023
f1137cd
Remove Component#getRenderer
WolfyScript Jul 26, 2023
3ca6640
Add Component#remove & Remove old #contruct method
WolfyScript Jul 26, 2023
7ea95d6
Add ReactiveRenderBuilder
WolfyScript Jul 26, 2023
828b5ea
Add Window#render & remove old #construct method
WolfyScript Jul 26, 2023
faf594f
Change reactive consumer to function
WolfyScript Jul 26, 2023
baec0ee
Move Signal interface & Add Store interface
WolfyScript Jul 27, 2023
8fd6d97
Move WindowRenderer#Builder to DynamicConstructor
WolfyScript Jul 27, 2023
4dcdaac
Relocate callbacks
WolfyScript Sep 5, 2023
95e2665
Add TextInput callbacks
WolfyScript Sep 5, 2023
39e5c9d
Add sound option to ButtonBuilder
WolfyScript Nov 21, 2023
ad4ef8c
Add NamespacedKey#toKyoriKey
WolfyScript Dec 2, 2023
775408e
Replace slot positioning with Position class
WolfyScript Dec 2, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix RenderContext#checkIfSlotInBounds
  • Loading branch information
WolfyScript committed Jun 4, 2023
commit ebfafabe311de7bb37e089e1fc86eefd92e7d7e1
Original file line number Diff line number Diff line change
@@ -35,11 +35,20 @@ public interface RenderContext {
void setNativeStack(int slot, Object nativeStack);

default boolean checkIfSlotInBounds(int slot) {
Component parent = getCurrentState().getOwner().parent();
if (slot >= 0 && slot < parent.width() * parent.height()) {
int outerWidth;
int outerHeight;
if (getCurrentState().getOwner().parent() != null) {
Component parent = getCurrentState().getOwner().parent();
outerWidth = parent.width();
outerHeight = parent.height();
} else {
outerWidth = 9;
outerHeight = 6;
}
if (slot >= 0 && slot < outerWidth * outerHeight) {
return true;
}
throw new IllegalArgumentException("Slot " + slot + " out of bounds! Must be in the range of [" + 0 + "..." + (parent.width() * parent.height() - 1) + "] !");
throw new IllegalArgumentException("Slot " + slot + " out of bounds! Must be in the range of [" + 0 + "..." + (outerWidth * outerHeight - 1) + "] !");
}

}