Revision f96ceb84
Added by Leszek Koltunski 5 months ago
src/main/java/org/distorted/objects/RubikObjectCategoriesShape.java | ||
---|---|---|
19 | 19 |
|
20 | 20 |
public class RubikObjectCategoriesShape extends RubikObjectCategories |
21 | 21 |
{ |
22 |
private static final int CATEGORY_SHAPE_CUB = 12; // more than (CATEGORY_SHAPE_HEX<<3) + AXIS_OTHE |
|
23 |
// but less than (CATEGORY_SHAPE_OCT<<3) |
|
24 |
// so that CUBOIDS come right after hexes. |
|
25 |
|
|
22 | 26 |
private void buildSort(int[] data) |
23 | 27 |
{ |
24 | 28 |
int numObjects = data.length; |
... | ... | |
72 | 76 |
switch(shape) |
73 | 77 |
{ |
74 | 78 |
case CATEGORY_SHAPE_HEX: int axis = (cat & 0x1f) >> 3; |
75 |
return (shape<<2) + axis;
|
|
79 |
return (shape<<3) + axis;
|
|
76 | 80 |
case CATEGORY_SHAPE_BAR: |
77 |
case CATEGORY_SHAPE_BAL: return (CATEGORY_SHAPE_OTH<<2);
|
|
81 |
case CATEGORY_SHAPE_BAL: return (CATEGORY_SHAPE_OTH<<3);
|
|
78 | 82 |
case CATEGORY_SHAPE_TET: |
79 | 83 |
case CATEGORY_SHAPE_OCT: |
80 | 84 |
case CATEGORY_SHAPE_DOD: |
81 | 85 |
case CATEGORY_SHAPE_ICO: |
82 |
case CATEGORY_SHAPE_OTH: return (shape<<2);
|
|
86 |
case CATEGORY_SHAPE_OTH: return (cat & CATEGORY_CUBOID)!=0 ? CATEGORY_SHAPE_CUB : (shape<<3);
|
|
83 | 87 |
} |
84 | 88 |
|
85 | 89 |
android.util.Log.e("D", "digestCategory: unknown shape "+shape); |
... | ... | |
91 | 95 |
|
92 | 96 |
private int getImage(int cat) |
93 | 97 |
{ |
94 |
int shape = (cat & 0x1f) >> 2; |
|
98 |
if( cat==CATEGORY_SHAPE_CUB ) return R.drawable.shape_cub; |
|
99 |
int shape = (cat>>3); |
|
95 | 100 |
|
96 | 101 |
switch(shape) |
97 | 102 |
{ |
Also available in: Unified diff
add new shape category to the main grid list: CUBOIDS.