Revision b6f7c7f2
Added by Leszek Koltunski over 4 years ago
- ID b6f7c7f2d18f73e783a704491325378bf67e696d
- Parent 09784afd
| src/main/java/org/distorted/main/RubikActivity.java | ||
|---|---|---|
| 41 | 41 |
import org.distorted.effects.BaseEffect; |
| 42 | 42 |
import org.distorted.library.main.DistortedLibrary; |
| 43 | 43 |
|
| 44 |
import org.distorted.library.message.EffectListener; |
|
| 45 | 44 |
import org.distorted.objects.TwistyObject; |
| 46 | 45 |
import org.distorted.scores.RubikScores; |
| 47 | 46 |
import org.distorted.scores.RubikScoresDownloader; |
| ... | ... | |
| 254 | 253 |
|
| 255 | 254 |
RubikDebug debug = RubikDebug.getInstance(); |
| 256 | 255 |
debug.onResume(this); |
| 256 |
RubikRenderer.mStartDebug = true; |
|
| 257 | 257 |
|
| 258 | 258 |
view.initialize(); |
| 259 | 259 |
restorePreferences(); |
| src/main/java/org/distorted/main/RubikDebug.java | ||
|---|---|---|
| 33 | 33 |
private static final int LOOP_NUM2 = 9; |
| 34 | 34 |
|
| 35 | 35 |
private String mDebug; |
| 36 |
private long mResumeTime; |
|
| 37 | 36 |
private int mNumReturned; |
| 38 | 37 |
private ActivityChanger mChanger; |
| 39 | 38 |
|
| ... | ... | |
| 50 | 49 |
private void initialize() |
| 51 | 50 |
{
|
| 52 | 51 |
mDebug = ""; |
| 53 |
mResumeTime = 0; |
|
| 54 | 52 |
mNumReturned= 0; |
| 55 | 53 |
} |
| 56 | 54 |
|
| ... | ... | |
| 113 | 111 |
public void onResume(ActivityChanger changer) |
| 114 | 112 |
{
|
| 115 | 113 |
mChanger = changer; |
| 116 |
mResumeTime = System.currentTimeMillis(); |
|
| 114 |
} |
|
| 115 |
|
|
| 116 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 117 |
|
|
| 118 |
public void onPause() |
|
| 119 |
{
|
|
| 120 |
initialize(); |
|
| 121 |
} |
|
| 122 |
|
|
| 123 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 117 | 124 |
|
| 125 |
public void onFirstDraw() |
|
| 126 |
{
|
|
| 118 | 127 |
final Timer timer = new Timer(); |
| 119 | 128 |
|
| 120 | 129 |
timer.scheduleAtFixedRate(new TimerTask() |
| ... | ... | |
| 134 | 143 |
} ,LOOP_INTERVAL, LOOP_INTERVAL); |
| 135 | 144 |
} |
| 136 | 145 |
|
| 137 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 138 |
|
|
| 139 |
public void onPause() |
|
| 140 |
{
|
|
| 141 |
initialize(); |
|
| 142 |
} |
|
| 143 |
|
|
| 144 | 146 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 145 | 147 |
|
| 146 | 148 |
public void onReturned() |
| src/main/java/org/distorted/main/RubikRenderer.java | ||
|---|---|---|
| 45 | 45 |
private final Fps mFPS; |
| 46 | 46 |
private boolean mErrorShown; |
| 47 | 47 |
|
| 48 |
static boolean mStartDebug = false; |
|
| 49 |
|
|
| 48 | 50 |
private static class Fps |
| 49 | 51 |
{
|
| 50 | 52 |
private static final int NUM_FRAMES = 100; |
| ... | ... | |
| 105 | 107 |
mFPS.onRender(time); |
| 106 | 108 |
mView.getPreRender().preRender(); |
| 107 | 109 |
mScreen.render(time); |
| 110 |
|
|
| 111 |
if( mStartDebug ) |
|
| 112 |
{
|
|
| 113 |
mStartDebug = false; |
|
| 114 |
RubikDebug debug = RubikDebug.getInstance(); |
|
| 115 |
debug.onFirstDraw(); |
|
| 116 |
} |
|
| 108 | 117 |
} |
| 109 | 118 |
|
| 110 | 119 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| src/main/java/org/distorted/tutorial/TutorialActivity.java | ||
|---|---|---|
| 198 | 198 |
protected void onResume() |
| 199 | 199 |
{
|
| 200 | 200 |
super.onResume(); |
| 201 |
|
|
| 201 | 202 |
RubikDebug debug = RubikDebug.getInstance(); |
| 202 | 203 |
debug.onResume(this); |
| 203 |
RubikDebug.addDebug("RubikActivity: onResume");
|
|
| 204 |
TutorialRenderer.mStartDebug = true; |
|
| 205 |
RubikDebug.addDebug("TutorialActivity: onResume");
|
|
| 204 | 206 |
|
| 205 | 207 |
DistortedLibrary.onResume(1); |
| 206 | 208 |
TutorialSurfaceView view = findViewById(R.id.tutorialSurfaceView); |
| src/main/java/org/distorted/tutorial/TutorialRenderer.java | ||
|---|---|---|
| 22 | 22 |
import android.opengl.GLSurfaceView; |
| 23 | 23 |
|
| 24 | 24 |
import org.distorted.effects.BaseEffect; |
| 25 |
import org.distorted.library.effect.EffectType; |
|
| 26 | 25 |
import org.distorted.library.effect.VertexEffectQuaternion; |
| 27 | 26 |
import org.distorted.library.effect.VertexEffectRotate; |
| 28 | 27 |
import org.distorted.library.main.DistortedLibrary; |
| 29 | 28 |
import org.distorted.library.main.DistortedScreen; |
| 29 |
import org.distorted.main.RubikDebug; |
|
| 30 | 30 |
|
| 31 | 31 |
import javax.microedition.khronos.egl.EGLConfig; |
| 32 | 32 |
import javax.microedition.khronos.opengles.GL10; |
| ... | ... | |
| 38 | 38 |
private final TutorialSurfaceView mView; |
| 39 | 39 |
private final DistortedScreen mScreen; |
| 40 | 40 |
|
| 41 |
static boolean mStartDebug = false; |
|
| 42 |
|
|
| 41 | 43 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 42 | 44 |
|
| 43 | 45 |
TutorialRenderer(TutorialSurfaceView v) |
| ... | ... | |
| 57 | 59 |
long time = System.currentTimeMillis(); |
| 58 | 60 |
mView.getPreRender().preRender(); |
| 59 | 61 |
mScreen.render(time); |
| 62 |
|
|
| 63 |
if( mStartDebug ) |
|
| 64 |
{
|
|
| 65 |
mStartDebug = false; |
|
| 66 |
RubikDebug debug = RubikDebug.getInstance(); |
|
| 67 |
debug.onFirstDraw(); |
|
| 68 |
} |
|
| 60 | 69 |
} |
| 61 | 70 |
|
| 62 | 71 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
Also available in: Unified diff
Improve the test - now it will hopefully not crash on slow devices (part 2)