Revision 9ea800c6
Added by Leszek Koltunski over 6 years ago
src/main/java/org/distorted/library/main/DistortedScreen.java | ||
---|---|---|
151 | 151 |
*/ |
152 | 152 |
public void showFPS() |
153 | 153 |
{ |
154 |
mShowFPS = true; |
|
155 |
|
|
156 |
fpsW = 120; |
|
157 |
fpsH = 70; |
|
158 |
|
|
159 |
fpsString = ""; |
|
160 |
fpsBitmap = Bitmap.createBitmap(fpsW,fpsH, Bitmap.Config.ARGB_8888); |
|
161 |
fpsMesh = new MeshFlat(1,1); |
|
162 |
fpsTexture = new DistortedTexture(fpsW,fpsH); |
|
163 |
fpsTexture.setTexture(fpsBitmap); |
|
164 |
fpsCanvas = new Canvas(fpsBitmap); |
|
165 |
fpsEffects = new DistortedEffects(); |
|
166 |
fpsEffects.apply(mMoveEffect); |
|
167 |
|
|
168 |
mPaint = new Paint(); |
|
169 |
mPaint.setAntiAlias(true); |
|
170 |
mPaint.setTextAlign(Paint.Align.CENTER); |
|
171 |
mPaint.setTextSize(0.7f*fpsH); |
|
172 |
|
|
173 |
durations = new long[NUM_FRAMES+1]; |
|
174 |
currDuration = 0; |
|
175 |
|
|
176 |
for(int i=0; i<NUM_FRAMES+1; i++) durations[i]=16; // Assume FPS will be |
|
177 |
durations[NUM_FRAMES] = NUM_FRAMES*16; // close to 1000/16 ~ 60 |
|
154 |
if( !mShowFPS ) |
|
155 |
{ |
|
156 |
mShowFPS = true; |
|
157 |
|
|
158 |
fpsW = 120; |
|
159 |
fpsH = 70; |
|
160 |
|
|
161 |
fpsString = ""; |
|
162 |
fpsBitmap = Bitmap.createBitmap(fpsW, fpsH, Bitmap.Config.ARGB_8888); |
|
163 |
fpsMesh = new MeshFlat(1, 1); |
|
164 |
fpsTexture = new DistortedTexture(fpsW, fpsH); |
|
165 |
fpsTexture.setTexture(fpsBitmap); |
|
166 |
fpsCanvas = new Canvas(fpsBitmap); |
|
167 |
fpsEffects = new DistortedEffects(); |
|
168 |
fpsEffects.apply(mMoveEffect); |
|
169 |
|
|
170 |
mPaint = new Paint(); |
|
171 |
mPaint.setAntiAlias(true); |
|
172 |
mPaint.setTextAlign(Paint.Align.CENTER); |
|
173 |
mPaint.setTextSize(0.7f * fpsH); |
|
174 |
|
|
175 |
durations = new long[NUM_FRAMES + 1]; |
|
176 |
currDuration = 0; |
|
177 |
|
|
178 |
for (int i = 0; i < NUM_FRAMES + 1; i++) durations[i] = 16; // Assume FPS will be |
|
179 |
durations[NUM_FRAMES] = NUM_FRAMES * 16; // close to 1000/16 ~ 60 |
|
180 |
} |
|
178 | 181 |
} |
179 | 182 |
} |
Also available in: Unified diff
Minor.