java.lang.Object
technology.sola.engine.graphics.SolaGraphics.Builder
- Enclosing class:
- SolaGraphics
Builder for
SolaGraphics.-
Constructor Summary
ConstructorsConstructorDescriptionBuilder(SolaPlatform platform, technology.sola.ecs.SolaEcs solaEcs) Creates a newSolaGraphics.Builderinstance. -
Method Summary
Modifier and TypeMethodDescriptionbuildAndInitialize(AssetLoaderProvider assetLoaderProvider) Builds and initializes theSolaGraphicsinstance.withBackgroundColor(Color backgroundColor) Sets the backgroundColorcleared to each frame.withDebug(@Nullable SolaPhysics solaPhysics, EventHub eventHub, KeyboardInput keyboardInput) Enables debug rendering.withGui(MouseInput mouseInput) Sets the builder to add aGuiDocumentand related systems.withGui(MouseInput mouseInput, GuiTheme guiTheme) Sets the builder to add aGuiDocumentand related systems.withGui(MouseInput mouseInput, GuiTheme guiTheme, List<GuiElementJsonBlueprint<?, ?, ?>> additionalGuiElementJsonBlueprints) Sets the builder to add aGuiDocumentand related systems.Sets the builder to add lighting related graphics modules and systems.withLighting(Color ambientLightColor) Sets the builder to add lighting related graphics modules and systems.Sets the builder to not add the defaultSolaGraphicsModules when initializing theSolaGraphicsinstance.
-
Constructor Details
-
Builder
Creates a newSolaGraphics.Builderinstance.- Parameters:
platform- theSolaPlatforminstancesolaEcs- theSolaEcsinstance to attach systems to
-
-
Method Details
-
withBackgroundColor
Sets the backgroundColorcleared to each frame.- Parameters:
backgroundColor- theColorto clear to (defaults toColor.BLACK- Returns:
- this
-
withoutDefaultGraphicsModules
Sets the builder to not add the defaultSolaGraphicsModules when initializing theSolaGraphicsinstance.- Returns:
- this
-
withLighting
Sets the builder to add lighting related graphics modules and systems. Sets the ambient light color toColor.BLACK.- Returns:
- this
-
withLighting
Sets the builder to add lighting related graphics modules and systems. Sets the ambient light color to the desired color.- Parameters:
ambientLightColor- the color to set the ambient light to- Returns:
- this
-
withGui
Sets the builder to add aGuiDocumentand related systems. UsesDefaultThemeBuilder.buildLightTheme()for the theme.- Parameters:
mouseInput- theMouseInputinstance to use for theGuiDocument- Returns:
- this
-
withGui
Sets the builder to add aGuiDocumentand related systems. Uses desiredGuiTheme.- Parameters:
mouseInput- theMouseInputinstance to use for theGuiDocumentguiTheme- theGuiThemeto use for theGuiDocument- Returns:
- this
-
withGui
public SolaGraphics.Builder withGui(MouseInput mouseInput, GuiTheme guiTheme, List<GuiElementJsonBlueprint<?, ?, ?>> additionalGuiElementJsonBlueprints) Sets the builder to add aGuiDocumentand related systems. Uses desiredGuiTheme. Also registers additionalGuiElementJsonBlueprints.- Parameters:
mouseInput- theMouseInputinstance to use for theGuiDocumentguiTheme- theGuiThemeto use for theGuiDocumentadditionalGuiElementJsonBlueprints- additionalGuiElementJsonBlueprints to add to theGuiDocument- Returns:
- this
-
withDebug
public SolaGraphics.Builder withDebug(@Nullable SolaPhysics solaPhysics, EventHub eventHub, KeyboardInput keyboardInput) Enables debug rendering. IfSolaPhysicsis provided then collision debug rendering will also be present.- Parameters:
solaPhysics- the optionalSolaPhysicsinstance to attach toeventHub- theEventHubto add listeners tokeyboardInput- theKeyboardInputto control debug rendering state- Returns:
- this
-
buildAndInitialize
Builds and initializes theSolaGraphicsinstance. This will add requiredEcsSystems,AssetLoaders, aDefaultFontandSolaGraphicsModules.- Parameters:
assetLoaderProvider- theAssetLoaderProvider- Returns:
- the initialized
SolaGraphicsinstance
-