v0.4.3: implemented a new 'Power Saver' mode
As a bonus, this allows shattered to run on small screen devices, by forcing power saver, which downsamples in this specific case allowing for the minimum 2x game scale.
This commit is contained in:
@@ -24,6 +24,7 @@ package com.watabou.input;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
import com.watabou.noosa.Game;
|
||||
import com.watabou.utils.PointF;
|
||||
import com.watabou.utils.Signal;
|
||||
|
||||
@@ -96,6 +97,9 @@ public class Touchscreen {
|
||||
|
||||
float x = e.getX( index );
|
||||
float y = e.getY( index );
|
||||
|
||||
x /= (Game.dispWidth / (float)Game.width);
|
||||
y /= (Game.dispHeight / (float)Game.height);
|
||||
|
||||
start = new PointF( x, y );
|
||||
current = new PointF( x, y );
|
||||
@@ -104,7 +108,13 @@ public class Touchscreen {
|
||||
}
|
||||
|
||||
public void update( MotionEvent e, int index ) {
|
||||
current.set( e.getX( index ), e.getY( index ) );
|
||||
float x = e.getX( index );
|
||||
float y = e.getY( index );
|
||||
|
||||
x /= (Game.dispWidth / (float)Game.width);
|
||||
y /= (Game.dispHeight / (float)Game.height);
|
||||
|
||||
current.set( x, y );
|
||||
}
|
||||
|
||||
public Touch up() {
|
||||
|
||||
@@ -53,8 +53,12 @@ import android.view.View;
|
||||
public class Game extends Activity implements GLSurfaceView.Renderer, View.OnTouchListener {
|
||||
|
||||
public static Game instance;
|
||||
|
||||
//actual size of the display
|
||||
public static int dispWidth;
|
||||
public static int dispHeight;
|
||||
|
||||
// Actual size of the screen
|
||||
// Size of the EGL surface view
|
||||
public static int width;
|
||||
public static int height;
|
||||
|
||||
@@ -107,6 +111,8 @@ public class Game extends Activity implements GLSurfaceView.Renderer, View.OnTou
|
||||
DisplayMetrics m = new DisplayMetrics();
|
||||
getWindowManager().getDefaultDisplay().getMetrics( m );
|
||||
density = m.density;
|
||||
dispHeight = m.heightPixels;
|
||||
dispWidth = m.widthPixels;
|
||||
|
||||
try {
|
||||
version = getPackageManager().getPackageInfo( getPackageName(), 0 ).versionName;
|
||||
|
||||
Reference in New Issue
Block a user