Project

General

Profile

« Previous | Next » 

Revision 2dcc11ac

Added by Leszek Koltunski about 12 hours ago

  • ID 2dcc11ac3befb85c359d758a5335fabd1d948bc7
  • Parent ec519d67

Make MagicCube compilable with the KMP branch of the graphics library.

View differences:

src/main/java/org/distorted/bandaged/BandagedActivity.java
63 63
      mObjectOrdinal = (b != null) ? b.getInt("obj") : 0;
64 64
      mDisplayMessageDialog = true;
65 65

  
66
      DistortedLibrary.onCreate(ACTIVITY_NUMBER);
66
      DistortedLibrary.INSTANCE.onCreate(ACTIVITY_NUMBER);
67 67
      setContentView(R.layout.bandaged);
68 68

  
69 69
      final Configuration config = getResources().getConfiguration();
......
118 118
      super.onPause();
119 119
      BandagedView view = findViewById(R.id.bandagedCreatorObjectView);
120 120
      view.onPause();
121
      DistortedLibrary.onPause(ACTIVITY_NUMBER);
121
      DistortedLibrary.INSTANCE.onPause(ACTIVITY_NUMBER);
122 122
      savePreferences();
123 123
      }
124 124

  
......
129 129
      {
130 130
      super.onResume();
131 131

  
132
      DistortedLibrary.onResume(ACTIVITY_NUMBER);
132
      DistortedLibrary.INSTANCE.onResume(ACTIVITY_NUMBER);
133 133
      BandagedView view = findViewById(R.id.bandagedCreatorObjectView);
134 134
      view.onResume();
135 135

  
......
151 151
    protected void onDestroy() 
152 152
      {
153 153
      super.onDestroy();
154
      DistortedLibrary.onDestroy(ACTIVITY_NUMBER);
154
      DistortedLibrary.INSTANCE.onDestroy(ACTIVITY_NUMBER);
155 155
      }
156 156

  
157 157
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/java/org/distorted/bandaged/BandagedRenderer.java
245 245
   @Override
246 246
   public void onSurfaceCreated(GL10 glUnused, EGLConfig config)
247 247
      {
248
      DistortedLibrary.setMax(EffectType.VERTEX,0);
249
      MeshBase.setMaxEffComponents(ObjectControl.MAX_MOVING_PARTS);
250
      FragmentEffectBrightness.enable();
251
      DistortedLibrary.onSurfaceCreated(this,1);
252
      DistortedLibrary.setCull(true);
248
      DistortedLibrary.INSTANCE.setMax(EffectType.VERTEX,0);
249
      MeshBase.Companion.setMaxEffComponents(ObjectControl.MAX_MOVING_PARTS);
250
      FragmentEffectBrightness.Companion.enable();
251
      DistortedLibrary.INSTANCE.onSurfaceCreated(this,1);
252
      DistortedLibrary.INSTANCE.setCull(true);
253 253
      mObject.recreateCubits(mQuatT,mQuatA,mScale);
254 254
      mCubitsCreated = true;
255 255
      mWidth = 0;
src/main/java/org/distorted/config/ConfigActivity.java
45 45
    protected void onCreate(Bundle savedState)
46 46
      {
47 47
      super.onCreate(savedState);
48
      DistortedLibrary.onCreate(ACTIVITY_NUMBER);
48
      DistortedLibrary.INSTANCE.onCreate(ACTIVITY_NUMBER);
49 49
      setContentView(R.layout.config);
50 50

  
51 51
      Bundle b = getIntent().getExtras();
......
68 68
      ConfigSurfaceView view = findViewById(R.id.configSurfaceView);
69 69
      view.onPause();
70 70
      savePreferences();
71
      DistortedLibrary.onPause(ACTIVITY_NUMBER);
71
      DistortedLibrary.INSTANCE.onPause(ACTIVITY_NUMBER);
72 72
      }
73 73

  
74 74
///////////////////////////////////////////////////////////////////////////////////////////////////
......
77 77
    protected void onResume() 
78 78
      {
79 79
      super.onResume();
80
      DistortedLibrary.onResume(ACTIVITY_NUMBER);
80
      DistortedLibrary.INSTANCE.onResume(ACTIVITY_NUMBER);
81 81
      ConfigSurfaceView view = findViewById(R.id.configSurfaceView);
82 82
      view.onResume();
83 83
      String key ="";
......
132 132
    protected void onDestroy() 
133 133
      {
134 134
      super.onDestroy();
135
      DistortedLibrary.onDestroy(ACTIVITY_NUMBER);
135
      DistortedLibrary.INSTANCE.onDestroy(ACTIVITY_NUMBER);
136 136
      }
137 137

  
138 138
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/java/org/distorted/config/ConfigObjectLibInterface.java
11 11

  
12 12
import com.google.firebase.crashlytics.FirebaseCrashlytics;
13 13

  
14
import org.distorted.library.message.EffectMessageSender;
15 14
import org.distorted.main.BuildConfig;
16
import org.distorted.objectlib.helpers.BlockController;
17 15
import org.distorted.objectlib.helpers.ObjectLibInterface;
18 16

  
19 17
import java.lang.ref.WeakReference;
......
41 39
  public void onRemoveRotation(int axis, int rowBitmap, int degrees) { }
42 40
  public void failedToDrag() { }
43 41
  public void reportJSONError(String error, int ordinal) { }
42
  public void reportBlockProblem(int type, int place, long pause, long resume, long time) { }
44 43

  
45 44
///////////////////////////////////////////////////////////////////////////////////////////////////
46 45

  
......
107 106
      }
108 107
    }
109 108

  
110
///////////////////////////////////////////////////////////////////////////////////////////////////
111

  
112
  private void reportThreadProblem(int place, long pause, long resume, long time)
113
    {
114
    String error = EffectMessageSender.reportState();
115

  
116
    if( BuildConfig.DEBUG )
117
       {
118
       android.util.Log.e("D", error);
119
       }
120
    else
121
      {
122
      Exception ex = new Exception(error);
123
      FirebaseCrashlytics crashlytics = FirebaseCrashlytics.getInstance();
124
      crashlytics.setCustomKey("pause" , pause  );
125
      crashlytics.setCustomKey("resume", resume );
126
      crashlytics.recordException(ex);
127
      }
128
    }
129

  
130
///////////////////////////////////////////////////////////////////////////////////////////////////
131

  
132
  public void reportBlockProblem(int type, int place, long pause, long resume, long time)
133
    {
134
    switch(type)
135
      {
136
      case BlockController.TYPE_SCRAMBLING: reportScramblingProblem(place,pause,resume,time); break;
137
      case BlockController.TYPE_ROTATION  : reportRotationProblem(place,pause,resume,time); break;
138
      case BlockController.TYPE_THREAD    : reportThreadProblem(place,pause,resume,time); break;
139
      }
140
    }
141

  
142 109
///////////////////////////////////////////////////////////////////////////////////////////////////
143 110

  
144 111
  public void onStickerTouched(int cubit, int face)
src/main/java/org/distorted/config/ConfigRenderer.java
158 158
   @Override
159 159
   public void onSurfaceCreated(GL10 glUnused, EGLConfig config)
160 160
      {
161
      DistortedLibrary.setMax(EffectType.VERTEX, ObjectControl.MAX_QUATS+1);
162
      VertexEffectRotate.enable();
163
      VertexEffectQuaternion.enable();
161
      DistortedLibrary.INSTANCE.setMax(EffectType.VERTEX, ObjectControl.MAX_QUATS+1);
162
      VertexEffectRotate.Companion.enable();
163
      VertexEffectQuaternion.Companion.enable();
164 164
      BaseEffect.Type.enableEffects();
165 165

  
166
      DistortedLibrary.onSurfaceCreated(this,1);
167
      DistortedLibrary.setCull(true);
166
      DistortedLibrary.INSTANCE.onSurfaceCreated(this,1);
167
      DistortedLibrary.INSTANCE.setCull(true);
168 168
      }
169 169

  
170 170
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/java/org/distorted/info/InfoActivity.java
37 37
    protected void onCreate(Bundle savedState)
38 38
      {
39 39
      super.onCreate(savedState);
40
      DistortedLibrary.onCreate(ACTIVITY_NUMBER);
40
      DistortedLibrary.INSTANCE.onCreate(ACTIVITY_NUMBER);
41 41
      setContentView(R.layout.info);
42 42

  
43 43
      Bundle b = getIntent().getExtras();
......
57 57
      super.onPause();
58 58
      InfoSurfaceView view = findViewById(R.id.infoSurfaceView);
59 59
      view.onPause();
60
      DistortedLibrary.onPause(ACTIVITY_NUMBER);
60
      DistortedLibrary.INSTANCE.onPause(ACTIVITY_NUMBER);
61 61
      }
62 62

  
63 63
///////////////////////////////////////////////////////////////////////////////////////////////////
......
66 66
    protected void onResume() 
67 67
      {
68 68
      super.onResume();
69
      DistortedLibrary.onResume(ACTIVITY_NUMBER);
69
      DistortedLibrary.INSTANCE.onResume(ACTIVITY_NUMBER);
70 70
      InfoSurfaceView view = findViewById(R.id.infoSurfaceView);
71 71
      view.onResume();
72 72

  
......
86 86
    protected void onDestroy() 
87 87
      {
88 88
      super.onDestroy();
89
      DistortedLibrary.onDestroy(ACTIVITY_NUMBER);
89
      DistortedLibrary.INSTANCE.onDestroy(ACTIVITY_NUMBER);
90 90
      }
91 91

  
92 92
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/java/org/distorted/info/InfoObjectLibInterface.java
11 11

  
12 12
import com.google.firebase.crashlytics.FirebaseCrashlytics;
13 13

  
14
import org.distorted.library.message.EffectMessageSender;
15 14
import org.distorted.main.BuildConfig;
16
import org.distorted.objectlib.helpers.BlockController;
17 15
import org.distorted.objectlib.helpers.ObjectLibInterface;
18 16

  
19 17
///////////////////////////////////////////////////////////////////////////////////////////////////
......
30 28
  public void onRemoveRotation(int axis, int rowBitmap, int degrees) { }
31 29
  public void failedToDrag() { }
32 30
  public void reportJSONError(String error, int ordinal) { }
31
  public void reportBlockProblem(int type, int place, long pause, long resume, long time) { }
33 32

  
34 33
///////////////////////////////////////////////////////////////////////////////////////////////////
35 34

  
......
55 54
        }
56 55
      }
57 56
    }
58

  
59
///////////////////////////////////////////////////////////////////////////////////////////////////
60

  
61
  private void reportScramblingProblem(int place, long pause, long resume, long time)
62
    {
63
    String error = "SCRAMBLING BLOCK "+place+" blocked for "+time;
64

  
65
    if( BuildConfig.DEBUG )
66
       {
67
       android.util.Log.e("D", error);
68
       }
69
    else
70
      {
71
      Exception ex = new Exception(error);
72
      FirebaseCrashlytics crashlytics = FirebaseCrashlytics.getInstance();
73
      crashlytics.setCustomKey("pause" , pause );
74
      crashlytics.setCustomKey("resume", resume );
75
      crashlytics.recordException(ex);
76
      }
77
    }
78

  
79
///////////////////////////////////////////////////////////////////////////////////////////////////
80

  
81
  private void reportRotationProblem(int place, long pause, long resume, long time)
82
    {
83
    String error = "ROTATION BLOCK "+place+" blocked for "+time;
84

  
85
    if( BuildConfig.DEBUG )
86
       {
87
       android.util.Log.e("D", error);
88
       }
89
    else
90
      {
91
      Exception ex = new Exception(error);
92
      FirebaseCrashlytics crashlytics = FirebaseCrashlytics.getInstance();
93
      crashlytics.setCustomKey("pause" , pause );
94
      crashlytics.setCustomKey("resume", resume);
95
      crashlytics.recordException(ex);
96
      }
97
    }
98

  
99
///////////////////////////////////////////////////////////////////////////////////////////////////
100

  
101
  private void reportThreadProblem(int place, long pause, long resume, long time)
102
    {
103
    String error = EffectMessageSender.reportState();
104

  
105
    if( BuildConfig.DEBUG )
106
       {
107
       android.util.Log.e("D", error);
108
       }
109
    else
110
      {
111
      Exception ex = new Exception(error);
112
      FirebaseCrashlytics crashlytics = FirebaseCrashlytics.getInstance();
113
      crashlytics.setCustomKey("pause" , pause  );
114
      crashlytics.setCustomKey("resume", resume );
115
      crashlytics.recordException(ex);
116
      }
117
    }
118

  
119
///////////////////////////////////////////////////////////////////////////////////////////////////
120

  
121
  public void reportBlockProblem(int type, int place, long pause, long resume, long time)
122
    {
123
    switch(type)
124
      {
125
      case BlockController.TYPE_SCRAMBLING: reportScramblingProblem(place,pause,resume,time); break;
126
      case BlockController.TYPE_ROTATION  : reportRotationProblem(place,pause,resume,time); break;
127
      case BlockController.TYPE_THREAD    : reportThreadProblem(place,pause,resume,time); break;
128
      }
129
    }
130 57
}
src/main/java/org/distorted/info/InfoRenderer.java
76 76
   @Override
77 77
   public void onSurfaceCreated(GL10 glUnused, EGLConfig config)
78 78
      {
79
      DistortedLibrary.setMax(EffectType.VERTEX, ObjectControl.MAX_QUATS+1);
80
      VertexEffectRotate.enable();
81
      VertexEffectQuaternion.enable();
79
      DistortedLibrary.INSTANCE.setMax(EffectType.VERTEX, ObjectControl.MAX_QUATS+1);
80
      VertexEffectRotate.Companion.enable();
81
      VertexEffectQuaternion.Companion.enable();
82 82
      BaseEffect.Type.enableEffects();
83 83

  
84
      DistortedLibrary.onSurfaceCreated(this,1);
85
      DistortedLibrary.setCull(true);
84
      DistortedLibrary.INSTANCE.onSurfaceCreated(this,1);
85
      DistortedLibrary.INSTANCE.setCull(true);
86 86
      }
87 87

  
88 88
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/java/org/distorted/patterns/PatternActivity.java
53 53
    protected void onCreate(Bundle savedState)
54 54
      {
55 55
      super.onCreate(savedState);
56
      DistortedLibrary.onCreate(ACTIVITY_NUMBER);
56
      DistortedLibrary.INSTANCE.onCreate(ACTIVITY_NUMBER);
57 57
      setContentView(R.layout.pattern);
58 58

  
59 59
      Bundle b = getIntent().getExtras();
......
93 93
      super.onPause();
94 94
      PatternSurfaceView view = findViewById(R.id.patternSurfaceView);
95 95
      view.onPause();
96
      DistortedLibrary.onPause(ACTIVITY_NUMBER);
96
      DistortedLibrary.INSTANCE.onPause(ACTIVITY_NUMBER);
97 97
      savePreferences();
98 98
      }
99 99

  
......
103 103
    protected void onResume() 
104 104
      {
105 105
      super.onResume();
106
      DistortedLibrary.onResume(ACTIVITY_NUMBER);
106
      DistortedLibrary.INSTANCE.onResume(ACTIVITY_NUMBER);
107 107
      PatternSurfaceView view = findViewById(R.id.patternSurfaceView);
108 108
      view.onResume();
109 109

  
......
117 117
    @Override
118 118
    protected void onDestroy() 
119 119
      {
120
      DistortedLibrary.onDestroy(ACTIVITY_NUMBER);
120
      DistortedLibrary.INSTANCE.onDestroy(ACTIVITY_NUMBER);
121 121
      super.onDestroy();
122 122
      }
123 123

  
src/main/java/org/distorted/patterns/PatternObjectLibInterface.java
11 11

  
12 12
import com.google.firebase.crashlytics.FirebaseCrashlytics;
13 13

  
14
import org.distorted.library.message.EffectMessageSender;
15 14
import org.distorted.main.BuildConfig;
16
import org.distorted.objectlib.helpers.BlockController;
17 15
import org.distorted.objectlib.helpers.ObjectLibInterface;
18 16
import org.distorted.objects.RubikObject;
19 17
import org.distorted.objects.RubikObjectList;
......
32 30
  public void onWinEffectFinished(long startTime, long endTime, int scrambleNum) { }
33 31
  public void onStickerTouched(int cubit, int face) { }
34 32
  public void onStickerUntouched() { }
33
  public void reportBlockProblem(int type, int place, long pause, long resume, long time) { }
35 34

  
36 35
///////////////////////////////////////////////////////////////////////////////////////////////////
37 36

  
......
58 57
      }
59 58
    }
60 59

  
61
///////////////////////////////////////////////////////////////////////////////////////////////////
62

  
63
  private void reportScramblingProblem(int place, long pause, long resume, long time)
64
    {
65
    String error = "SCRAMBLING BLOCK "+place+" blocked for "+time;
66

  
67
    if( BuildConfig.DEBUG )
68
       {
69
       android.util.Log.e("libInterface", error);
70
       }
71
    else
72
      {
73
      Exception ex = new Exception(error);
74
      FirebaseCrashlytics crashlytics = FirebaseCrashlytics.getInstance();
75
      crashlytics.setCustomKey("pause" , pause );
76
      crashlytics.setCustomKey("resume", resume );
77
      crashlytics.recordException(ex);
78
      }
79
    }
80

  
81
///////////////////////////////////////////////////////////////////////////////////////////////////
82

  
83
  private void reportRotationProblem(int place, long pause, long resume, long time)
84
    {
85
    String error = "ROTATION BLOCK "+place+" blocked for "+time;
86

  
87
    if( BuildConfig.DEBUG )
88
       {
89
       android.util.Log.e("libInterface", error);
90
       }
91
    else
92
      {
93
      Exception ex = new Exception(error);
94
      FirebaseCrashlytics crashlytics = FirebaseCrashlytics.getInstance();
95
      crashlytics.setCustomKey("pause" , pause );
96
      crashlytics.setCustomKey("resume", resume);
97
      crashlytics.recordException(ex);
98
      }
99
    }
100

  
101
///////////////////////////////////////////////////////////////////////////////////////////////////
102

  
103
  private void reportThreadProblem(int place, long pause, long resume, long time)
104
    {
105
    String error = EffectMessageSender.reportState();
106

  
107
    if( BuildConfig.DEBUG )
108
       {
109
       android.util.Log.e("libInterface", error);
110
       }
111
    else
112
      {
113
      Exception ex = new Exception(error);
114
      FirebaseCrashlytics crashlytics = FirebaseCrashlytics.getInstance();
115
      crashlytics.setCustomKey("pause" , pause  );
116
      crashlytics.setCustomKey("resume", resume );
117
      crashlytics.recordException(ex);
118
      }
119
    }
120

  
121
///////////////////////////////////////////////////////////////////////////////////////////////////
122

  
123
  public void reportBlockProblem(int type, int place, long pause, long resume, long time)
124
    {
125
    switch(type)
126
      {
127
      case BlockController.TYPE_SCRAMBLING: reportScramblingProblem(place,pause,resume,time); break;
128
      case BlockController.TYPE_ROTATION  : reportRotationProblem(place,pause,resume,time); break;
129
      case BlockController.TYPE_THREAD    : reportThreadProblem(place,pause,resume,time); break;
130
      }
131
    }
132

  
133 60
///////////////////////////////////////////////////////////////////////////////////////////////////
134 61

  
135 62
  public void reportJSONError(String error, int ordinal)
src/main/java/org/distorted/patterns/PatternRenderer.java
91 91
   @Override
92 92
   public void onSurfaceCreated(GL10 glUnused, EGLConfig config)
93 93
      {
94
      DistortedLibrary.setMax(EffectType.VERTEX,ObjectControl.MAX_QUATS+1);
95
      MeshBase.setMaxEffComponents(ObjectControl.MAX_MOVING_PARTS);
94
      DistortedLibrary.INSTANCE.setMax(EffectType.VERTEX,ObjectControl.MAX_QUATS+1);
95
      MeshBase.Companion.setMaxEffComponents(ObjectControl.MAX_MOVING_PARTS);
96 96

  
97
      VertexEffectRotate.enable();
98
      VertexEffectQuaternion.enable();
97
      VertexEffectRotate.Companion.enable();
98
      VertexEffectQuaternion.Companion.enable();
99 99
      BaseEffect.Type.enableEffects();
100 100

  
101
      DistortedLibrary.onSurfaceCreated(this,1);
102
      DistortedLibrary.setCull(true);
101
      DistortedLibrary.INSTANCE.onSurfaceCreated(this,1);
102
      DistortedLibrary.INSTANCE.setCull(true);
103 103
      }
104 104

  
105 105
///////////////////////////////////////////////////////////////////////////////////////////////////
......
133 133
       crashlytics.recordException(ex);
134 134
       }
135 135

  
136
     int glsl = DistortedLibrary.getGLSL();
136
     int glsl = DistortedLibrary.INSTANCE.getGLSL();
137 137

  
138 138
     if( glsl< 300 && !mErrorShown )
139 139
       {
src/main/java/org/distorted/play/PlayActivity.java
72 72
    protected void onCreate(Bundle savedState)
73 73
      {
74 74
      super.onCreate(savedState);
75
      DistortedLibrary.onCreate(ACTIVITY_NUMBER);
75
      DistortedLibrary.INSTANCE.onCreate(ACTIVITY_NUMBER);
76 76
      setContentView(R.layout.play);
77 77

  
78 78
      mJustStarted = true;
......
159 159
      PlayView view = findViewById(R.id.playView);
160 160
      view.onPause();
161 161
      savePreferences();
162
      DistortedLibrary.onPause(ACTIVITY_NUMBER);
162
      DistortedLibrary.INSTANCE.onPause(ACTIVITY_NUMBER);
163 163
      }
164 164

  
165 165
///////////////////////////////////////////////////////////////////////////////////////////////////
......
169 169
      {
170 170
      super.onResume();
171 171

  
172
      DistortedLibrary.onResume(ACTIVITY_NUMBER);
172
      DistortedLibrary.INSTANCE.onResume(ACTIVITY_NUMBER);
173 173
      PlayView view = findViewById(R.id.playView);
174 174
      ObjectControl control = view.getObjectControl();
175 175
      view.onResume();
......
226 226
    protected void onDestroy() 
227 227
      {
228 228
      super.onDestroy();
229
      DistortedLibrary.onDestroy(ACTIVITY_NUMBER);
229
      DistortedLibrary.INSTANCE.onDestroy(ACTIVITY_NUMBER);
230 230
      }
231 231

  
232 232
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/java/org/distorted/play/PlayLibInterface.java
33 33
import org.distorted.dialogs.DialogSolved;
34 34
import org.distorted.helpers.RubikNetwork;
35 35
import org.distorted.helpers.RubikScores;
36
import org.distorted.library.message.EffectMessageSender;
37
import org.distorted.objectlib.helpers.BlockController;
38 36
import org.distorted.objectlib.helpers.ObjectLibInterface;
39 37
import org.distorted.objectlib.main.ObjectControl;
40 38
import org.distorted.objectlib.main.TwistyObject;
......
67 65
  public void onObjectCreated(long time) { }
68 66
  public void onStickerTouched(int cubit, int face) { }
69 67
  public void onStickerUntouched() { }
68
  public void reportBlockProblem(int type, int place, long pause, long resume, long time) { }
70 69

  
71 70
///////////////////////////////////////////////////////////////////////////////////////////////////
72 71

  
......
397 396
      }
398 397
    }
399 398

  
400
///////////////////////////////////////////////////////////////////////////////////////////////////
401

  
402
  private void reportThreadProblem(int place, long pause, long resume, long time)
403
    {
404
    String error = EffectMessageSender.reportState();
405

  
406
    if( BuildConfig.DEBUG )
407
       {
408
       android.util.Log.e("D", error);
409
       }
410
    else
411
      {
412
      Exception ex = new Exception(error);
413
      FirebaseCrashlytics crashlytics = FirebaseCrashlytics.getInstance();
414
      crashlytics.setCustomKey("pause" , pause  );
415
      crashlytics.setCustomKey("resume", resume );
416
      crashlytics.recordException(ex);
417
      }
418
    }
419

  
420
///////////////////////////////////////////////////////////////////////////////////////////////////
421

  
422
  public void reportBlockProblem(int type, int place, long pause, long resume, long time)
423
    {
424
    switch(type)
425
      {
426
      case BlockController.TYPE_SCRAMBLING: reportScramblingProblem(place,pause,resume,time); break;
427
      case BlockController.TYPE_ROTATION  : reportRotationProblem(place,pause,resume,time); break;
428
      case BlockController.TYPE_THREAD    : reportThreadProblem(place,pause,resume,time); break;
429
      }
430
    }
431

  
432 399
///////////////////////////////////////////////////////////////////////////////////////////////////
433 400

  
434 401
  public void reportJSONError(String error, int ordinal)
src/main/java/org/distorted/play/PlayRenderer.java
77 77
   @Override
78 78
   public void onSurfaceCreated(GL10 glUnused, EGLConfig config)
79 79
      {
80
      DistortedLibrary.setMax(EffectType.VERTEX, ObjectControl.MAX_QUATS+1);
81
      MeshBase.setMaxEffComponents(ObjectControl.MAX_MOVING_PARTS);
80
      DistortedLibrary.INSTANCE.setMax(EffectType.VERTEX, ObjectControl.MAX_QUATS+1);
81
      MeshBase.Companion.setMaxEffComponents(ObjectControl.MAX_MOVING_PARTS);
82 82

  
83
      VertexEffectRotate.enable();
84
      VertexEffectQuaternion.enable();
83
      VertexEffectRotate.Companion.enable();
84
      VertexEffectQuaternion.Companion.enable();
85 85
      BaseEffect.Type.enableEffects();
86 86

  
87
      DistortedLibrary.onSurfaceCreated(this,1);
88
      DistortedLibrary.setCull(true);
87
      DistortedLibrary.INSTANCE.onSurfaceCreated(this,1);
88
      DistortedLibrary.INSTANCE.setCull(true);
89 89
      }
90 90

  
91 91
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/java/org/distorted/solvers/SolverActivity.java
57 57
    protected void onCreate(Bundle savedState)
58 58
      {
59 59
      super.onCreate(savedState);
60
      DistortedLibrary.onCreate(ACTIVITY_NUMBER);
60
      DistortedLibrary.INSTANCE.onCreate(ACTIVITY_NUMBER);
61 61
      setContentView(R.layout.solver);
62 62

  
63 63
      Bundle b = getIntent().getExtras();
......
98 98
      super.onPause();
99 99
      SolverSurfaceView view = findViewById(R.id.solverSurfaceView);
100 100
      view.onPause();
101
      DistortedLibrary.onPause(ACTIVITY_NUMBER);
101
      DistortedLibrary.INSTANCE.onPause(ACTIVITY_NUMBER);
102 102
      savePreferences();
103 103
      }
104 104

  
......
108 108
    protected void onResume() 
109 109
      {
110 110
      super.onResume();
111
      DistortedLibrary.onResume(ACTIVITY_NUMBER);
111
      DistortedLibrary.INSTANCE.onResume(ACTIVITY_NUMBER);
112 112
      SolverSurfaceView view = findViewById(R.id.solverSurfaceView);
113 113
      view.onResume();
114 114

  
......
123 123
    @Override
124 124
    protected void onDestroy() 
125 125
      {
126
      DistortedLibrary.onDestroy(ACTIVITY_NUMBER);
126
      DistortedLibrary.INSTANCE.onDestroy(ACTIVITY_NUMBER);
127 127
      super.onDestroy();
128 128
      }
129 129

  
src/main/java/org/distorted/solvers/SolverObjectLibInterface.java
11 11

  
12 12
import com.google.firebase.crashlytics.FirebaseCrashlytics;
13 13

  
14
import org.distorted.library.message.EffectMessageSender;
15 14
import org.distorted.main.BuildConfig;
16
import org.distorted.objectlib.helpers.BlockController;
17 15
import org.distorted.objectlib.helpers.ObjectLibInterface;
18 16
import org.distorted.objectlib.main.ObjectControl;
19 17
import org.distorted.objects.RubikObject;
......
46 44
  public void onSolved() { }
47 45
  public void onObjectCreated(long time) { }
48 46
  public void onWinEffectFinished(long startTime, long endTime, int scrambleNum) { }
47
  public void reportBlockProblem(int type, int place, long pause, long resume, long time) { }
49 48

  
50 49
///////////////////////////////////////////////////////////////////////////////////////////////////
51 50

  
......
112 111
      }
113 112
    }
114 113

  
115
///////////////////////////////////////////////////////////////////////////////////////////////////
116

  
117
  private void reportThreadProblem(int place, long pause, long resume, long time)
118
    {
119
    String error = EffectMessageSender.reportState();
120

  
121
    if( BuildConfig.DEBUG )
122
       {
123
       android.util.Log.e("libInterface", error);
124
       }
125
    else
126
      {
127
      Exception ex = new Exception(error);
128
      FirebaseCrashlytics crashlytics = FirebaseCrashlytics.getInstance();
129
      crashlytics.setCustomKey("pause" , pause  );
130
      crashlytics.setCustomKey("resume", resume );
131
      crashlytics.recordException(ex);
132
      }
133
    }
134

  
135
///////////////////////////////////////////////////////////////////////////////////////////////////
136

  
137
  public void reportBlockProblem(int type, int place, long pause, long resume, long time)
138
    {
139
    switch(type)
140
      {
141
      case BlockController.TYPE_SCRAMBLING: reportScramblingProblem(place,pause,resume,time); break;
142
      case BlockController.TYPE_ROTATION  : reportRotationProblem(place,pause,resume,time); break;
143
      case BlockController.TYPE_THREAD    : reportThreadProblem(place,pause,resume,time); break;
144
      }
145
    }
146

  
147 114
///////////////////////////////////////////////////////////////////////////////////////////////////
148 115

  
149 116
  public void reportJSONError(String error, int ordinal)
src/main/java/org/distorted/solvers/SolverRenderer.java
91 91
   @Override
92 92
   public void onSurfaceCreated(GL10 glUnused, EGLConfig config)
93 93
      {
94
      DistortedLibrary.setMax(EffectType.VERTEX,ObjectControl.MAX_QUATS+1);
95
      MeshBase.setMaxEffComponents(ObjectControl.MAX_MOVING_PARTS);
94
      DistortedLibrary.INSTANCE.setMax(EffectType.VERTEX,ObjectControl.MAX_QUATS+1);
95
      MeshBase.Companion.setMaxEffComponents(ObjectControl.MAX_MOVING_PARTS);
96 96

  
97
      VertexEffectRotate.enable();
98
      VertexEffectQuaternion.enable();
97
      VertexEffectRotate.Companion.enable();
98
      VertexEffectQuaternion.Companion.enable();
99 99
      BaseEffect.Type.enableEffects();
100 100

  
101
      DistortedLibrary.onSurfaceCreated(this,1);
102
      DistortedLibrary.setCull(true);
101
      DistortedLibrary.INSTANCE.onSurfaceCreated(this,1);
102
      DistortedLibrary.INSTANCE.setCull(true);
103 103
      }
104 104

  
105 105
///////////////////////////////////////////////////////////////////////////////////////////////////
......
133 133
       crashlytics.recordException(ex);
134 134
       }
135 135

  
136
     int glsl = DistortedLibrary.getGLSL();
136
     int glsl = DistortedLibrary.INSTANCE.getGLSL();
137 137

  
138 138
     if( glsl< 300 && !mErrorShown )
139 139
       {
src/main/java/org/distorted/tutorials/TutorialActivity.java
50 50
    protected void onCreate(Bundle savedState)
51 51
      {
52 52
      super.onCreate(savedState);
53
      DistortedLibrary.onCreate(ACTIVITY_NUMBER);
53
      DistortedLibrary.INSTANCE.onCreate(ACTIVITY_NUMBER);
54 54

  
55 55
      try
56 56
        {
......
121 121

  
122 122
      if( mWebView!=null ) mWebView.onPause();
123 123

  
124
      DistortedLibrary.onPause(ACTIVITY_NUMBER);
124
      DistortedLibrary.INSTANCE.onPause(ACTIVITY_NUMBER);
125 125
      }
126 126

  
127 127
///////////////////////////////////////////////////////////////////////////////////////////////////
......
130 130
    protected void onResume() 
131 131
      {
132 132
      super.onResume();
133
      DistortedLibrary.onResume(ACTIVITY_NUMBER);
133
      DistortedLibrary.INSTANCE.onResume(ACTIVITY_NUMBER);
134 134
      TutorialSurfaceView view = findViewById(R.id.tutorialSurfaceView);
135 135
      view.onResume();
136 136

  
......
159 159
    protected void onDestroy() 
160 160
      {
161 161
      super.onDestroy();
162
      DistortedLibrary.onDestroy(ACTIVITY_NUMBER);
162
      DistortedLibrary.INSTANCE.onDestroy(ACTIVITY_NUMBER);
163 163
      }
164 164

  
165 165
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/java/org/distorted/tutorials/TutorialObjectLibInterface.java
11 11

  
12 12
import com.google.firebase.crashlytics.FirebaseCrashlytics;
13 13

  
14
import org.distorted.library.message.EffectMessageSender;
15 14
import org.distorted.main.BuildConfig;
16
import org.distorted.objectlib.helpers.BlockController;
17 15
import org.distorted.objectlib.helpers.ObjectLibInterface;
18 16

  
19 17
import java.lang.ref.WeakReference;
......
41 39
  public void onStickerTouched(int cubit, int face) { }
42 40
  public void onStickerUntouched() { }
43 41
  public void reportJSONError(String error, int ordinal) { }
42
  public void reportBlockProblem(int type, int place, long pause, long resume, long time) { }
44 43

  
45 44
///////////////////////////////////////////////////////////////////////////////////////////////////
46 45

  
......
67 66
      }
68 67
    }
69 68

  
70
///////////////////////////////////////////////////////////////////////////////////////////////////
71

  
72
  private void reportScramblingProblem(int place, long pause, long resume, long time)
73
    {
74
    String error = "SCRAMBLING BLOCK "+place+" blocked for "+time;
75

  
76
    if( BuildConfig.DEBUG )
77
       {
78
       android.util.Log.e("D", error);
79
       }
80
    else
81
      {
82
      Exception ex = new Exception(error);
83
      FirebaseCrashlytics crashlytics = FirebaseCrashlytics.getInstance();
84
      crashlytics.setCustomKey("pause" , pause );
85
      crashlytics.setCustomKey("resume", resume );
86
      crashlytics.recordException(ex);
87
      }
88
    }
89

  
90
///////////////////////////////////////////////////////////////////////////////////////////////////
91

  
92
  private void reportRotationProblem(int place, long pause, long resume, long time)
93
    {
94
    String error = "ROTATION BLOCK "+place+" blocked for "+time;
95

  
96
    if( BuildConfig.DEBUG )
97
       {
98
       android.util.Log.e("D", error);
99
       }
100
    else
101
      {
102
      Exception ex = new Exception(error);
103
      FirebaseCrashlytics crashlytics = FirebaseCrashlytics.getInstance();
104
      crashlytics.setCustomKey("pause" , pause );
105
      crashlytics.setCustomKey("resume", resume);
106
      crashlytics.recordException(ex);
107
      }
108
    }
109

  
110
///////////////////////////////////////////////////////////////////////////////////////////////////
111

  
112
  private void reportThreadProblem(int place, long pause, long resume, long time)
113
    {
114
    String error = EffectMessageSender.reportState();
115

  
116
    if( BuildConfig.DEBUG )
117
       {
118
       android.util.Log.e("D", error);
119
       }
120
    else
121
      {
122
      Exception ex = new Exception(error);
123
      FirebaseCrashlytics crashlytics = FirebaseCrashlytics.getInstance();
124
      crashlytics.setCustomKey("pause" , pause  );
125
      crashlytics.setCustomKey("resume", resume );
126
      crashlytics.recordException(ex);
127
      }
128
    }
129

  
130
///////////////////////////////////////////////////////////////////////////////////////////////////
131

  
132
  public void reportBlockProblem(int type, int place, long pause, long resume, long time)
133
    {
134
    switch(type)
135
      {
136
      case BlockController.TYPE_SCRAMBLING: reportScramblingProblem(place,pause,resume,time); break;
137
      case BlockController.TYPE_ROTATION  : reportRotationProblem(place,pause,resume,time); break;
138
      case BlockController.TYPE_THREAD    : reportThreadProblem(place,pause,resume,time); break;
139
      }
140
    }
141

  
142 69
///////////////////////////////////////////////////////////////////////////////////////////////////
143 70

  
144 71
  public void onRemoveRotation(int axis, int rowBitmap, int degrees)
src/main/java/org/distorted/tutorials/TutorialRenderer.java
78 78
   @Override
79 79
   public void onSurfaceCreated(GL10 glUnused, EGLConfig config)
80 80
      {
81
      DistortedLibrary.setMax(EffectType.VERTEX, ObjectControl.MAX_QUATS+1);
82
      MeshBase.setMaxEffComponents(ObjectControl.MAX_MOVING_PARTS);
81
      DistortedLibrary.INSTANCE.setMax(EffectType.VERTEX, ObjectControl.MAX_QUATS+1);
82
      MeshBase.Companion.setMaxEffComponents(ObjectControl.MAX_MOVING_PARTS);
83 83

  
84
      VertexEffectRotate.enable();
85
      VertexEffectQuaternion.enable();
84
      VertexEffectRotate.Companion.enable();
85
      VertexEffectQuaternion.Companion.enable();
86 86
      BaseEffect.Type.enableEffects();
87 87

  
88
      DistortedLibrary.onSurfaceCreated(this,1);
89
      DistortedLibrary.setCull(true);
88
      DistortedLibrary.INSTANCE.onSurfaceCreated(this,1);
89
      DistortedLibrary.INSTANCE.setCull(true);
90 90
      }
91 91

  
92 92
///////////////////////////////////////////////////////////////////////////////////////////////////

Also available in: Unified diff