Revision 85038b84
Added by Leszek Koltunski almost 2 years ago
src/main/java/org/distorted/main/RubikRenderer.java | ||
---|---|---|
45 | 45 |
public static final float BRIGHTNESS = 0.30f; |
46 | 46 |
|
47 | 47 |
private final RubikSurfaceView mView; |
48 |
private final DistortedScreen mScreen; |
|
48 |
private final DistortedScreen mScreen, mEmptyScreen;
|
|
49 | 49 |
private final ObjectControl mControl; |
50 | 50 |
private final Fps mFPS; |
51 | 51 |
private boolean mErrorShown; |
52 | 52 |
private boolean mDebugSent; |
53 |
private boolean mRenderingOn; |
|
53 | 54 |
|
54 | 55 |
private static class Fps |
55 | 56 |
{ |
... | ... | |
93 | 94 |
|
94 | 95 |
RubikRenderer(RubikSurfaceView v) |
95 | 96 |
{ |
97 |
mRenderingOn= true; |
|
96 | 98 |
mErrorShown = false; |
97 | 99 |
mView = v; |
98 | 100 |
mControl = v.getObjectControl(); |
99 | 101 |
mFPS = new Fps(); |
102 |
|
|
100 | 103 |
mScreen = new DistortedScreen(); |
101 | 104 |
mScreen.glClearColor(BRIGHTNESS, BRIGHTNESS, BRIGHTNESS, 1.0f); |
105 |
mEmptyScreen = new DistortedScreen(); |
|
106 |
mEmptyScreen.glClearColor(BRIGHTNESS, BRIGHTNESS, BRIGHTNESS, 1.0f); |
|
102 | 107 |
} |
103 | 108 |
|
104 | 109 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
109 | 114 |
public void onDrawFrame(GL10 glUnused) |
110 | 115 |
{ |
111 | 116 |
long time = System.currentTimeMillis(); |
112 |
mFPS.onRender(time); |
|
113 |
mControl.preRender(); |
|
114 |
mScreen.render(time); |
|
117 |
|
|
118 |
if( mRenderingOn ) |
|
119 |
{ |
|
120 |
mFPS.onRender(time); |
|
121 |
mControl.preRender(); |
|
122 |
mScreen.render(time); |
|
123 |
} |
|
124 |
else |
|
125 |
{ |
|
126 |
mEmptyScreen.render(time); |
|
127 |
} |
|
115 | 128 |
} |
116 | 129 |
|
117 | 130 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
120 | 133 |
public void onSurfaceChanged(GL10 glUnused, int width, int height) |
121 | 134 |
{ |
122 | 135 |
mScreen.resize(width,height); |
136 |
mEmptyScreen.resize(width,height); |
|
123 | 137 |
mView.setScreenSize(width,height); |
124 | 138 |
} |
125 | 139 |
|
... | ... | |
188 | 202 |
} |
189 | 203 |
} |
190 | 204 |
|
205 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
206 |
|
|
207 |
void switchRendering(boolean on) |
|
208 |
{ |
|
209 |
mRenderingOn = on; |
|
210 |
} |
|
211 |
|
|
191 | 212 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
192 | 213 |
|
193 | 214 |
float getFPS() |
Also available in: Unified diff
New UI