Class NWindowManagerComponent
- All Implemented Interfaces:
Component<Object>,Fragment,InputHandlerFragment,LogicFragment
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.ngengine.components.fragments.InputHandlerFragment
InputHandlerFragment.Wrapper -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaction(int id) voidback()protected voidvoidcloseAll()voidvoidvoidenqueueInThread(Runnable task) intintgetWidth()voidonAttached(ComponentManager mng, Runner runner, DataStoreProvider dataStoreProvider) Called immediately when the component is attached to aComponentManagerand aRunner.voidonDisable(ComponentManager mng, Runner runner, DataStoreProvider dataStoreProvider) Called when the component is disabled.voidonEnable(ComponentManager mng, Runner runner, DataStoreProvider dataStoreProvider, boolean firstTime, Object slot) Called when the component is enabled.voidrunInThread(Runnable task) voidshowCursor(boolean v) showFatalError(Throwable exc) showToast(NToast.ToastType type, String message) showToast(NToast.ToastType type, String message, Duration duration) <T extends NWindow<A>,A>
TshowWindow(Class<T> windowClass) Shows a window of the specified class with the given arguments and a callback and returns a closer function.<T extends NWindow<A>,A>
TshowWindow(Class<T> windowClass, A args) Shows a window of the specified class with the given arguments and a callback and returns a closer function.voidtoastAction(int id) voidupdateAppLogic(ComponentManager mng, float tpf) Called by the application logic update loop.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.ngengine.components.Component
getId, getSlot, onDetached, onNudgeMethods inherited from interface org.ngengine.components.fragments.InputHandlerFragment
beginInput, endInput, onJoyAxisEvent, onJoyButtonEvent, onKeyEvent, onMouseButtonEvent, onMouseMotionEvent, onTouchEvent, receiveInputManager
-
Constructor Details
-
NWindowManagerComponent
public NWindowManagerComponent()
-
-
Method Details
-
showCursor
public void showCursor(boolean v) -
enqueueInThread
-
runInThread
-
onAttached
Description copied from interface:ComponentCalled immediately when the component is attached to aComponentManagerand aRunner.This method can be overridden to perform initialization tasks when the component is attached.
- Specified by:
onAttachedin interfaceComponent<Object>- Parameters:
mng- the ComponentManager to which this component is attachedrunner- the Runner associated with this componentdataStoreProvider- the DataStoreProvider for accessing shared data
-
getDataStoreProvider
-
getWidth
public int getWidth() -
getHeight
public int getHeight() -
checkThread
protected void checkThread() -
showWindow
Shows a window of the specified class with the given arguments and a callback and returns a closer function.- Type Parameters:
T- the class of the window- Parameters:
windowClass- the class of the window to show- Returns:
- an instance of the window
-
showWindow
Shows a window of the specified class with the given arguments and a callback and returns a closer function.- Type Parameters:
T- the class of the window- Parameters:
windowClass- the class of the window to showargs- the arguments to pass to the window, can be null- Returns:
- an instance of the window
-
showFatalError
-
showToast
-
showToast
-
showToast
-
showToast
-
closeAllWindows
public void closeAllWindows() -
closeAllToasts
public void closeAllToasts() -
closeAll
public void closeAll() -
onEnable
public void onEnable(ComponentManager mng, Runner runner, DataStoreProvider dataStoreProvider, boolean firstTime, Object slot) Description copied from interface:ComponentCalled when the component is enabled. This is the most important method of the component lifecycle, where the component's main logic is implemented.This method is called when the component is enabled, all its dependencies are satisfied, the fragments are initialized, and the resources are loaded.
- Specified by:
onEnablein interfaceComponent<Object>- Parameters:
mng- - the ComponentManager to which this component is attachedrunner- - the Runner that executes the logicdataStoreProvider- - the DataStoreProvider for storing and retrieving data and cachesfirstTime- - whether this is the first time the component is being enabledslot- - an argument that can be passed when enabling this component, can be null
-
onDisable
Description copied from interface:ComponentCalled when the component is disabled.This should undo anything that was done in
Component.onEnable(org.ngengine.components.ComponentManager, org.ngengine.runner.Runner, org.ngengine.store.DataStoreProvider, boolean, T)and reset the component state to allow future re-enabling.This method is called when the component is explicitly disabled or when one of its dependencies is disabled.
If $
is not implemented, this method should take care of cleaning up all resources to prevent leaks.invalid reference
#onDetachIt is always called before an enabled component is detached from the
ComponentManager. -
updateAppLogic
Description copied from interface:LogicFragmentCalled by the application logic update loop. This method is called every frame before the render phase.- Specified by:
updateAppLogicin interfaceLogicFragment- Parameters:
tpf- time per frame
-
back
public void back() -
action
public void action(int id) -
toastAction
public void toastAction(int id)
-