1
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
2
|
// Copyright 2020 Leszek Koltunski //
|
3
|
// //
|
4
|
// This file is part of Magic Cube. //
|
5
|
// //
|
6
|
// Magic Cube is free software: you can redistribute it and/or modify //
|
7
|
// it under the terms of the GNU General Public License as published by //
|
8
|
// the Free Software Foundation, either version 2 of the License, or //
|
9
|
// (at your option) any later version. //
|
10
|
// //
|
11
|
// Magic Cube is distributed in the hope that it will be useful, //
|
12
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
13
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
14
|
// GNU General Public License for more details. //
|
15
|
// //
|
16
|
// You should have received a copy of the GNU General Public License //
|
17
|
// along with Magic Cube. If not, see <http://www.gnu.org/licenses/>. //
|
18
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
19
|
|
20
|
package org.distorted.object;
|
21
|
|
22
|
import org.distorted.library.main.DistortedEffects;
|
23
|
import org.distorted.library.main.DistortedTexture;
|
24
|
import org.distorted.library.mesh.MeshFlat;
|
25
|
import org.distorted.library.type.Static4D;
|
26
|
import org.distorted.magic.R;
|
27
|
|
28
|
import static org.distorted.magic.RubikRenderer.TEXTURE_SIZE;
|
29
|
|
30
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
31
|
|
32
|
public enum RubikObjectList
|
33
|
{
|
34
|
CUBE2 ( 2, R.drawable.button2 , RubikCube.class, RubikCubeMovement.class),
|
35
|
CUBE3 ( 3, R.drawable.button3 , RubikCube.class, RubikCubeMovement.class),
|
36
|
CUBE4 ( 4, R.drawable.button4 , RubikCube.class, RubikCubeMovement.class),
|
37
|
CUBE5 ( 5, R.drawable.button5 , RubikCube.class, RubikCubeMovement.class),
|
38
|
;
|
39
|
|
40
|
public static final int VECTX = 0; //
|
41
|
public static final int VECTY = 1; // don't change this
|
42
|
public static final int VECTZ = 2; //
|
43
|
|
44
|
public static final int LENGTH = values().length;
|
45
|
private final int mObjectSize, mIconID;
|
46
|
final Class<? extends RubikObject> mObjectClass;
|
47
|
final Class<? extends RubikObjectMovement> mObjectMovementClass;
|
48
|
private static final RubikObjectList[] objects;
|
49
|
|
50
|
static
|
51
|
{
|
52
|
int i = 0;
|
53
|
objects = new RubikObjectList[LENGTH];
|
54
|
|
55
|
for(RubikObjectList size: RubikObjectList.values())
|
56
|
{
|
57
|
objects[i] = size;
|
58
|
i++;
|
59
|
}
|
60
|
}
|
61
|
|
62
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
63
|
|
64
|
public static RubikObjectList getObject(int ordinal)
|
65
|
{
|
66
|
return objects[ordinal];
|
67
|
}
|
68
|
|
69
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
70
|
|
71
|
RubikObjectList(int size, int iconID, Class<? extends RubikObject > object, Class<? extends RubikObjectMovement> movement)
|
72
|
{
|
73
|
mObjectSize = size;
|
74
|
mIconID = iconID;
|
75
|
mObjectClass= object;
|
76
|
mObjectMovementClass = movement;
|
77
|
}
|
78
|
|
79
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
80
|
|
81
|
public int getIconID()
|
82
|
{
|
83
|
return mIconID;
|
84
|
}
|
85
|
|
86
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
87
|
// TODO - currently all objects in the list are RubikCubes of various sizes
|
88
|
|
89
|
public RubikObject create(Static4D quatCur, Static4D quatAcc)
|
90
|
{
|
91
|
DistortedTexture texture = new DistortedTexture(TEXTURE_SIZE,TEXTURE_SIZE);
|
92
|
DistortedEffects effects = new DistortedEffects();
|
93
|
MeshFlat mesh= new MeshFlat(20,20);
|
94
|
|
95
|
return new RubikCube(mObjectSize, quatCur, quatAcc, texture, mesh, effects);
|
96
|
}
|
97
|
|
98
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
99
|
// TODO - currently all objects in the list are RubikCubes of various sizes
|
100
|
|
101
|
public RubikObjectMovement getObjectMovementClass()
|
102
|
{
|
103
|
return new RubikCubeMovement();
|
104
|
}
|
105
|
}
|