Revision 338babe8
Added by Leszek Koltunski over 2 years ago
src/main/java/org/distorted/tutorials/TutorialSurfaceView.java | ||
---|---|---|
29 | 29 |
|
30 | 30 |
import com.google.firebase.crashlytics.FirebaseCrashlytics; |
31 | 31 |
|
32 |
import org.distorted.library.main.DistortedNode; |
|
32 | 33 |
import org.distorted.objectlib.main.ObjectControl; |
33 | 34 |
|
34 | 35 |
import static org.distorted.objectlib.main.ObjectControl.MODE_ROTATE; |
... | ... | |
40 | 41 |
private ObjectControl mObjectController; |
41 | 42 |
private TutorialRenderer mRenderer; |
42 | 43 |
private int mScreenWidth, mScreenHeight; |
44 |
private boolean mCreated; |
|
43 | 45 |
|
44 | 46 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
45 | 47 |
|
... | ... | |
49 | 51 |
mScreenHeight= height; |
50 | 52 |
mObjectController.setScreenSize(width,height); |
51 | 53 |
mObjectController.setMove( (int)(-0.5f*width*TutorialActivity.BAR_RATIO), 0); |
54 |
|
|
55 |
if( !mCreated ) |
|
56 |
{ |
|
57 |
mCreated = true; |
|
58 |
mObjectController.createNode(width,height); |
|
59 |
DistortedNode objectNode = mObjectController.getNode(); |
|
60 |
mRenderer.getScreen().attach(objectNode); |
|
61 |
} |
|
52 | 62 |
} |
53 | 63 |
|
54 | 64 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
58 | 68 |
return mScreenHeight>mScreenWidth; |
59 | 69 |
} |
60 | 70 |
|
61 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
62 |
|
|
63 |
TutorialRenderer getRenderer() |
|
64 |
{ |
|
65 |
return mRenderer; |
|
66 |
} |
|
67 |
|
|
68 | 71 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
69 | 72 |
|
70 | 73 |
ObjectControl getObjectControl() |
... | ... | |
80 | 83 |
{ |
81 | 84 |
super(context,attrs); |
82 | 85 |
|
86 |
mCreated = false; |
|
87 |
|
|
83 | 88 |
if(!isInEditMode()) |
84 | 89 |
{ |
85 | 90 |
TutorialActivity act = (TutorialActivity)context; |
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)