Project

General

Profile

« Previous | Next » 

Revision 2afc6754

Added by Leszek Koltunski over 2 years ago

Move RubikControl to objectlib (as 'ObjectAutomator')
Hide ObjectPreRender inside objectlib and move its APi to ObjectControl.

View differences:

src/main/java/org/distorted/patterns/RubikPattern.java
23 23
import java.util.List;
24 24

  
25 25
import org.distorted.objectlib.helpers.MovesFinished;
26
import org.distorted.objectlib.main.ObjectPreRender;
26
import org.distorted.objectlib.main.ObjectControl;
27 27

  
28 28
import static org.distorted.patterns.RubikPatternList.NUM_OBJECTS;
29 29

  
......
151 151

  
152 152
  /////////////////////////////////////////////////////////////
153 153

  
154
    void makeMove(ObjectPreRender pre, int pattern)
154
    void makeMove(ObjectControl control, int pattern)
155 155
      {
156 156
      if( !mInitialized ) initialize();
157 157

  
158 158
      if( pattern>=0 && pattern<numPatterns )
159 159
        {
160 160
        Pattern p = mPatterns.get(pattern);
161
        if( p!=null ) p.makeMove(pre);
161
        if( p!=null ) p.makeMove(control);
162 162
        }
163 163
      }
164 164

  
165 165
  /////////////////////////////////////////////////////////////
166 166

  
167
    void backMove(ObjectPreRender pre, int pattern)
167
    void backMove(ObjectControl control, int pattern)
168 168
      {
169 169
      if( !mInitialized ) initialize();
170 170

  
171 171
      if( pattern>=0 && pattern<numPatterns )
172 172
        {
173 173
        Pattern p = mPatterns.get(pattern);
174
        if( p!=null ) p.backMove(pre);
174
        if( p!=null ) p.backMove(control);
175 175
        }
176 176
      }
177 177

  
......
317 317

  
318 318
  /////////////////////////////////////////////////////////////
319 319

  
320
    void makeMove(ObjectPreRender pre)
320
    void makeMove(ObjectControl control)
321 321
      {
322 322
      if( !mInitialized ) initialize();
323 323

  
......
328 328
        if( curMove>numMove )
329 329
          {
330 330
          curMove= 0;
331
          pre.initializeObject(null);
331
          control.initializeObject(null);
332 332
          }
333 333
        else
334 334
          {
335 335
          int axis      = moves[curMove-1][0];
336 336
		      int rowBitmap = moves[curMove-1][1];
337 337
		      int bareAngle = moves[curMove-1][2];
338
		      int basicAngle= pre.getObject().getBasicAngle()[axis];
338
		      int basicAngle= control.getObject().getBasicAngle()[axis];
339 339
          int angle     = bareAngle*(360/basicAngle);
340 340
          int duration  = Math.abs(angle)*MILLIS_PER_DEGREE;
341 341

  
342 342
          if( angle!=0 )
343 343
            {
344 344
            mCanRotate = false;
345
            pre.addRotation(this, axis, rowBitmap, angle, duration);
345
            control.addRotation(this, axis, rowBitmap, angle, duration);
346 346
            }
347 347
          else
348 348
            {
......
358 358

  
359 359
  /////////////////////////////////////////////////////////////
360 360

  
361
    void backMove(ObjectPreRender pre)
361
    void backMove(ObjectControl control)
362 362
      {
363 363
      if( !mInitialized ) initialize();
364 364

  
......
369 369
        if( curMove<0 )
370 370
          {
371 371
          curMove=numMove;
372
          pre.initializeObject(moves);
372
          control.initializeObject(moves);
373 373
          }
374 374
        else
375 375
          {
376 376
          int axis      = moves[curMove][0];
377 377
		      int rowBitmap = moves[curMove][1];
378 378
		      int bareAngle = moves[curMove][2];
379
		      int basicAngle= pre.getObject().getBasicAngle()[axis];
379
		      int basicAngle= control.getObject().getBasicAngle()[axis];
380 380
          int angle     = bareAngle*(360/basicAngle);
381 381
          int duration  = Math.abs(angle)*MILLIS_PER_DEGREE;
382 382

  
383 383
          if( angle!=0 )
384 384
            {
385 385
            mCanRotate = false;
386
            pre.addRotation(this, axis, rowBitmap, -angle, duration);
386
            control.addRotation(this, axis, rowBitmap, -angle, duration);
387 387
            }
388 388
          else
389 389
            {
......
576 576

  
577 577
///////////////////////////////////////////////////////////////////////////////////////////////////
578 578

  
579
  public void makeMove(ObjectPreRender pre, int tab, int cat, int pat)
579
  public void makeMove(ObjectControl control, int tab, int cat, int pat)
580 580
    {
581 581
    Category c = getCategory(tab,cat);
582
    if( c!=null ) c.makeMove(pre,pat);
582
    if( c!=null ) c.makeMove(control,pat);
583 583
    }
584 584

  
585 585
///////////////////////////////////////////////////////////////////////////////////////////////////
586 586

  
587
  public void backMove(ObjectPreRender pre, int tab, int cat, int pat)
587
  public void backMove(ObjectControl control, int tab, int cat, int pat)
588 588
    {
589 589
    Category c = getCategory(tab,cat);
590
    if( c!=null ) c.backMove(pre,pat);
590
    if( c!=null ) c.backMove(control,pat);
591 591
    }
592 592

  
593 593
///////////////////////////////////////////////////////////////////////////////////////////////////

Also available in: Unified diff