Package generators

Source Code of generators.BackgroundGenerator

package generators;

import framework.component.ComponentSystem;
import framework.component.ParentComponent;
import framework.rendering.SpriteComponent;
import framework.spacial.PositionComponent;

public class BackgroundGenerator {
 
  private static final String BACKGROUND_FILENAME = "res/img/Background.png";
 
  public static void generateBackground(){
    ParentComponent backgroundParent = new ParentComponent("Background");
    ComponentSystem.getInstance().getRoot().addComponent(backgroundParent);
   
    backgroundParent.addComponent(new PositionComponent(0,0));
   
    SpriteComponent spriteComp = new SpriteComponent(BACKGROUND_FILENAME);
    spriteComp.setAlwaysOnBottom();
    backgroundParent.addComponent(spriteComp);
  }
}
TOP

Related Classes of generators.BackgroundGenerator

TOP
Copyright © 2018 www.massapi.com. 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.