Project

General

Profile

« Previous | Next » 

Revision 3b8f5220

Added by Leszek Koltunski almost 2 years ago

Improve two things in the BandagedCreator:

- when one minimizes the app and re-maximizes it, now the app remembers the state of the bandaged cube being created
- when one minimizes the app while one of th cubits is marked, it no longer gets marked the second time on re-maximizaton (which was the reason why some cubits sometimes couldn't be unmarked).

View differences:

src/main/java/org/distorted/bandaged/BandagedCreatorRenderer.java
279 279
   @Override
280 280
   public void onSurfaceChanged(GL10 glUnused, int width, int height)
281 281
      {
282
      mWidth = width;
283
      mHeight= height;
284
      rescaleObject();
285

  
286
      mScreen.detachAll();
287
      int touched = mView.getTouched();
288

  
289
      for(int i=0; i<mNumCubits; i++)
290
        if( mCubits[i].isAttached() )
291
          {
292
          mCubits[i].scaleMove(mScaleValue);
293
          if( touched==i ) mCubits[i].setMarked();
294
          else             mCubits[i].setUnmarked();
295
          DistortedNode node = mCubits[i].getNode();
296
          mScreen.attach(node);
297
          }
298

  
299
      mView.setScreenSize(width,height);
300
      mScreen.resize(width,height);
282
      if( width!=mWidth || height!=mHeight )
283
        {
284
        mWidth = width;
285
        mHeight= height;
286
        rescaleObject();
287

  
288
        mScreen.detachAll();
289
        int touched = mView.getTouched();
290

  
291
        for(int i=0; i<mNumCubits; i++)
292
          if( mCubits[i].isAttached() )
293
            {
294
            mCubits[i].scaleMove(mScaleValue);
295
            if( touched==i ) mCubits[i].setMarked();
296
            else             mCubits[i].setUnmarked();
297
            DistortedNode node = mCubits[i].getNode();
298
            mScreen.attach(node);
299
            }
300

  
301
        mView.setScreenSize(width,height);
302
        mScreen.resize(width,height);
303
        }
301 304
      }
302 305

  
303 306
///////////////////////////////////////////////////////////////////////////////////////////////////
......
313 316
      DistortedLibrary.onSurfaceCreated(mView.getContext(),this,1);
314 317
      DistortedLibrary.setCull(true);
315 318

  
316
      createCubits();
319
      if( mCubits==null )
320
        {
321
        createCubits();
322
        }
323
      else
324
        {
325
        for(int i=0; i<mNumCubits; i++) mCubits[i].recreateBitmap();
326
        }
327

  
317 328
      mCubitsCreated = true;
329
      mWidth = 0;
330
      mHeight= 0;
318 331
      }
319 332

  
320 333
///////////////////////////////////////////////////////////////////////////////////////////////////

Also available in: Unified diff