Skip to content

Commit

Permalink
Fixed low processor mode on android. The fix was inspired by godoteng…
Browse files Browse the repository at this point in the history
…ine/godot#59606, although I did it differently.
  • Loading branch information
Relintai committed Mar 28, 2022
1 parent f4c49b0 commit 7641f06
Show file tree
Hide file tree
Showing 11 changed files with 2,440 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,14 @@ private void vibrate(int durationMs) {
}
}

/**
* Used by the native code (java_pandemonium_wrapper.h) to swap framebuffers.
*/
@Keep
public void requestFramebufferSwap() {
mView.requestFramebufferSwap();
}

public void restart() {
runOnUiThread(() -> {
if (pandemoniumHost != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,19 @@

package net.relintai.pandemonium.pandemonium;

import net.relintai.pandemonium.pandemonium.gl.PandemoniumGLSurfaceView;

import net.relintai.pandemonium.pandemonium.plugin.PandemoniumPlugin;
import net.relintai.pandemonium.pandemonium.plugin.PandemoniumPluginRegistry;
import net.relintai.pandemonium.pandemonium.utils.GLUtils;

import android.opengl.GLSurfaceView;

import javax.microedition.khronos.egl.EGLConfig;
import javax.microedition.khronos.opengles.GL10;

/**
* Pandemonium's renderer implementation.
*/
class PandemoniumRenderer implements GLSurfaceView.Renderer {
class PandemoniumRenderer implements PandemoniumGLSurfaceView.Renderer {
private final PandemoniumPluginRegistry pluginRegistry;
private boolean activityJustResumed = false;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@

package net.relintai.pandemonium.pandemonium;

import net.relintai.pandemonium.pandemonium.gl.PandemoniumGLSurfaceView;

import net.relintai.pandemonium.pandemonium.input.PandemoniumGestureHandler;
import net.relintai.pandemonium.pandemonium.input.PandemoniumInputHandler;
import net.relintai.pandemonium.pandemonium.utils.GLUtils;
Expand All @@ -40,7 +42,6 @@
import android.annotation.SuppressLint;
import android.content.Context;
import android.graphics.PixelFormat;
import android.opengl.GLSurfaceView;
import android.view.GestureDetector;
import android.view.KeyEvent;
import android.view.MotionEvent;
Expand All @@ -67,7 +68,7 @@
* that matches it exactly (with regards to red/green/blue/alpha channels
* bit depths). Failure to do so would result in an EGL_BAD_MATCH error.
*/
public class PandemoniumView extends GLSurfaceView {
public class PandemoniumView extends PandemoniumGLSurfaceView {
private static String TAG = PandemoniumView.class.getSimpleName();

private final Pandemonium pandemonium;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@
package net.relintai.pandemonium.pandemonium.config;

import net.relintai.pandemonium.pandemonium.utils.GLUtils;

import android.opengl.GLSurfaceView;
import net.relintai.pandemonium.pandemonium.gl.PandemoniumGLSurfaceView;

import javax.microedition.khronos.egl.EGL10;
import javax.microedition.khronos.egl.EGLConfig;
Expand All @@ -41,7 +40,7 @@
/**
* Used to select the egl config for pancake games.
*/
public class RegularConfigChooser implements GLSurfaceView.EGLConfigChooser {
public class RegularConfigChooser implements PandemoniumGLSurfaceView.EGLConfigChooser {
private static final String TAG = RegularConfigChooser.class.getSimpleName();

private int[] mValue = new int[1];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@

import net.relintai.pandemonium.pandemonium.PandemoniumLib;
import net.relintai.pandemonium.pandemonium.utils.GLUtils;
import net.relintai.pandemonium.pandemonium.gl.PandemoniumGLSurfaceView;

import android.opengl.GLSurfaceView;
import android.util.Log;

import javax.microedition.khronos.egl.EGL10;
Expand All @@ -44,7 +44,7 @@
/**
* Factory used to setup the opengl context for pancake games.
*/
public class RegularContextFactory implements GLSurfaceView.EGLContextFactory {
public class RegularContextFactory implements PandemoniumGLSurfaceView.EGLContextFactory {
private static final String TAG = RegularContextFactory.class.getSimpleName();

private static final int _EGL_CONTEXT_FLAGS_KHR = 0x30FC;
Expand Down
Loading

0 comments on commit 7641f06

Please sign in to comment.