Android Open Source - java-androidframework Game Data






From Project

Back to project page java-androidframework.

License

The source code is released under:

This project is licensed under the [CC0 1.0 Agreement](http://creativecommons.org/publicdomain/zero/1.0/). To the extent possible under law, Pete Schmitz has waived all copyright and related or neigh...

If you think the Android project java-androidframework 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 com.gamepatriot.framework2d.implementation;
/*from  www  .j  a  va2s.co  m*/
import android.app.Activity;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;

import com.gamepatriot.androidframework.framework.AndroidGameData;

/**
 * The GameData class is used to save and load dynamic data associated with the application. 
 * 
 * @see AndroidGameData
 * @author Pete Schmitz, May 8, 2013
 *
 */
public class GameData implements AndroidGameData {
  
  /** The unique save path to use for this application. **/
  public static String SAVE_PATH = "AndroidFramework";
  
  
  //References
  
  /** The reference to this applications {@link Main} object. **/
  private Main main;
  
  
  /**
   * @param $main    Instantiated main class, primary activity of the application.
   */
  public GameData(Main $main){
    main = $main;
    
    load();
  }
  
  @Override
  public void save() {
    Editor $editor = main.getSharedPreferences(SAVE_PATH, Activity.MODE_PRIVATE).edit();
    
    //$editor.putInt("levels", levels);
    
    $editor.commit();
  }
  
  @Override
  public void load() {
    SharedPreferences $sharedPreferences = main.getSharedPreferences(SAVE_PATH, Activity.MODE_PRIVATE);
    
    //levels = $sharedPreferences.getInt("levels", DEFAULT_LEVELS);
  }
  
  @Override
  public void clear() {
    Editor $editor = main.getSharedPreferences(SAVE_PATH, Activity.MODE_PRIVATE).edit();
    
    $editor.clear().commit();
  }
  
  @Override
  public void reset() {
    clear();
    load();
  }
  
  
  
}




Java Source Code List

com.gamepatriot.androidframework.framework.AndroidAnimationData.java
com.gamepatriot.androidframework.framework.AndroidAtlas.java
com.gamepatriot.androidframework.framework.AndroidBasicShape.java
com.gamepatriot.androidframework.framework.AndroidGameData.java
com.gamepatriot.androidframework.framework.AndroidImage.java
com.gamepatriot.androidframework.framework.AndroidInputter.java
com.gamepatriot.androidframework.framework.AndroidMain.java
com.gamepatriot.androidframework.framework.AndroidMusicHandler.java
com.gamepatriot.androidframework.framework.AndroidPool.java
com.gamepatriot.androidframework.framework.AndroidRenderer.java
com.gamepatriot.androidframework.framework.AndroidScreen.java
com.gamepatriot.androidframework.framework.AndroidShape.java
com.gamepatriot.androidframework.framework.AndroidSoundHandler.java
com.gamepatriot.framework2d.classes.FPS.java
com.gamepatriot.framework2d.implementation.AnimationData.java
com.gamepatriot.framework2d.implementation.Atlas.java
com.gamepatriot.framework2d.implementation.BasicShape.java
com.gamepatriot.framework2d.implementation.GameData.java
com.gamepatriot.framework2d.implementation.Image.java
com.gamepatriot.framework2d.implementation.Inputter.java
com.gamepatriot.framework2d.implementation.Main.java
com.gamepatriot.framework2d.implementation.MusicHandler.java
com.gamepatriot.framework2d.implementation.Pool.java
com.gamepatriot.framework2d.implementation.Renderer.java
com.gamepatriot.framework2d.implementation.Screen.java
com.gamepatriot.framework2d.implementation.Shape.java
com.gamepatriot.framework2d.implementation.SoundHandler.java
com.gamepatriot.framework2d.screens.Example.java