Revision 3103c3c8
Added by Leszek Koltunski about 1 year ago
src/main/java/org/distorted/objectlib/helpers/OperatingSystemInterface.java | ||
---|---|---|
11 | 11 |
|
12 | 12 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
13 | 13 |
|
14 |
import java.io.InputStream; |
|
15 |
|
|
14 | 16 |
public interface OperatingSystemInterface |
15 | 17 |
{ |
18 |
/////////////////////////////////////////// |
|
19 |
// SCREEN |
|
20 |
/////////////////////////////////////////// |
|
21 |
int getScreenDensity(); |
|
22 |
|
|
23 |
/////////////////////////////////////////// |
|
24 |
// TOUCH CONTROL |
|
25 |
/////////////////////////////////////////// |
|
16 | 26 |
int ACTION_DOWN_1 = 0; |
17 | 27 |
int ACTION_UP_1 = 1; |
18 | 28 |
int ACTION_DOWN_2 = 3; |
... | ... | |
21 | 31 |
|
22 | 32 |
int INVALID_POINTER_ID = -1; |
23 | 33 |
|
24 |
int getScreenDensity(); |
|
25 |
|
|
26 | 34 |
int getAction(); |
27 | 35 |
void upOneOfThem(); |
28 | 36 |
boolean isFirstPressed(); |
... | ... | |
35 | 43 |
float getFirstY(); |
36 | 44 |
float getSecondX(); |
37 | 45 |
float getSecondY(); |
46 |
|
|
47 |
/////////////////////////////////////////// |
|
48 |
// LOCAL FILES |
|
49 |
/////////////////////////////////////////// |
|
50 |
InputStream openLocalFile(String name); |
|
51 |
InputStream openLocalFile(int id); |
|
38 | 52 |
} |
src/main/java/org/distorted/objectlib/main/InitAssets.java | ||
---|---|---|
9 | 9 |
|
10 | 10 |
package org.distorted.objectlib.main; |
11 | 11 |
|
12 |
import android.content.res.Resources;
|
|
12 |
import org.distorted.objectlib.helpers.OperatingSystemInterface;
|
|
13 | 13 |
|
14 | 14 |
import java.io.IOException; |
15 | 15 |
import java.io.InputStream; |
... | ... | |
20 | 20 |
{ |
21 | 21 |
private final InputStream mJsonStream; |
22 | 22 |
private final InputStream mMeshStream; |
23 |
private final Resources mRes;
|
|
23 |
private final OperatingSystemInterface mInterface;
|
|
24 | 24 |
|
25 | 25 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
26 | 26 |
|
27 |
public InitAssets(InputStream jsonStream, InputStream meshStream, Resources res)
|
|
27 |
public InitAssets(InputStream jsonStream, InputStream meshStream, OperatingSystemInterface inter)
|
|
28 | 28 |
{ |
29 | 29 |
mJsonStream = jsonStream; |
30 | 30 |
mMeshStream = meshStream; |
31 |
mRes = res;
|
|
31 |
mInterface = inter;
|
|
32 | 32 |
} |
33 | 33 |
|
34 | 34 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
54 | 54 |
|
55 | 55 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
56 | 56 |
|
57 |
public Resources getResources()
|
|
57 |
public OperatingSystemInterface getOS()
|
|
58 | 58 |
{ |
59 |
return mRes;
|
|
59 |
return mInterface;
|
|
60 | 60 |
} |
61 | 61 |
|
62 | 62 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
src/main/java/org/distorted/objectlib/main/TwistyObject.java | ||
---|---|---|
15 | 15 |
import java.util.Random; |
16 | 16 |
|
17 | 17 |
import android.content.SharedPreferences; |
18 |
import android.content.res.Resources; |
|
19 | 18 |
import android.graphics.Bitmap; |
20 | 19 |
import android.graphics.Canvas; |
21 | 20 |
import android.graphics.Paint; |
... | ... | |
50 | 49 |
import org.distorted.objectlib.helpers.ObjectSticker; |
51 | 50 |
import org.distorted.objectlib.helpers.ObjectStickerOverride; |
52 | 51 |
import org.distorted.objectlib.helpers.ObjectVertexEffects; |
52 |
import org.distorted.objectlib.helpers.OperatingSystemInterface; |
|
53 | 53 |
import org.distorted.objectlib.helpers.QuatGroupGenerator; |
54 | 54 |
import org.distorted.objectlib.scrambling.ObjectScrambler; |
55 | 55 |
import org.distorted.objectlib.json.JsonReader; |
... | ... | |
246 | 246 |
int[][] edges = getScrambleEdges(); |
247 | 247 |
int[][] algorithms = getScrambleAlgorithms(); |
248 | 248 |
|
249 |
Resources res = asset==null ? null : asset.getResources();
|
|
250 |
TablebasesAbstract tablebase = res!=null ? getTablebase(res) : null;
|
|
249 |
OperatingSystemInterface os = asset==null ? null : asset.getOS();
|
|
250 |
TablebasesAbstract tablebase = os!=null ? getTablebase(os) : null;
|
|
251 | 251 |
mScrambler = new ObjectScrambler(scramblingType,mNumAxis,mNumLayers,algorithms,edges,tablebase); |
252 | 252 |
|
253 | 253 |
boolean bandaged=false; |
... | ... | |
301 | 301 |
|
302 | 302 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
303 | 303 |
|
304 |
private TablebasesAbstract getTablebase(Resources res)
|
|
304 |
private TablebasesAbstract getTablebase(OperatingSystemInterface os)
|
|
305 | 305 |
{ |
306 | 306 |
ObjectSignature signature = getSignature(); |
307 | 307 |
long[] array = signature.getArray(); |
308 | 308 |
int len = array.length; |
309 | 309 |
int sig = (int)array[len-1]; |
310 | 310 |
|
311 |
return ImplementedTablebasesList.createPacked(res,sig);
|
|
311 |
return ImplementedTablebasesList.createPacked(os,sig);
|
|
312 | 312 |
} |
313 | 313 |
|
314 | 314 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
src/main/java/org/distorted/objectlib/tablebases/ImplementedTablebasesList.java | ||
---|---|---|
9 | 9 |
|
10 | 10 |
package org.distorted.objectlib.tablebases; |
11 | 11 |
|
12 |
import android.content.res.Resources; |
|
13 |
|
|
12 |
import org.distorted.objectlib.helpers.OperatingSystemInterface; |
|
14 | 13 |
import org.distorted.objectlib.main.ObjectSignatures; |
15 | 14 |
|
16 | 15 |
import java.lang.reflect.Constructor; |
... | ... | |
79 | 78 |
|
80 | 79 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
81 | 80 |
|
82 |
private static TablebasesAbstract create(Resources res, int signature, boolean packed)
|
|
81 |
private static TablebasesAbstract create(OperatingSystemInterface os, int signature, boolean packed)
|
|
83 | 82 |
{ |
84 | 83 |
Class<? extends TablebasesAbstract> clazz=null; |
85 | 84 |
|
... | ... | |
100 | 99 |
{ |
101 | 100 |
if( packed ) |
102 | 101 |
{ |
103 |
Object[] parameters = new Object[] { res };
|
|
102 |
Object[] parameters = new Object[] { os };
|
|
104 | 103 |
return (TablebasesAbstract)cons[1].newInstance(parameters); |
105 | 104 |
} |
106 | 105 |
else |
... | ... | |
131 | 130 |
|
132 | 131 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
133 | 132 |
|
134 |
public static TablebasesAbstract createPacked(Resources res, int signature)
|
|
133 |
public static TablebasesAbstract createPacked(OperatingSystemInterface os, int signature)
|
|
135 | 134 |
{ |
136 |
return create(res,signature,true);
|
|
135 |
return create(os,signature,true);
|
|
137 | 136 |
} |
138 | 137 |
|
139 | 138 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
src/main/java/org/distorted/objectlib/tablebases/TBCube2.java | ||
---|---|---|
9 | 9 |
|
10 | 10 |
package org.distorted.objectlib.tablebases; |
11 | 11 |
|
12 |
import android.content.res.Resources; |
|
13 |
|
|
14 | 12 |
import org.distorted.library.type.Static3D; |
15 | 13 |
import org.distorted.objectlib.R; |
14 |
import org.distorted.objectlib.helpers.OperatingSystemInterface; |
|
16 | 15 |
|
17 | 16 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
18 | 17 |
|
... | ... | |
39 | 38 |
|
40 | 39 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
41 | 40 |
|
42 |
public TBCube2(Resources res)
|
|
41 |
public TBCube2(OperatingSystemInterface os)
|
|
43 | 42 |
{ |
44 |
super(res, new int[] {R.raw.cube_2_pruning4,R.raw.cube_2_pruning5}, new int[] {R.raw.cube_2_pruning11} );
|
|
43 |
super(os, new int[] {R.raw.cube_2_pruning4,R.raw.cube_2_pruning5}, new int[] {R.raw.cube_2_pruning11} );
|
|
45 | 44 |
} |
46 | 45 |
|
47 | 46 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
src/main/java/org/distorted/objectlib/tablebases/TBCuboid232.java | ||
---|---|---|
9 | 9 |
|
10 | 10 |
package org.distorted.objectlib.tablebases; |
11 | 11 |
|
12 |
import android.content.res.Resources; |
|
13 |
|
|
14 | 12 |
import org.distorted.library.type.Static3D; |
13 |
import org.distorted.objectlib.helpers.OperatingSystemInterface; |
|
15 | 14 |
|
16 | 15 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
17 | 16 |
|
... | ... | |
38 | 37 |
|
39 | 38 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
40 | 39 |
|
41 |
public TBCuboid232(Resources res)
|
|
40 |
public TBCuboid232(OperatingSystemInterface os)
|
|
42 | 41 |
{ |
43 |
super(res,org.distorted.objectlib.R.raw.cu_232_tablebase);
|
|
42 |
super(os,org.distorted.objectlib.R.raw.cu_232_tablebase);
|
|
44 | 43 |
} |
45 | 44 |
|
46 | 45 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
src/main/java/org/distorted/objectlib/tablebases/TBDino.java | ||
---|---|---|
11 | 11 |
|
12 | 12 |
import static org.distorted.objectlib.main.TwistyObject.SQ3; |
13 | 13 |
|
14 |
import android.content.res.Resources; |
|
15 |
|
|
16 | 14 |
import org.distorted.library.type.Static3D; |
15 |
import org.distorted.objectlib.helpers.OperatingSystemInterface; |
|
17 | 16 |
|
18 | 17 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
19 | 18 |
|
... | ... | |
46 | 45 |
|
47 | 46 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
48 | 47 |
|
49 |
public TBDino(Resources res, int[] middle, int[] high)
|
|
48 |
public TBDino(OperatingSystemInterface os, int[] middle, int[] high)
|
|
50 | 49 |
{ |
51 |
super(res,middle,high);
|
|
50 |
super(os,middle,high);
|
|
52 | 51 |
} |
53 | 52 |
|
54 | 53 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
src/main/java/org/distorted/objectlib/tablebases/TBDino4.java | ||
---|---|---|
9 | 9 |
|
10 | 10 |
package org.distorted.objectlib.tablebases; |
11 | 11 |
|
12 |
import android.content.res.Resources; |
|
13 |
|
|
14 | 12 |
import org.distorted.objectlib.R; |
13 |
import org.distorted.objectlib.helpers.OperatingSystemInterface; |
|
15 | 14 |
|
16 | 15 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
17 | 16 |
|
... | ... | |
30 | 29 |
|
31 | 30 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
32 | 31 |
|
33 |
public TBDino4(Resources res)
|
|
32 |
public TBDino4(OperatingSystemInterface os)
|
|
34 | 33 |
{ |
35 |
super(res, new int[] {R.raw.din4_3_pruning2,R.raw.din4_3_pruning3}, new int[] {R.raw.din4_3_pruning7});
|
|
34 |
super(os, new int[] {R.raw.din4_3_pruning2,R.raw.din4_3_pruning3}, new int[] {R.raw.din4_3_pruning7});
|
|
36 | 35 |
} |
37 | 36 |
|
38 | 37 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
src/main/java/org/distorted/objectlib/tablebases/TBDino6.java | ||
---|---|---|
9 | 9 |
|
10 | 10 |
package org.distorted.objectlib.tablebases; |
11 | 11 |
|
12 |
import android.content.res.Resources; |
|
13 |
|
|
14 | 12 |
import org.distorted.objectlib.R; |
13 |
import org.distorted.objectlib.helpers.OperatingSystemInterface; |
|
15 | 14 |
|
16 | 15 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
17 | 16 |
|
... | ... | |
29 | 28 |
|
30 | 29 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
31 | 30 |
|
32 |
public TBDino6(Resources res)
|
|
31 |
public TBDino6(OperatingSystemInterface os)
|
|
33 | 32 |
{ |
34 |
super(res,new int[] {R.raw.dino_3_pruning3,R.raw.dino_3_pruning4},new int[] {R.raw.dino_3_pruning10});
|
|
33 |
super(os,new int[] {R.raw.dino_3_pruning3,R.raw.dino_3_pruning4},new int[] {R.raw.dino_3_pruning10});
|
|
35 | 34 |
} |
36 | 35 |
|
37 | 36 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
src/main/java/org/distorted/objectlib/tablebases/TBIvyCube.java | ||
---|---|---|
9 | 9 |
|
10 | 10 |
package org.distorted.objectlib.tablebases; |
11 | 11 |
|
12 |
import android.content.res.Resources; |
|
13 |
|
|
14 | 12 |
import org.distorted.library.type.Static3D; |
13 |
import org.distorted.objectlib.helpers.OperatingSystemInterface; |
|
14 |
|
|
15 | 15 |
import static org.distorted.objectlib.main.TwistyObject.SQ3; |
16 | 16 |
|
17 | 17 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
36 | 36 |
|
37 | 37 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
38 | 38 |
|
39 |
public TBIvyCube(Resources res)
|
|
39 |
public TBIvyCube(OperatingSystemInterface os)
|
|
40 | 40 |
{ |
41 |
super(res,org.distorted.objectlib.R.raw.ivy_2_tablebase);
|
|
41 |
super(os,org.distorted.objectlib.R.raw.ivy_2_tablebase);
|
|
42 | 42 |
} |
43 | 43 |
|
44 | 44 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
src/main/java/org/distorted/objectlib/tablebases/TBJing.java | ||
---|---|---|
14 | 14 |
import static org.distorted.objectlib.main.TwistyObject.SQ6; |
15 | 15 |
import static org.distorted.objectlib.objects.TwistyJing.F; |
16 | 16 |
|
17 |
import android.content.res.Resources; |
|
18 |
|
|
19 | 17 |
import org.distorted.library.type.Static3D; |
20 | 18 |
import org.distorted.objectlib.R; |
19 |
import org.distorted.objectlib.helpers.OperatingSystemInterface; |
|
21 | 20 |
|
22 | 21 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
23 | 22 |
|
... | ... | |
42 | 41 |
|
43 | 42 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
44 | 43 |
|
45 |
public TBJing(Resources res)
|
|
44 |
public TBJing(OperatingSystemInterface os)
|
|
46 | 45 |
{ |
47 |
super(res, new int[] {R.raw.jing_2_pruning4 ,R.raw.jing_2_pruning5 },
|
|
48 |
new int[] {R.raw.jing_2_pruning11,R.raw.jing_2_pruning12} );
|
|
46 |
super(os, new int[] {R.raw.jing_2_pruning4 ,R.raw.jing_2_pruning5 },
|
|
47 |
new int[] {R.raw.jing_2_pruning11,R.raw.jing_2_pruning12} ); |
|
49 | 48 |
} |
50 | 49 |
|
51 | 50 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
src/main/java/org/distorted/objectlib/tablebases/TBPyraminx.java | ||
---|---|---|
13 | 13 |
import static org.distorted.objectlib.main.TwistyObject.SQ3; |
14 | 14 |
import static org.distorted.objectlib.main.TwistyObject.SQ6; |
15 | 15 |
|
16 |
import android.content.res.Resources; |
|
17 |
|
|
18 | 16 |
import org.distorted.library.type.Static3D; |
19 | 17 |
import org.distorted.objectlib.R; |
18 |
import org.distorted.objectlib.helpers.OperatingSystemInterface; |
|
20 | 19 |
|
21 | 20 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
22 | 21 |
|
... | ... | |
41 | 40 |
|
42 | 41 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
43 | 42 |
|
44 |
public TBPyraminx(Resources res)
|
|
43 |
public TBPyraminx(OperatingSystemInterface os)
|
|
45 | 44 |
{ |
46 |
super(res, R.raw.pyra_3_tablebase);
|
|
45 |
super(os, R.raw.pyra_3_tablebase);
|
|
47 | 46 |
} |
48 | 47 |
|
49 | 48 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
src/main/java/org/distorted/objectlib/tablebases/TBPyraminxDiamond.java | ||
---|---|---|
11 | 11 |
|
12 | 12 |
import static org.distorted.objectlib.main.TwistyObject.SQ2; |
13 | 13 |
|
14 |
import android.content.res.Resources; |
|
15 |
|
|
16 | 14 |
import org.distorted.library.type.Static3D; |
17 | 15 |
import org.distorted.objectlib.R; |
16 |
import org.distorted.objectlib.helpers.OperatingSystemInterface; |
|
18 | 17 |
|
19 | 18 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
20 | 19 |
|
... | ... | |
51 | 50 |
|
52 | 51 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
53 | 52 |
|
54 |
public TBPyraminxDiamond(Resources res)
|
|
53 |
public TBPyraminxDiamond(OperatingSystemInterface os)
|
|
55 | 54 |
{ |
56 |
super(res, new int[] {R.raw.pdia_3_pruning3,R.raw.pdia_3_pruning4}, new int[] {R.raw.pdia_3_pruning10});
|
|
55 |
super(os, new int[] {R.raw.pdia_3_pruning3,R.raw.pdia_3_pruning4}, new int[] {R.raw.pdia_3_pruning10});
|
|
57 | 56 |
} |
58 | 57 |
|
59 | 58 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
src/main/java/org/distorted/objectlib/tablebases/TBPyraminxDuo.java | ||
---|---|---|
13 | 13 |
import static org.distorted.objectlib.main.TwistyObject.SQ3; |
14 | 14 |
import static org.distorted.objectlib.main.TwistyObject.SQ6; |
15 | 15 |
|
16 |
import android.content.res.Resources; |
|
17 |
|
|
18 | 16 |
import org.distorted.library.type.Static3D; |
17 |
import org.distorted.objectlib.helpers.OperatingSystemInterface; |
|
19 | 18 |
|
20 | 19 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
21 | 20 |
|
... | ... | |
30 | 29 |
|
31 | 30 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
32 | 31 |
|
33 |
public TBPyraminxDuo(Resources res)
|
|
32 |
public TBPyraminxDuo(OperatingSystemInterface os)
|
|
34 | 33 |
{ |
35 |
super(res,org.distorted.objectlib.R.raw.pduo_2_tablebase);
|
|
34 |
super(os,org.distorted.objectlib.R.raw.pduo_2_tablebase);
|
|
36 | 35 |
} |
37 | 36 |
|
38 | 37 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
src/main/java/org/distorted/objectlib/tablebases/TBSkewb.java | ||
---|---|---|
11 | 11 |
|
12 | 12 |
import static org.distorted.objectlib.main.TwistyObject.SQ3; |
13 | 13 |
|
14 |
import android.content.res.Resources; |
|
15 |
|
|
16 | 14 |
import org.distorted.library.type.Static3D; |
17 | 15 |
import org.distorted.objectlib.R; |
16 |
import org.distorted.objectlib.helpers.OperatingSystemInterface; |
|
18 | 17 |
|
19 | 18 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
20 | 19 |
|
... | ... | |
62 | 61 |
|
63 | 62 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
64 | 63 |
|
65 |
public TBSkewb(Resources res)
|
|
64 |
public TBSkewb(OperatingSystemInterface os)
|
|
66 | 65 |
{ |
67 |
super(res,new int[] {R.raw.skew_2_pruning4,R.raw.skew_2_pruning5},new int[]{R.raw.skew_2_pruning11}); |
|
68 |
//super(res, R.raw.skew_2_tablebase); |
|
66 |
super(os,new int[] {R.raw.skew_2_pruning4,R.raw.skew_2_pruning5},new int[]{R.raw.skew_2_pruning11}); |
|
69 | 67 |
} |
70 | 68 |
|
71 | 69 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
src/main/java/org/distorted/objectlib/tablebases/TBSkewbDiamond.java | ||
---|---|---|
13 | 13 |
import static org.distorted.objectlib.main.TwistyObject.SQ3; |
14 | 14 |
import static org.distorted.objectlib.main.TwistyObject.SQ6; |
15 | 15 |
|
16 |
import android.content.res.Resources; |
|
17 |
|
|
18 | 16 |
import org.distorted.library.type.Static3D; |
19 | 17 |
import org.distorted.objectlib.R; |
18 |
import org.distorted.objectlib.helpers.OperatingSystemInterface; |
|
20 | 19 |
|
21 | 20 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
22 | 21 |
|
... | ... | |
49 | 48 |
|
50 | 49 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
51 | 50 |
|
52 |
public TBSkewbDiamond(Resources res)
|
|
51 |
public TBSkewbDiamond(OperatingSystemInterface os)
|
|
53 | 52 |
{ |
54 |
super(res, R.raw.diam_2_tablebase);
|
|
53 |
super(os, R.raw.diam_2_tablebase);
|
|
55 | 54 |
} |
56 | 55 |
|
57 | 56 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
src/main/java/org/distorted/objectlib/tablebases/TablebasesAbstract.java | ||
---|---|---|
9 | 9 |
|
10 | 10 |
package org.distorted.objectlib.tablebases; |
11 | 11 |
|
12 |
import android.content.res.Resources; |
|
13 |
|
|
14 | 12 |
import org.distorted.library.main.QuatHelper; |
15 | 13 |
import org.distorted.library.type.Static3D; |
16 | 14 |
import org.distorted.library.type.Static4D; |
15 |
import org.distorted.objectlib.helpers.OperatingSystemInterface; |
|
17 | 16 |
import org.distorted.objectlib.helpers.QuatGroupGenerator; |
18 | 17 |
|
19 | 18 |
import java.io.ByteArrayOutputStream; |
... | ... | |
99 | 98 |
|
100 | 99 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
101 | 100 |
|
102 |
public TablebasesAbstract(Resources res, int resource)
|
|
101 |
public TablebasesAbstract(OperatingSystemInterface os, int resource)
|
|
103 | 102 |
{ |
104 | 103 |
this(); |
105 | 104 |
|
106 | 105 |
mInitialized = true; |
107 |
InputStream stream = res.openRawResource(resource);
|
|
106 |
InputStream stream = os.openLocalFile(resource);
|
|
108 | 107 |
ByteArrayOutputStream buffer = new ByteArrayOutputStream(); |
109 | 108 |
|
110 | 109 |
int nRead; |
src/main/java/org/distorted/objectlib/tablebases/TablebasesPruning.java | ||
---|---|---|
9 | 9 |
|
10 | 10 |
package org.distorted.objectlib.tablebases; |
11 | 11 |
|
12 |
import android.content.res.Resources;
|
|
12 |
import org.distorted.objectlib.helpers.OperatingSystemInterface;
|
|
13 | 13 |
|
14 | 14 |
import java.io.ByteArrayOutputStream; |
15 | 15 |
import java.io.IOException; |
... | ... | |
34 | 34 |
|
35 | 35 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
36 | 36 |
|
37 |
private PruningTable createPruningTable(Resources res, int id)
|
|
37 |
private PruningTable createPruningTable(OperatingSystemInterface os, int id)
|
|
38 | 38 |
{ |
39 |
InputStream stream = res.openRawResource(id);
|
|
39 |
InputStream stream = os.openLocalFile(id);
|
|
40 | 40 |
ByteArrayOutputStream buffer = new ByteArrayOutputStream(); |
41 | 41 |
|
42 | 42 |
int nRead; |
... | ... | |
71 | 71 |
|
72 | 72 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
73 | 73 |
|
74 |
public TablebasesPruning(Resources res, int[] midIDs, int[] highIDs)
|
|
74 |
public TablebasesPruning(OperatingSystemInterface os, int[] midIDs, int[] highIDs)
|
|
75 | 75 |
{ |
76 | 76 |
super(); |
77 | 77 |
|
... | ... | |
83 | 83 |
mGodsNumber = getGodsNumber(); |
84 | 84 |
mInitialized = true; |
85 | 85 |
|
86 |
for(int i=0; i<mid ; i++) mMidTables[i] = createPruningTable(res,midIDs[i] );
|
|
87 |
for(int i=0; i<high; i++) mHighTables[i]= createPruningTable(res,highIDs[i]);
|
|
86 |
for(int i=0; i<mid ; i++) mMidTables[i] = createPruningTable(os,midIDs[i] );
|
|
87 |
for(int i=0; i<high; i++) mHighTables[i]= createPruningTable(os,highIDs[i]);
|
|
88 | 88 |
|
89 | 89 |
computeLowHigh(); |
90 | 90 |
} |
Also available in: Unified diff
Move opening local files to the OSInterface