Revision bebd7af5
Added by Leszek Koltunski almost 3 years ago
src/main/java/org/distorted/bandaged/BandagedCreatorActivity.java | ||
---|---|---|
35 | 35 |
import org.distorted.library.main.DistortedLibrary; |
36 | 36 |
import org.distorted.main.R; |
37 | 37 |
import org.distorted.main.RubikActivity; |
38 |
import org.distorted.objectlib.main.ObjectControl; |
|
39 |
import org.distorted.objects.RubikObject; |
|
40 |
import org.distorted.objects.RubikObjectList; |
|
41 |
|
|
42 |
import java.io.InputStream; |
|
43 | 38 |
|
44 | 39 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
45 | 40 |
|
... | ... | |
62 | 57 |
private static int mScreenWidth, mScreenHeight; |
63 | 58 |
private int mCurrentApiVersion; |
64 | 59 |
private BandagedCreatorScreen mScreen; |
65 |
private int mObjectOrdinal; |
|
66 | 60 |
private int mHeightBar; |
67 | 61 |
|
68 | 62 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
190 | 184 |
view.onResume(); |
191 | 185 |
|
192 | 186 |
if( mScreen==null ) mScreen = new BandagedCreatorScreen(); |
193 |
mScreen.onAttachedToWindow(this,mObjectOrdinal);
|
|
187 |
mScreen.onAttachedToWindow(this); |
|
194 | 188 |
} |
195 | 189 |
|
196 | 190 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
210 | 204 |
errDiag.show(getSupportFragmentManager(), null); |
211 | 205 |
} |
212 | 206 |
|
213 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
214 |
|
|
215 |
private void changeIfDifferent(RubikObject object,int ordinal,ObjectControl control) |
|
216 |
{ |
|
217 |
if( object!=null ) |
|
218 |
{ |
|
219 |
int meshState = object.getMeshState(); |
|
220 |
InputStream jsonStream = object.getObjectStream(this); |
|
221 |
InputStream meshStream = object.getMeshStream(this); |
|
222 |
String name = object.getUpperName(); |
|
223 |
|
|
224 |
control.changeIfDifferent(ordinal,name,meshState,jsonStream,meshStream); |
|
225 |
} |
|
226 |
} |
|
227 |
|
|
228 | 207 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
229 | 208 |
// PUBLIC API |
230 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
231 |
|
|
232 |
public void changeObject(int ordinal) |
|
233 |
{ |
|
234 |
mObjectOrdinal = ordinal; |
|
235 |
|
|
236 |
} |
|
237 |
|
|
238 | 209 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
239 | 210 |
|
240 | 211 |
public FirebaseAnalytics getAnalytics() |
src/main/java/org/distorted/bandaged/BandagedCreatorScreen.java | ||
---|---|---|
31 | 31 |
public class BandagedCreatorScreen |
32 | 32 |
{ |
33 | 33 |
private TransparentImageButton mBackButton, mResetButton, mDoneButton; |
34 |
private int mObjectOrdinal; |
|
35 | 34 |
private int mBarHeight; |
36 | 35 |
private float mButtonSize; |
37 | 36 |
|
... | ... | |
98 | 97 |
|
99 | 98 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
100 | 99 |
|
101 |
void onAttachedToWindow(final BandagedCreatorActivity act, final int objectOrdinal)
|
|
100 |
void onAttachedToWindow(final BandagedCreatorActivity act) |
|
102 | 101 |
{ |
103 | 102 |
int width = act.getScreenWidthInPixels(); |
104 | 103 |
mBarHeight = act.getHeightBar(); |
105 | 104 |
mButtonSize = width*RubikActivity.BUTTON_TEXT_SIZE; |
106 | 105 |
|
107 |
mObjectOrdinal = objectOrdinal; |
|
108 |
|
|
109 | 106 |
LinearLayout.LayoutParams paramsL = new LinearLayout.LayoutParams(width/4, LinearLayout.LayoutParams.MATCH_PARENT); |
110 | 107 |
LinearLayout.LayoutParams paramsM = new LinearLayout.LayoutParams(width/2, LinearLayout.LayoutParams.MATCH_PARENT); |
111 | 108 |
LinearLayout.LayoutParams paramsR = new LinearLayout.LayoutParams(width/4, LinearLayout.LayoutParams.MATCH_PARENT); |
src/main/java/org/distorted/bandaged/BandagedCreatorView.java | ||
---|---|---|
81 | 81 |
} |
82 | 82 |
} |
83 | 83 |
|
84 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
85 |
|
|
86 |
public BandagedCreatorRenderer getRenderer() |
|
87 |
{ |
|
88 |
return mRenderer; |
|
89 |
} |
|
90 |
|
|
91 | 84 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
92 | 85 |
|
93 | 86 |
private void resetQuats() |
... | ... | |
160 | 153 |
|
161 | 154 |
return true; |
162 | 155 |
} |
163 |
|
|
164 | 156 |
} |
165 | 157 |
|
src/main/java/org/distorted/bandaged/BandagedCubit.java | ||
---|---|---|
29 | 29 |
import org.distorted.library.type.Static3D; |
30 | 30 |
import org.distorted.library.type.Static4D; |
31 | 31 |
import org.distorted.objectlib.helpers.FactoryBandaged3x3Cubit; |
32 |
import org.distorted.objectlib.helpers.FactoryCubit; |
|
33 |
import org.distorted.objectlib.helpers.ObjectFaceShape; |
|
34 |
import org.distorted.objectlib.helpers.ObjectShape; |
|
35 |
|
|
36 |
import static org.distorted.objectlib.main.TwistyObject.MESH_NICE; |
|
32 | 37 |
|
33 | 38 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
34 | 39 |
|
src/main/java/org/distorted/config/ConfigRenderer.java | ||
---|---|---|
68 | 68 |
{ |
69 | 69 |
mScreen.resize(width,height); |
70 | 70 |
mView.setScreenSize(width,height); |
71 |
/* |
|
72 |
int debugWidth = (int)(0.2f*width); |
|
73 |
int debugHeight= (int)(0.5*debugWidth); |
|
74 |
int gap = (int)(width*PADDING_RATIO); |
|
75 |
int textColor = 0xffffffff; |
|
76 |
int backColor = 0xff333333; |
|
77 |
|
|
78 |
mScreen.showFPS(debugWidth,debugHeight,gap,textColor,backColor); |
|
79 |
*/ |
|
80 | 71 |
} |
81 | 72 |
|
82 | 73 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
Also available in: Unified diff
Cleanups.