Android Open Source - block-composer Block Composer






From Project

Back to project page block-composer.

License

The source code is released under:

MIT License

If you think the Android project block-composer 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

package bwr.blockcomposer;
/* w ww.  j  a  v a  2s . com*/
import java.io.File;
import bwr.blockcomposer.gamedata.LevelMetadata;
import android.app.Application;
import android.os.Environment;

/* TODO:
 *  1. Game crashes when SD card is not present
 */

public class BlockComposer extends Application {

  public static final int NO_ENTRY_TEXT = -1;
  
  public static final LevelMetadata[] tutorialLevels = new LevelMetadata[] {
    new LevelMetadata("Tutorial 1", null, R.raw.tutorial1, 1, R.string.tutorial1_entry_text, R.string.default_exit_text, null),
    new LevelMetadata("Tutorial 2", null, R.raw.tutorial2, 1, R.string.tutorial2_entry_text, R.string.default_exit_text, null),
    new LevelMetadata("Tutorial 3", null, R.raw.tutorial3, 1, R.string.tutorial3_entry_text, R.string.tutorial3_exit_text, null),
  };
  
  public static final LevelMetadata[] levels = new LevelMetadata[] {
    new LevelMetadata("Level 0", null, R.raw.level0, 1, NO_ENTRY_TEXT, R.string.default_exit_text, "level0.state"),
    new LevelMetadata("Level 1", null, R.raw.level1, 1, NO_ENTRY_TEXT, R.string.default_exit_text, "level1.state"),
    new LevelMetadata("Level 2", null, R.raw.level2, 1, NO_ENTRY_TEXT, R.string.default_exit_text, "level2.state"),
    new LevelMetadata("Level 3", "Mike Welsh", R.raw.level3, 1, NO_ENTRY_TEXT, R.string.default_exit_text, "level3.state"),
    new LevelMetadata("Level 4", null, R.raw.level4, 1, NO_ENTRY_TEXT, R.string.default_exit_text, "level4.state"),
    new LevelMetadata("Level 5", null, R.raw.level5, 1, NO_ENTRY_TEXT, R.string.default_exit_text, "level5.state"),
  };
  
  public static final LevelMetadata[] contribLevels = new LevelMetadata[] {
    new LevelMetadata("Simultaneous Losses", "ibookyn", R.raw.simul_loss, 1, NO_ENTRY_TEXT, R.string.default_exit_text, "simul_loss.state"),
    new LevelMetadata("London Bridge", "ibookyn", R.raw.london_bridge, 1, NO_ENTRY_TEXT, R.string.default_exit_text, "london_bridge.state"),
    new LevelMetadata("Abacus", "ibookyn", R.raw.abacus, 1, NO_ENTRY_TEXT, R.string.default_exit_text, "abacus.state"),
    new LevelMetadata("Eisenhower", "ibookyn", R.raw.eisenhower, 1, NO_ENTRY_TEXT, R.string.default_exit_text, "eisenhower.state"),
    new LevelMetadata("Hell's Gate", "ibookyn", R.raw.hellsgate, 1, NO_ENTRY_TEXT, R.string.default_exit_text, "hellsgate.state"),
    new LevelMetadata("Aitken Basin", "ibookyn", R.raw.aitken, 1, NO_ENTRY_TEXT, R.string.default_exit_text, "aitken.state"),
    new LevelMetadata("Down the Hatch", "ibookyn", R.raw.hatch, 1, NO_ENTRY_TEXT, R.string.default_exit_text, "hatch.state"),
    new LevelMetadata("Leviathan", "ibookyn", R.raw.leviathan, 1, NO_ENTRY_TEXT, R.string.default_exit_text, "leviathan.state"),
    new LevelMetadata("Viper Pit", "ibookyn", R.raw.viperpit, 1, NO_ENTRY_TEXT, R.string.default_exit_text, "viperpit.state"),
  };
  
  
  public final File levelStorageDirectory = new File(Environment.getExternalStorageDirectory(), "blockcomposer");
  
  @Override
  public void onCreate() {
    super.onCreate();
    
    if(isExternalStorageAvailable() && !levelStorageDirectory.exists()) 
      levelStorageDirectory.mkdirs();
  }

  @Override
  public void onLowMemory() {
    super.onLowMemory();
  }

  @Override
  public void onTerminate() {
    super.onTerminate();
  }
  
  public boolean isExternalStorageAvailable() {
    String state = Environment.getExternalStorageState();
    
    if (Environment.MEDIA_MOUNTED.equals(state)) {
      return true;
    } 
    
    return false;
  }
}




Java Source Code List

bwr.blockcomposer.AnimationFinishedListener.java
bwr.blockcomposer.BlockComposerActivity.java
bwr.blockcomposer.BlockComposerRenderer.java
bwr.blockcomposer.BlockComposer.java
bwr.blockcomposer.Camera.java
bwr.blockcomposer.GameResources.java
bwr.blockcomposer.OnUpdateAction.java
bwr.blockcomposer.gamedata.Block.java
bwr.blockcomposer.gamedata.GameEntity.java
bwr.blockcomposer.gamedata.GameState.java
bwr.blockcomposer.gamedata.LevelDimensions.java
bwr.blockcomposer.gamedata.LevelMask.java
bwr.blockcomposer.gamedata.LevelMetadata.java
bwr.blockcomposer.gamedata.LevelStore.java
bwr.blockcomposer.gamedata.Level.java
bwr.blockcomposer.gamedata.Move.java
bwr.blockcomposer.gamedata.StaticLevelStore.java
bwr.blockcomposer.gamedata.UserLevelStore.java
bwr.blockcomposer.misc.GLUtility.java
bwr.blockcomposer.misc.Timer.java
bwr.blockcomposer.models.AxisRenderer.java
bwr.blockcomposer.models.Model.java
bwr.blockcomposer.models.SelectBoxRenderer.java
bwr.blockcomposer.modes.EditMode.java
bwr.blockcomposer.modes.GameDialogMode.java
bwr.blockcomposer.modes.GameMode.java
bwr.blockcomposer.modes.LevelImportMode.java
bwr.blockcomposer.modes.LevelSelectMode.java
bwr.blockcomposer.modes.LogoDisplayMode.java
bwr.blockcomposer.modes.ModeController.java
bwr.blockcomposer.modes.Mode.java
bwr.blockcomposer.modes.OverlayMode.java
bwr.blockcomposer.types.FlipRotateFloat.java
bwr.blockcomposer.types.FloatValueVector3.java
bwr.blockcomposer.types.FloatValue.java
bwr.blockcomposer.types.IntVector.java
bwr.blockcomposer.types.RotatingFloat.java
bwr.blockcomposer.ui.TextRenderer.java
bwr.blockcomposer.ui.UIElementPicture.java
bwr.blockcomposer.ui.UIElementText.java
bwr.blockcomposer.ui.UIElement.java