Project

General

Profile

« Previous | Next » 

Revision 01b9a241

Added by Leszek Koltunski over 6 years ago

Minor.

View differences:

src/main/java/org/distorted/library/main/DistortedScreen.java
128 128
 */
129 129
  public void showFPS()
130 130
    {
131
    mShowFPS = true;
132

  
133
    fpsW = 120;
134
    fpsH =  70;
135

  
136
    fpsString = "";
137
    fpsBitmap = Bitmap.createBitmap(fpsW,fpsH, Bitmap.Config.ARGB_8888);
138
    fpsMesh = new MeshFlat(1,1);
139
    fpsTexture = new DistortedTexture(fpsW,fpsH);
140
    fpsTexture.setTexture(fpsBitmap);
141
    fpsCanvas = new Canvas(fpsBitmap);
142
    fpsEffects = new DistortedEffects();
143
    fpsEffects.apply(mMoveEffect);
144

  
145
    mPaint = new Paint();
146
    mPaint.setAntiAlias(true);
147
    mPaint.setTextAlign(Paint.Align.CENTER);
148
    mPaint.setTextSize(0.7f*fpsH);
149

  
150
    durations = new long[NUM_FRAMES+1];
151
    currDuration = 0;
152

  
153
    for(int i=0; i<NUM_FRAMES+1; i++) durations[i]=16;  // Assume FPS will be
154
    durations[NUM_FRAMES] = NUM_FRAMES*16;              // close to 1000/16 ~ 60
131
    if( !mShowFPS )
132
      {
133
      mShowFPS = true;
134

  
135
      fpsW = 120;
136
      fpsH = 70;
137

  
138
      fpsString = "";
139
      fpsBitmap = Bitmap.createBitmap(fpsW, fpsH, Bitmap.Config.ARGB_8888);
140
      fpsMesh = new MeshFlat(1, 1);
141
      fpsTexture = new DistortedTexture(fpsW, fpsH);
142
      fpsTexture.setTexture(fpsBitmap);
143
      fpsCanvas = new Canvas(fpsBitmap);
144
      fpsEffects = new DistortedEffects();
145
      fpsEffects.apply(mMoveEffect);
146

  
147
      mPaint = new Paint();
148
      mPaint.setAntiAlias(true);
149
      mPaint.setTextAlign(Paint.Align.CENTER);
150
      mPaint.setTextSize(0.7f * fpsH);
151

  
152
      durations = new long[NUM_FRAMES + 1];
153
      currDuration = 0;
154

  
155
      for (int i = 0; i < NUM_FRAMES + 1; i++) durations[i] = 16;  // Assume FPS will be
156
      durations[NUM_FRAMES] = NUM_FRAMES * 16;              // close to 1000/16 ~ 60
157
      }
155 158
    }
156 159
  }

Also available in: Unified diff