Revision 338babe8
Added by Leszek Koltunski over 2 years ago
src/main/java/org/distorted/main/RubikSurfaceView.java | ||
---|---|---|
30 | 30 |
|
31 | 31 |
import com.google.firebase.crashlytics.FirebaseCrashlytics; |
32 | 32 |
|
33 |
import org.distorted.library.main.DistortedNode; |
|
33 | 34 |
import org.distorted.objectlib.main.ObjectControl; |
34 | 35 |
|
35 | 36 |
import org.distorted.screens.ScreenList; |
... | ... | |
41 | 42 |
private ObjectControl mObjectController; |
42 | 43 |
private RubikRenderer mRenderer; |
43 | 44 |
private int mScreenWidth, mScreenHeight; |
45 |
private boolean mCreated; |
|
44 | 46 |
|
45 | 47 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
46 | 48 |
|
... | ... | |
50 | 52 |
mScreenHeight= height; |
51 | 53 |
mObjectController.setScreenSize(width,height); |
52 | 54 |
|
55 |
if( !mCreated ) |
|
56 |
{ |
|
57 |
mCreated = true; |
|
58 |
mObjectController.createNode(width,height); |
|
59 |
DistortedNode objectNode = mObjectController.getNode(); |
|
60 |
mRenderer.getScreen().attach(objectNode); |
|
61 |
} |
|
62 |
|
|
53 | 63 |
try |
54 | 64 |
{ |
55 | 65 |
RubikActivity act = (RubikActivity)getContext(); |
... | ... | |
90 | 100 |
{ |
91 | 101 |
super(context,attrs); |
92 | 102 |
|
103 |
mCreated = false; |
|
104 |
|
|
93 | 105 |
if(!isInEditMode()) |
94 | 106 |
{ |
95 | 107 |
RubikActivity act = (RubikActivity)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)