Package com.csse3200.game.services
Class ServiceLocator
java.lang.Object
com.csse3200.game.services.ServiceLocator
A simplified implementation of the Service Locator pattern:
https://martinfowler.com/articles/injection.html#UsingAServiceLocator
Allows global access to a few core game services. Warning: global access is a trap and should be used extremely sparingly. Read the wiki for details (https://github.com/UQcsse3200/game-engine/wiki/Service-Locator).
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
clear()
static DayNightCycle
static DialogueBoxService
static EntityService
static GameArea
static InGameTime
static InputService
static LightingService
static ParticleService
static PhysicsService
static RenderService
static ResourceService
static GameTime
static void
registerDayNightCycle
(DayNightCycle dayNightCycle) static void
static void
registerEntityService
(EntityService service) static void
registerGameArea
(GameArea area) static void
registerInGameTime
(InGameTime inGameTime) static void
registerInputService
(InputService source) static void
static void
static void
registerPhysicsService
(PhysicsService service) static void
registerRenderService
(RenderService service) static void
static void
registerTimeSource
(GameTime source) static void
Sets the GdxGame for any services that require it (should not be used unless necessary).
-
Method Details
-
setGame
Sets the GdxGame for any services that require it (should not be used unless necessary). Errors if the game is set twice- Parameters:
g
- the instance of GdxGame that is running
-
getDialogueBoxService
-
getEntityService
-
getRenderService
-
getPhysicsService
-
getTimeSource
-
getInputService
-
getResourceService
-
getLightingService
-
getParticleService
-
getGameArea
-
registerGameArea
-
registerEntityService
-
registerDialogueBoxService
-
registerRenderService
-
registerPhysicsService
-
registerTimeSource
-
registerInputService
-
registerResourceService
-
registerLightingService
-
registerParticleService
-
clear
public static void clear() -
getDayNightCycle
-
registerDayNightCycle
-
registerInGameTime
-
getInGameTime
-