mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-11-27 22:39:53 +00:00
Android improvements and version update
This commit is contained in:
parent
f5e5977bbe
commit
3267c2dc23
@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="com.roguetemple.hyperroid"
|
package="com.roguetemple.hyperroid"
|
||||||
android:versionCode="10003" android:versionName="10.0c"
|
android:versionCode="10005" android:versionName="10.0e"
|
||||||
android:installLocation="auto">
|
android:installLocation="auto">
|
||||||
<!-- <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> -->
|
<!-- <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> -->
|
||||||
<!-- <uses-sdk android:minSdkVersion="9" android:targetSdkVersion="9" /> -->
|
<!-- <uses-sdk android:minSdkVersion="9" android:targetSdkVersion="9" /> -->
|
||||||
|
@ -5,8 +5,11 @@ import javax.microedition.khronos.opengles.GL10;
|
|||||||
|
|
||||||
// import android.graphics.Paint;
|
// import android.graphics.Paint;
|
||||||
// import android.graphics.Path;
|
// import android.graphics.Path;
|
||||||
|
import android.content.Context;
|
||||||
import android.graphics.Typeface;
|
import android.graphics.Typeface;
|
||||||
import android.opengl.GLSurfaceView;
|
import android.opengl.GLSurfaceView;
|
||||||
|
import android.os.Build;
|
||||||
|
import android.os.PowerManager;
|
||||||
// bimport android.widget.Toast;
|
// bimport android.widget.Toast;
|
||||||
|
|
||||||
import com.android.texample.GLText;
|
import com.android.texample.GLText;
|
||||||
@ -25,7 +28,13 @@ public class HyperRenderer implements GLSurfaceView.Renderer {
|
|||||||
|
|
||||||
public void onDrawFrame(GL10 gl) {
|
public void onDrawFrame(GL10 gl) {
|
||||||
if(game.forceCanvas) return;
|
if(game.forceCanvas) return;
|
||||||
gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
|
|
||||||
|
PowerManager pm = (PowerManager) game.getSystemService(Context.POWER_SERVICE);
|
||||||
|
boolean isScreenOn = Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT_WATCH ? pm.isInteractive() : pm.isScreenOn();
|
||||||
|
if(!isScreenOn) return;
|
||||||
|
if(!game.activityVisible) return;
|
||||||
|
|
||||||
|
gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
|
||||||
synchronized(game) {
|
synchronized(game) {
|
||||||
game.hv.updateGame();
|
game.hv.updateGame();
|
||||||
game.draw();
|
game.draw();
|
||||||
|
@ -340,9 +340,12 @@ public class HyperRogue extends Activity {
|
|||||||
int curpos[];
|
int curpos[];
|
||||||
float curvol;
|
float curvol;
|
||||||
|
|
||||||
|
public static boolean activityVisible = true;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onPause() {
|
protected void onPause() {
|
||||||
super.onPause();
|
super.onPause();
|
||||||
|
activityVisible = false;
|
||||||
|
|
||||||
boolean keep;
|
boolean keep;
|
||||||
|
|
||||||
@ -392,6 +395,7 @@ public class HyperRogue extends Activity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void onResume() {
|
protected void onResume() {
|
||||||
|
activityVisible = true;
|
||||||
super.onResume();
|
super.onResume();
|
||||||
if(backgroundmusic != null) {
|
if(backgroundmusic != null) {
|
||||||
try {backgroundmusic.prepare(); } catch(Exception e) {}
|
try {backgroundmusic.prepare(); } catch(Exception e) {}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.roguetemple.hyperroid;
|
package com.roguetemple.hyperroid;
|
||||||
|
|
||||||
|
import android.app.KeyguardManager;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
@ -8,6 +9,7 @@ import android.graphics.Path;
|
|||||||
import android.graphics.PorterDuff;
|
import android.graphics.PorterDuff;
|
||||||
import android.graphics.PorterDuffXfermode;
|
import android.graphics.PorterDuffXfermode;
|
||||||
import android.graphics.Typeface;
|
import android.graphics.Typeface;
|
||||||
|
import android.os.Build;
|
||||||
import android.os.PowerManager;
|
import android.os.PowerManager;
|
||||||
import android.os.SystemClock;
|
import android.os.SystemClock;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
@ -184,8 +186,9 @@ public class HyperView extends View {
|
|||||||
super.onDraw(canvas);
|
super.onDraw(canvas);
|
||||||
|
|
||||||
PowerManager pm = (PowerManager) game.getSystemService(Context.POWER_SERVICE);
|
PowerManager pm = (PowerManager) game.getSystemService(Context.POWER_SERVICE);
|
||||||
boolean isScreenOn = pm.isScreenOn();
|
boolean isScreenOn = Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT_WATCH ? pm.isInteractive() : pm.isScreenOn();
|
||||||
if(!isScreenOn) return;
|
if(!isScreenOn) return;
|
||||||
|
if(!game.activityVisible) return;
|
||||||
|
|
||||||
dc = canvas;
|
dc = canvas;
|
||||||
width = getWidth();
|
width = getWidth();
|
||||||
|
Loading…
Reference in New Issue
Block a user