Package org.seattlegamer.spacegame.core

Examples of org.seattlegamer.spacegame.core.Bus


public class ComponentTests {

  @Test
  public void toStringHasClassName() {
    Bus bus = new BusImpl();
    Component component = new TestComponent(bus, UUID.randomUUID());
    String string = component.toString();
    assertEquals("TestComponent", string);
  }
View Full Code Here


  public @Bean Canvas canvas() {
    return new GameCanvas(input(), propertiesAccessor().getString("title", "Space Game!"), displayMode());
  }
 
  public @Bean StateManager stateManager() {
    Bus bus = bus();
    Collection<State> states = new LinkedList<State>();
    states.add(gameState());
    states.add(menuState());
    StateManager stateManager = new StateManager(states);
    bus.register(stateManager, null);
    bus.broadcast(new StateChange(MenuState.class));
    return stateManager;

  }
View Full Code Here

  public @Bean MenuState menuState() {
    return new MenuState(bus(), resourceCache());
  }
 
  public @Bean GameLauncher gameLauncher() {
    Bus bus = bus();
    GameLauncher gameLauncher = new GameLauncher(bus(), gameState());
    bus.register(gameLauncher, null);
    return gameLauncher;
  }
View Full Code Here

  }
 
  @Test
  public void canRegisterAndDeregisterComponentsWithBus() {
   
    Bus bus = new BusImpl();
   
    UUID entityId = UUID.randomUUID();
   
    Foo fooOne = new Foo(bus, entityId);
   
    bus.register(fooOne, entityId);
    bus.send("blah", entityId);
   
    assertEquals("blah", fooOne.fooValue);
    fooOne.fooValue = null;

    bus.deregister(fooOne, entityId);
   
    assertEquals(null, fooOne.fooValue);

  }
View Full Code Here

  }
 
  @Test
  public void unsubscribedMessagesBroadcastNowhereSilently() {
   
    Bus bus = new BusImpl();
    bus.broadcast("buzz");
   
  }
View Full Code Here

  }
 
  @Test
  public void registrationsTakeIntoAccountSuperClass() {
   
    Bus bus = new BusImpl();
   
    UUID entityId = UUID.randomUUID();
   
    Bar bar = new Bar(bus, entityId);
   
    bus.register(bar, entityId);
    bus.broadcast("blah");
   
    assertEquals("blah", bar.fooValue);
    assertEquals("blah", bar.barValue);

  }
View Full Code Here

public class GameLauncherTests {

  @Test
  public void newGameCreatedWithPlayersFromManifest() throws IOException {
   
    Bus bus = new BusImpl();
    //TODO: use Mockito for dependencies
    ResourceCache resourceCache = new ResourceCache() {
      @Override public void putImage(String name, Object asset) {}
      @Override public Image getImage(String name) throws IOException { return null; }
    };
View Full Code Here

TOP

Related Classes of org.seattlegamer.spacegame.core.Bus

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.