Rogue: Savage Rats, a retro-themed dungeon crawler
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
rogue-savage-rats/src/mightypork/rogue/bus/Subsystem.java

42 lines
815 B

package mightypork.rogue.bus;
import mightypork.rogue.AppAccess;
import mightypork.utils.control.Destroyable;
import mightypork.utils.control.bus.clients.DelegatingClient;
import mightypork.utils.control.bus.clients.ToggleableClient;
/**
* App event bus client, to be used for subsystems, screens and anything that
* needs access to the eventbus
*
* @author MightyPork
*/
public abstract class Subsystem extends ChildClient implements DelegatingClient, ToggleableClient, Destroyable {
public Subsystem(AppAccess app) {
super(app);
bus().subscribe(this);
}
@Override
public final void destroy()
{
deinit();
setListening(false);
bus().unsubscribe(this);
}
/**
* Deinitialize the subsystem<br>
* (called during destruction)
*/
protected abstract void deinit();
}