Blog
-
Who’s in Charge?
Mr Mike’s game event management is very good, but I couldn’t understand how to disable listeners if a game state isn’t active. For instance, we wouldn’t want the player listening to keyboard events while the menu is being displayed. Initially I was thinking that maybe each game state should have its own event manager but that would complicate matters handling global events or state-specific events. Finally came up with the solution that each game state should listen to events from the InputManager and pass them onto its relevant objects if its currently active. The Engine would be responsible for the InputManager and not the Window for some reason that I can’t remember.
-
Hooray! Movement!
After a bit of struggling with multiple KeyEvents being fired because of the keyboard repeat thingy, the input manager now fires key press and release events correctly. The player can now move around the screen. Albeit a red triangle player with no sprite and no camera tracking.
Mouse next.
Why can’t Java overload operators?
-
Learning from Code Analysis
So I’ve just started using the code analysis tool in IntelliJ. I set up what I thought would be suitable rules and it came back with 812 issues. The game engine isn’t much more than an event manager, an entity system and an abstract renderer. A quick scan through and they all look like things I should be fixing. Guess I’ve still got a lot to learn about Java. And I thought heading down the Java route from C++ would be a breeze!
-
Ok, its starting to confuse…
… there’s a factory that creates templates for components that are added to game objects.
public void registerGameObjectComponentTemplateFactory(long componentId,
IGameObjectComponentTemplateFactory gameObjectComponentTemplateFactory){
m_gameObjectComponentTemplateFactories.put(componentId, gameObjectComponentTemplateFactory);
}