v0.7.4b: cleaned up some miscellaneous android dependencies
This commit is contained in:
parent
ec0657fcd6
commit
11efd1d0c3
|
@ -23,8 +23,6 @@ package com.watabou.glwrap;
|
|||
|
||||
import com.badlogic.gdx.Gdx;
|
||||
|
||||
import javax.microedition.khronos.opengles.GL10;
|
||||
|
||||
public class Blending {
|
||||
|
||||
public static void useDefault(){
|
||||
|
@ -33,21 +31,21 @@ public class Blending {
|
|||
}
|
||||
|
||||
public static void enable(){
|
||||
Gdx.gl.glEnable( GL10.GL_BLEND );
|
||||
Gdx.gl.glEnable( Gdx.gl.GL_BLEND );
|
||||
}
|
||||
|
||||
public static void disable(){
|
||||
Gdx.gl.glDisable( GL10.GL_BLEND );
|
||||
Gdx.gl.glDisable( Gdx.gl.GL_BLEND );
|
||||
}
|
||||
|
||||
//in this mode colors overwrite eachother, based on alpha value
|
||||
public static void setNormalMode(){
|
||||
Gdx.gl.glBlendFunc( GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA );
|
||||
Gdx.gl.glBlendFunc( Gdx.gl.GL_SRC_ALPHA, Gdx.gl.GL_ONE_MINUS_SRC_ALPHA );
|
||||
}
|
||||
|
||||
//in this mode colors add to eachother, eventually reaching pure white
|
||||
public static void setLightMode(){
|
||||
Gdx.gl.glBlendFunc( GL10.GL_SRC_ALPHA, GL10.GL_ONE );
|
||||
Gdx.gl.glBlendFunc( Gdx.gl.GL_SRC_ALPHA, Gdx.gl.GL_ONE );
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -26,6 +26,8 @@ import android.graphics.Canvas;
|
|||
import android.graphics.Paint;
|
||||
import android.graphics.Typeface;
|
||||
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.backends.android.AndroidApplication;
|
||||
import com.badlogic.gdx.graphics.Pixmap;
|
||||
import com.watabou.gltextures.SmartTexture;
|
||||
import com.watabou.glwrap.Matrix;
|
||||
|
@ -240,7 +242,7 @@ public class RenderedText extends Image {
|
|||
|
||||
public static void setFont(String asset){
|
||||
if (asset == null) font = null;
|
||||
else font = Typeface.createFromAsset(Game.instance.getAssets(), asset);
|
||||
else font = Typeface.createFromAsset(((AndroidApplication)Gdx.app).getAssets(), asset);
|
||||
clearCache();
|
||||
}
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
|
||||
package com.watabou.noosa;
|
||||
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.watabou.input.KeyEvent;
|
||||
import com.watabou.utils.Signal;
|
||||
|
||||
|
@ -72,7 +73,7 @@ public class Scene extends Group {
|
|||
}
|
||||
|
||||
protected void onBackPressed() {
|
||||
Game.instance.finish();
|
||||
Gdx.app.exit();
|
||||
}
|
||||
|
||||
protected void onMenuPressed() {
|
||||
|
|
|
@ -21,7 +21,8 @@
|
|||
|
||||
package com.watabou.utils;
|
||||
|
||||
import com.watabou.noosa.Game;
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.files.FileHandle;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
|
@ -30,17 +31,18 @@ import java.io.IOException;
|
|||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
|
||||
//TODO should consider migrating away from use of File.java here. Can probably just use strings
|
||||
public class FileUtils {
|
||||
|
||||
// Files
|
||||
|
||||
public static boolean fileExists( String name ){
|
||||
File file = new File(Game.instance.getFilesDir(), name);
|
||||
FileHandle file = Gdx.files.local(name);
|
||||
return file.exists() && !file.isDirectory();
|
||||
}
|
||||
|
||||
public static File getFile( String name ){
|
||||
return getFile( Game.instance.getFilesDir(), name);
|
||||
return Gdx.files.local(name).file();
|
||||
}
|
||||
|
||||
public static File getFile( File base, String name ){
|
||||
|
@ -52,7 +54,7 @@ public class FileUtils {
|
|||
}
|
||||
|
||||
public static boolean deleteFile( String name ){
|
||||
return Game.instance.deleteFile( name );
|
||||
return Gdx.files.local(name).delete();
|
||||
}
|
||||
|
||||
public static boolean deleteFile( File file ){
|
||||
|
@ -63,13 +65,13 @@ public class FileUtils {
|
|||
// Directories
|
||||
|
||||
public static boolean dirExists( String name ){
|
||||
File dir = new File(Game.instance.getFilesDir(), name);
|
||||
FileHandle dir = Gdx.files.local( name );
|
||||
return dir.exists() && dir.isDirectory();
|
||||
}
|
||||
|
||||
//base directory
|
||||
public static File getDir( String name ){
|
||||
return getDir( Game.instance.getFilesDir(), name);
|
||||
return Gdx.files.local( name ).file();
|
||||
}
|
||||
|
||||
public static File getDir( File base, String name ){
|
||||
|
@ -106,7 +108,7 @@ public class FileUtils {
|
|||
|
||||
//only works for base path
|
||||
public static Bundle bundleFromFile( String fileName ) throws IOException{
|
||||
return bundleFromStream(Game.instance.openFileInput( fileName ));
|
||||
return bundleFromStream(Gdx.files.local(fileName).read());
|
||||
}
|
||||
|
||||
public static Bundle bundleFromFile( File file ) throws IOException{
|
||||
|
@ -123,7 +125,7 @@ public class FileUtils {
|
|||
|
||||
//only works for base path
|
||||
public static void bundleToFile( String fileName, Bundle bundle ) throws IOException{
|
||||
bundleToStream( Game.instance.openFileOutput( fileName, Game.MODE_PRIVATE ), bundle);
|
||||
bundleToStream( Gdx.files.local(fileName).write(false), bundle);
|
||||
}
|
||||
|
||||
public static void bundleToFile( File file, Bundle bundle ) throws IOException{
|
||||
|
|
Loading…
Reference in New Issue
Block a user