java.lang.Object
technology.sola.engine.core.SolaPlatform
SolaPlatform defines the API for a platform to run
Sola.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static interfaceGameLoopProvider is aFunctionalInterfacedefining the contract for providing aGameLoopimplementation for the sola game engine to use.protected static final recordHolds the coordinate of the pointer.protected static interfaceSolaPlatformInitialization is aFunctionalInterfacedefining the contract for finishing initialization of aSolaPlatform. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected GameLoopTheGameLoopfor the platform.protected RendererTheRendererfor the platform.protected RestClientTheRestClientfor the platform.protected SocketClientTheSocketClientfor the platform.protected EventHubprotected ViewportTheViewportfor the platform. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected SolaPlatform.PointerCoordinateadjustPointerForViewport(float x, float y) Convenience method for calculating adjusted pointer coordinate considering the currentAspectModeof theViewport.protected SolaPlatform.PointerCoordinateadjustPointerForViewport(int x, int y) Convenience method for calculating adjusted pointer coordinate considering the currentAspectModeof theViewport.protected abstract voidbeforeRender(Renderer renderer) Method called before each render frame.protected SolaPlatform.GameLoopProviderBuilds theGameLoopfor this platform.protected RendererbuildRenderer(SolaConfiguration solaConfiguration) Builds theRendererfor this platform.abstract SolaPlatformIdentifierprotected abstract voidinitializePlatform(SolaConfiguration solaConfiguration, SolaPlatform.SolaPlatformInitialization solaPlatformInitialization) Method to initialize aSolaPlatform.abstract voidonKeyPressed(Consumer<KeyEvent> keyEventConsumer) Registers an on key pressed listener.abstract voidonKeyReleased(Consumer<KeyEvent> keyEventConsumer) Registers an on key released listener.abstract voidonMouseMoved(Consumer<MouseEvent> mouseEventConsumer) Registers an on mouse moved listener.abstract voidonMousePressed(Consumer<MouseEvent> mouseEventConsumer) Registers an on mouse pressed listener.abstract voidonMouseReleased(Consumer<MouseEvent> mouseEventConsumer) Registers an on mouse released listener.abstract voidonMouseWheel(Consumer<MouseWheelEvent> mouseWheelEventConsumer) Registers an on mouse wheel listener.protected abstract voidMain render frame method.abstract voidonTouch(Consumer<TouchEvent> touchEventConsumer) Registers an on touch listener.voidMain entry point for starting aSola.protected abstract voidpopulateAssetLoaderProvider(AssetLoaderProvider assetLoaderProvider) Method to populate theSolaPlatformAssetLoaderProviderwithAssetLoaders thatSolawill be able to use.abstract voidsetVirtualKeyboardVisible(boolean visible) Sets the visibility of the virtual keyboard.
-
Field Details
-
renderer
TheRendererfor the platform. -
gameLoop
TheGameLoopfor the platform. -
viewport
TheViewportfor the platform. -
solaEventHub
-
socketClient
TheSocketClientfor the platform. -
restClient
TheRestClientfor the platform.
-
-
Constructor Details
-
SolaPlatform
public SolaPlatform()
-
-
Method Details
-
play
Main entry point for starting aSola.- Parameters:
sola- theSolato start
-
getRenderer
- Returns:
- the platform's
Renderer
-
getViewport
- Returns:
- the platform's
Viewport
-
getSocketClient
- Returns:
- the platform's
SocketClient
-
getRestClient
- Returns:
- the platform's
RestClient
-
getIdentifier
- Returns:
- the platform's identifier
-
onKeyPressed
Registers an on key pressed listener.- Parameters:
keyEventConsumer- the method called when key is pressed
-
onKeyReleased
Registers an on key released listener.- Parameters:
keyEventConsumer- the method called when key is released
-
onMouseMoved
Registers an on mouse moved listener.- Parameters:
mouseEventConsumer- the method called when mouse is moved
-
onMousePressed
Registers an on mouse pressed listener.- Parameters:
mouseEventConsumer- the method called when mouse is pressed
-
onMouseReleased
Registers an on mouse released listener.- Parameters:
mouseEventConsumer- the method called when mouse is released
-
onMouseWheel
Registers an on mouse wheel listener.- Parameters:
mouseWheelEventConsumer- the method called when a mouse wheel interaction takes place
-
onTouch
Registers an on touch listener.- Parameters:
touchEventConsumer- the method called when a touch interaction takes place
-
setVirtualKeyboardVisible
public abstract void setVirtualKeyboardVisible(boolean visible) Sets the visibility of the virtual keyboard.- Parameters:
visible- whether the virtual keyboard should be visible or not
-
initializePlatform
protected abstract void initializePlatform(SolaConfiguration solaConfiguration, SolaPlatform.SolaPlatformInitialization solaPlatformInitialization) Method to initialize aSolaPlatform. This operation can be async. It will provide the configuration from the).- Parameters:
solaConfiguration- the Sola configurationsolaPlatformInitialization- callSolaPlatform.SolaPlatformInitialization.finish()when platform initialization is finished
-
beforeRender
Method called before each render frame.- Parameters:
renderer- theRenderer
-
onRender
Main render frame method.- Parameters:
renderer- theRenderer
-
populateAssetLoaderProvider
Method to populate theSolaPlatformAssetLoaderProviderwithAssetLoaders thatSolawill be able to use.- Parameters:
assetLoaderProvider- theAssetLoaderProvider
-
buildRenderer
Builds theRendererfor this platform. Default implementation will use theSoftwareRendererimplementation.- Parameters:
solaConfiguration- theSolaConfigurationfor theSola- Returns:
- the built
Renderer
-
buildGameLoop
Builds theGameLoopfor this platform. Default implementation will use theFixedUpdateGameLoopimplementation.- Returns:
- the built
GameLoop
-
adjustPointerForViewport
Convenience method for calculating adjusted pointer coordinate considering the currentAspectModeof theViewport.- Parameters:
x- the raw x coordinate of the pointery- the raw y coordinate of the pointer- Returns:
- the viewport adjusted pointer coordinate
-
adjustPointerForViewport
Convenience method for calculating adjusted pointer coordinate considering the currentAspectModeof theViewport.- Parameters:
x- the raw x coordinate of the pointery- the raw y coordinate of the pointer- Returns:
- the viewport adjusted pointer coordinate
-