Revision 7ba38dd4
Added by Leszek Koltunski over 2 years ago
src/main/java/org/distorted/objectlib/main/ObjectControl.java | ||
---|---|---|
54 | 54 |
private final ObjectLibInterface mInterface; |
55 | 55 |
private final ObjectPreRender mPreRender; |
56 | 56 |
private Movement mMovement; |
57 |
private TwistyObjectNode mObjectNode; |
|
57 | 58 |
private boolean mDragging, mBeginningRotation, mContinuingRotation; |
58 | 59 |
private int mScreenWidth, mScreenHeight, mScreenMin; |
59 | 60 |
private float mMoveX, mMoveY; |
... | ... | |
169 | 170 |
else |
170 | 171 |
{ |
171 | 172 |
TwistyObject object = mPreRender.getObject(); |
172 |
CAMERA_POINT.set2( object==null ? 1.21f : object.getCameraDist() );
|
|
173 |
CAMERA_POINT.set2( object==null ? 1.21f : mObjectNode.getCameraDist() );
|
|
173 | 174 |
|
174 | 175 |
Static4D touchPoint = new Static4D(x, y, 0, 0); |
175 | 176 |
Static4D rotatedTouchPoint= QuatHelper.rotateVectorByInvertedQuat(touchPoint, mQuat); |
... | ... | |
231 | 232 |
float distQuot = mInitDistance<0 ? 1.0f : distNow/ mInitDistance; |
232 | 233 |
mInitDistance = distNow; |
233 | 234 |
TwistyObject object = mPreRender.getObject(); |
234 |
if( object!=null ) object.setObjectRatio(distQuot); |
|
235 |
if( object!=null ) object.setObjectRatio(distQuot,mObjectNode.getMinSize() );
|
|
235 | 236 |
} |
236 | 237 |
else |
237 | 238 |
{ |
... | ... | |
559 | 560 |
mInterface = actioner; |
560 | 561 |
} |
561 | 562 |
|
563 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
564 |
|
|
565 |
public TwistyObjectNode getNode() |
|
566 |
{ |
|
567 |
return mObjectNode; |
|
568 |
} |
|
569 |
|
|
570 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
571 |
|
|
572 |
public void createNode(int width, int height) |
|
573 |
{ |
|
574 |
if( mObjectNode==null ) mObjectNode = new TwistyObjectNode(width,height); |
|
575 |
} |
|
576 |
|
|
562 | 577 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
563 | 578 |
|
564 | 579 |
public void setScreenSize(int width, int height) |
565 | 580 |
{ |
566 | 581 |
mScreenWidth = width; |
567 | 582 |
mScreenHeight= height; |
568 |
mScreenMin = Math.min(width,height); |
|
569 |
mPreRender.setScreenSize(width,height); |
|
583 |
mScreenMin = Math.min(width,height); |
|
584 |
|
|
585 |
mPreRender.setScreenSize(); |
|
586 |
if( mObjectNode!=null ) mObjectNode.setSize(width,height); |
|
570 | 587 |
} |
571 | 588 |
|
572 | 589 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
610 | 627 |
|
611 | 628 |
public void scaleNow(float scale) |
612 | 629 |
{ |
613 |
mPreRender.getObject().setObjectRatioNow(scale); |
|
630 |
mPreRender.getObject().setObjectRatioNow(scale,mObjectNode.getMinSize());
|
|
614 | 631 |
} |
615 | 632 |
|
616 | 633 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
Also available in: Unified diff
Major change: separate the notion of a TwistyObject and its Node. Now,
1) the Node stays when we change objects (this makes transitions faster)
2) it's possible to just create an Object without adding it to the Screen (now app needs to explicitly create the Node and add it to its Screen itself)