Package org.seattlegamer.spacegame.utils

Examples of org.seattlegamer.spacegame.utils.PropertiesAccessor


  }
 
  @Test
  public void canAccessStrings() {

    PropertiesAccessor accessor = new PropertiesAccessor(testProperties);
    String fooStringRetrieved = accessor.getString(FOO_STRING_KEY, "");
    assertEquals(FOO_STRING, fooStringRetrieved);
   
  }
View Full Code Here


  }
 
  @Test
  public void canAccessIntegers() {

    PropertiesAccessor accessor = new PropertiesAccessor(testProperties);
    Integer fooIntegerRetrieved = accessor.getInteger(FOO_INTEGER_KEY, 123);
    assertEquals(FOO_INTEGER, fooIntegerRetrieved);
   
  }
View Full Code Here

  }
 
  @Test
  public void canAccessBooleans() {

    PropertiesAccessor accessor = new PropertiesAccessor(testProperties);
    boolean fooBooleanRetrieved = accessor.getBoolean(FOO_BOOLEAN_KEY, false);
    assertEquals(FOO_BOOLEAN, fooBooleanRetrieved);
   
  }
View Full Code Here

  private static final String PROPERTIES_FILE_PATH = "/spacegame.properties";
 
  public @Bean PropertiesAccessor propertiesAccessor() {
    Properties properties = PropertiesLoader.loadProperties(PROPERTIES_FILE_PATH);
    return new PropertiesAccessor(properties);
  }
View Full Code Here

    return new PropertiesAccessor(properties);
  }
 
  public @Bean DisplayMode displayMode() {
   
    PropertiesAccessor propertiesAccessor = propertiesAccessor();
   
    return new DisplayMode(
      propertiesAccessor.getInteger("displaymode.width", 1280),
      propertiesAccessor.getInteger("displaymode.height", 800),
      propertiesAccessor.getInteger("displaymode.bit_depth", 16),
      propertiesAccessor.getInteger("displaymode.refresh_rate", 60));

  }
View Full Code Here

    bus.register(gameLauncher, null);
    return gameLauncher;
  }

  public @Bean Engine engine() {
    PropertiesAccessor propertiesAccessor = propertiesAccessor();
    int targetFramerate = propertiesAccessor.getInteger("target_framerate", 100);
    return new Engine(targetFramerate, keyInput(), pointerInput(), renderer(), stateManager());
  }
View Full Code Here

    return new Input();
  }

  public @Bean ResourceCache resourceCache() {
    InMemoryResourceCache inMemoryResourceCache = new InMemoryResourceCache(scaledImageResourceLoader());
    PropertiesAccessor propertiesAccessor = propertiesAccessor();
    int scale = propertiesAccessor.getInteger("scale", 80);

    //TODO: remove this hack when planet generation is in
    TestImageCreator testImageCreator = new TestImageCreator(scale);
    Image player = testImageCreator.buildPlayer(Color.BLUE);
    inMemoryResourceCache.putImage("replaceme_hardcoded_planet", player);
View Full Code Here

   
    return inMemoryResourceCache;
  }

  public @Bean ResourceLoader<Image> scaledImageResourceLoader() {
    PropertiesAccessor propertiesAccessor = propertiesAccessor();
    int scale = propertiesAccessor.getInteger("scale", 80);
    return new ScaledImageResourceLoader(scale);
  }
View Full Code Here

TOP

Related Classes of org.seattlegamer.spacegame.utils.PropertiesAccessor

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.