Android Open Source - Layrd Layrd Graphics






From Project

Back to project page Layrd.

License

The source code is released under:

MIT License

If you think the Android project Layrd listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

/*
 * Graphics component which will draw all game objects on the screen.
 *//*from  w  w w .  j ava2s .  c o m*/
package com.Voltronics.game;

import java.util.HashMap;
import java.util.Map;




import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.Sprite;
//import com.badlogic.gdx.scenes.scene2d.ui.List;

public class LayrdGraphics {

  private static Map<String, Texture> texturesManager = new HashMap<String, Texture>();
  private static Map<String, Texture> BGsManager = new HashMap<String, Texture>();;
  
  
  public static void loadTextures(String[] keys, String[] paths){
    for(int i = 0; i < paths.length; i++)
      loadTexture(keys[i], paths[i]);
  }
  
  public static void loadTexture(String key, String path){
    texturesManager.put(key, new Texture( Gdx.files.internal(path) ));
  }
  
  
  public static Texture getTexture(String textureName){
    if(texturesManager.containsKey(textureName)){
      return texturesManager.get(textureName);
    }
    
    // no texture found, return plain texture
    System.out.println("Texture: " + textureName + " cannot be found");
    return new Texture("");
    //return new Texture("");
  }
  
  public static Sprite getSprite(String spriteName){
    return new Sprite(getTexture(spriteName));
  }
  
  
  public static void loadBGs(String[] keys, String[] paths){
    for(int i = 0; i < paths.length; i++)
      loadBG(keys[i], paths[i]);
  }
  
  public static void loadBG(String key, String path){
    BGsManager.put(key, new Texture( Gdx.files.internal(path) ));
  }
  
  
  public static Texture getBG(String spriteName){
    if(BGsManager.containsKey(spriteName)){
      return BGsManager.get(spriteName);
    }
    
    // no texture found, return plain texture
    return new Texture("");
    //return new Texture("");
  }
}




Java Source Code List

com.Voltronics.game.GameObject.java
com.Voltronics.game.LayrdGame.java
com.Voltronics.game.LayrdGoogleGameInterface.java
com.Voltronics.game.LayrdGraphics.java
com.Voltronics.game.LayrdInput.java
com.Voltronics.game.LayrdLogic.java
com.Voltronics.game.LayrdPhysics.java
com.Voltronics.game.LayrdScreenGame.java
com.Voltronics.game.LayrdScreenMainMenu.java
com.Voltronics.game.LayrdSound.java
com.Voltronics.game.LayrdWorld.java
com.Voltronics.game.Player.java
com.Voltronics.game.TutorialScreen.java
com.Voltronics.game.android.AndroidLauncher.java
com.google.example.games.basegameutils.BaseGameActivity.java
com.google.example.games.basegameutils.GameHelperUtils.java
com.google.example.games.basegameutils.GameHelper.java