Project

General

Profile

« Previous | Next » 

Revision 26a4e5f6

Added by Leszek Koltunski almost 7 years ago

Reorganize the way we add and remove all Effects (do it through DistortedMaster and is POSTPROCES - adjust Bucket and SORT Nodes).

Buggy: removing effects does not work.

View differences:

src/main/java/org/distorted/library/main/DistortedScreen.java
55 55
  private long[] durations;
56 56
  private int currDuration;
57 57
  private static MatrixEffectMove mMoveEffect = new MatrixEffectMove( new Static3D(5,5,0) );
58
  private boolean mInitialized;
58 59

  
59 60
///////////////////////////////////////////////////////////////////////////////////////////////////
60 61
// here we don't manage underlying OpenGL assets ourselves
......
63 64
  void delete()   {}
64 65
  void recreate() {}
65 66

  
67
///////////////////////////////////////////////////////////////////////////////////////////////////
68

  
69
  private void initialize()
70
    {
71
    fpsW = 120;
72
    fpsH =  70;
73

  
74
    fpsBitmap = Bitmap.createBitmap(fpsW,fpsH, Bitmap.Config.ARGB_8888);
75
    fpsMesh = new MeshFlat(1,1);
76
    fpsTexture = new DistortedTexture(fpsW,fpsH);
77
    fpsTexture.setTexture(fpsBitmap);
78
    fpsCanvas = new Canvas(fpsBitmap);
79
    fpsEffects = new DistortedEffects();
80
    fpsEffects.apply(mMoveEffect);
81

  
82
    mPaint = new Paint();
83
    mPaint.setAntiAlias(true);
84
    mPaint.setTextAlign(Paint.Align.CENTER);
85
    mPaint.setTextSize(0.7f*fpsH);
86

  
87
    durations = new long[NUM_FRAMES+1];
88
    currDuration = 0;
89

  
90
    for(int i=0; i<NUM_FRAMES+1; i++) durations[i]=16;  // Assume FPS will be
91
    durations[NUM_FRAMES] = NUM_FRAMES*16;              // close to 1000/16 ~ 60
92
    mInitialized=true;
93
    }
94

  
66 95
///////////////////////////////////////////////////////////////////////////////////////////////////
67 96

  
68 97
  void prepareDebug(long time)
69 98
    {
99
    if( !mInitialized ) initialize();
100

  
70 101
    if( lastTime==0 ) lastTime = time;
71 102

  
72 103
    currDuration++;
......
122 153
      view.setEGLContextClientVersion((configurationInfo.reqGlEsVersion >> 16) >= 3 ? 3 : 2);
123 154
      }
124 155

  
125
    /////// DEBUGGING ONLY //////////////
126
    fpsW = 120;
127
    fpsH =  70;
128

  
129
    fpsBitmap = Bitmap.createBitmap(fpsW,fpsH, Bitmap.Config.ARGB_8888);
130
    fpsMesh = new MeshFlat(1,1);
131
    fpsTexture = new DistortedTexture(fpsW,fpsH);
132
    fpsTexture.setTexture(fpsBitmap);
133
    fpsCanvas = new Canvas(fpsBitmap);
134
    fpsEffects = new DistortedEffects();
135
    fpsEffects.apply(mMoveEffect);
136

  
137
    mPaint = new Paint();
138
    mPaint.setAntiAlias(true);
139
    mPaint.setTextAlign(Paint.Align.CENTER);
140
    mPaint.setTextSize(0.7f*fpsH);
141

  
142
    durations = new long[NUM_FRAMES+1];
143
    currDuration = 0;
144

  
145
    for(int i=0; i<NUM_FRAMES+1; i++) durations[i]=16;  // Assume FPS will be
146
    durations[NUM_FRAMES] = NUM_FRAMES*16;              // close to 1000/16 ~ 60
156
    mInitialized = false;
147 157
    }
148 158
  }

Also available in: Unified diff