Project

General

Profile

« Previous | Next » 

Revision e0613906

Added by Leszek Koltunski over 3 years ago

Convert the Rex corner sticker to the new mechanism.

View differences:

src/main/java/org/distorted/helpers/FactorySticker.java
329 329

  
330 330
  public void drawRexCornerSticker(Canvas canvas, Paint paint, int left, int top, int color, float stroke, float radius1, float radius2)
331 331
    {
332

  
333
/*
332 334
    paint.setColor(color);
333 335
    paint.setStyle(Paint.Style.FILL);
334 336
    canvas.drawRect(left,top,left+TEXTURE_HEIGHT,top+TEXTURE_HEIGHT,paint);
......
366 368
    float cy2 = top  + (0.5f-2*G/3 + radius1/REX_S)*TEXTURE_HEIGHT;
367 369
    float R3  = TEXTURE_HEIGHT*(radius1 + 0.5f*stroke);
368 370
    canvas.drawArc( cx7-R3, cy2-R3, cx7+R3, cy2+R3, 270-(90-REX_B/2), 180-REX_B, false ,paint);
371
*/
369 372
    }
370 373

  
371 374
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/java/org/distorted/objects/TwistyRex.java
553 553
    {
554 554
    int COLORS = FACE_COLORS.length;
555 555
    FactorySticker factory = FactorySticker.getInstance();
556
    float S1 = 0.050f;
557
    float S2 = 0.051f;
558
    float R1 = 0.07f;
559
    float R2 = 0.02f;
560
    float R3 = 0.06f;
561
    float R4 = 0.04f;
562 556

  
563 557
    if( face<COLORS )
564 558
      {
565
      factory.drawRexCornerSticker(canvas, paint, left, top, FACE_COLORS[face%COLORS], S1, R2, R3);
559
      float S = 0.05f;
560
      float R = 0.02f;
561
      float ANGLE = (float)(Math.PI/15);
562
      float F = REX_D*SQ2;
563
      float G = (1-REX_D)*SQ2/2;
564
      float[] vertices = new float[] { F/2, -G/3, -F/2, -G/3, 0, 2*G/3 };
565
      float[] angles   = new float[] { -ANGLE/2, ANGLE, ANGLE };
566

  
567
      factory.drawRoundedPolygon(canvas, paint, left, top, vertices, angles, S, FACE_COLORS[face%COLORS], R);
566 568
      }
567 569
    else if( face<2*COLORS )
568 570
      {
571
      float S = 0.035f;
572
      float R = 0.040f;
569 573
      float[] vertices = { -REX_D,0.0f, 0.0f, -REX_D, +REX_D, 0.0f, 0.0f, +REX_D};
570
      factory.drawRoundedPolygon(canvas, paint, left, top, vertices, null, S1, FACE_COLORS[face%COLORS], R4);
574
      factory.drawRoundedPolygon(canvas, paint, left, top, vertices, null, S, FACE_COLORS[face%COLORS], R);
571 575
      }
572 576
    else
573 577
      {
574
      factory.drawRexEdgeSticker(canvas, paint, left, top, FACE_COLORS[face%COLORS], S2, R1);
578
      float S = 0.051f;
579
      float R = 0.070f;
580
      factory.drawRexEdgeSticker(canvas, paint, left, top, FACE_COLORS[face%COLORS], S, R);
575 581
      }
576 582
    }
577 583

  

Also available in: Unified diff