Project

General

Profile

« Previous | Next » 

Revision 9c06394a

Added by Leszek Koltunski almost 3 years ago

Standarize drawing stickers of a twisty puzzle. From now on, there's no 'sticker drawing' code in the individual classes, only some constants.

View differences:

src/main/java/org/distorted/objects/TwistyDiamond.java
20 20
package org.distorted.objects;
21 21

  
22 22
import android.content.res.Resources;
23
import android.graphics.Canvas;
24
import android.graphics.Paint;
25 23

  
26 24
import org.distorted.helpers.FactoryCubit;
27
import org.distorted.helpers.FactorySticker;
25
import org.distorted.helpers.ObjectSticker;
28 26
import org.distorted.library.effect.MatrixEffectQuaternion;
29 27
import org.distorted.library.main.DistortedEffects;
30 28
import org.distorted.library.main.DistortedTexture;
......
138 136
             { -0.4330127f, -0.25f, 0.4330127f, -0.25f, 0.0f, 0.5f }
139 137
          };
140 138

  
139
  private static final ObjectSticker[] mStickers;
140

  
141 141
  private static MeshBase[] mMeshes;
142 142

  
143
  static
144
    {
145
    float radius = 0.06f;
146
    float stroke = 0.07f;
147
    float[] radii = new float[] {radius,radius,radius};
148
    mStickers = new ObjectSticker[STICKERS.length];
149
    mStickers[0] = new ObjectSticker(STICKERS[0],null,radii,stroke);
150
    }
151

  
143 152
///////////////////////////////////////////////////////////////////////////////////////////////////
144 153

  
145 154
  TwistyDiamond(int size, Static4D quat, DistortedTexture texture,
......
491 500

  
492 501
///////////////////////////////////////////////////////////////////////////////////////////////////
493 502

  
494
  void createFaceTexture(Canvas canvas, Paint paint, int face, int left, int top)
503
  int getColor(int face)
495 504
    {
496
    float R = 0.06f;
497
    float S = 0.07f;
498
    float[] RS = new float[] {R,R,R};
505
    return FACE_COLORS[face];
506
    }
507

  
508
///////////////////////////////////////////////////////////////////////////////////////////////////
499 509

  
500
    FactorySticker factory = FactorySticker.getInstance();
501
    factory.drawRoundedPolygon(canvas, paint, left, top, STICKERS[0], null, S, FACE_COLORS[face], RS);
510
  ObjectSticker retSticker(int face)
511
    {
512
    return mStickers[face/NUM_FACES];
502 513
    }
503 514

  
504 515
///////////////////////////////////////////////////////////////////////////////////////////////////

Also available in: Unified diff