1 |
9530f6b0
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
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.bandaged;
|
21 |
|
|
|
22 |
|
|
import android.app.ActivityManager;
|
23 |
|
|
import android.content.Context;
|
24 |
|
|
import android.content.pm.ConfigurationInfo;
|
25 |
|
|
import android.opengl.GLES30;
|
26 |
|
|
import android.opengl.GLSurfaceView;
|
27 |
|
|
import android.util.AttributeSet;
|
28 |
|
|
|
29 |
|
|
import com.google.firebase.crashlytics.FirebaseCrashlytics;
|
30 |
|
|
|
31 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
32 |
|
|
|
33 |
|
|
public class BandagedCreatorView extends GLSurfaceView
|
34 |
|
|
{
|
35 |
|
|
private BandagedCreatorRenderer mRenderer;
|
36 |
|
|
|
37 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
38 |
|
|
// PUBLIC API
|
39 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
40 |
|
|
|
41 |
|
|
public BandagedCreatorView(Context context, AttributeSet attrs)
|
42 |
|
|
{
|
43 |
|
|
super(context,attrs);
|
44 |
|
|
|
45 |
|
|
if(!isInEditMode())
|
46 |
|
|
{
|
47 |
|
|
BandagedCreatorActivity act = (BandagedCreatorActivity)context;
|
48 |
|
|
mRenderer = new BandagedCreatorRenderer(this);
|
49 |
|
|
|
50 |
|
|
final ActivityManager activityManager= (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
|
51 |
|
|
|
52 |
|
|
try
|
53 |
|
|
{
|
54 |
|
|
final ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo();
|
55 |
|
|
int esVersion = configurationInfo.reqGlEsVersion>>16;
|
56 |
|
|
setEGLContextClientVersion(esVersion);
|
57 |
|
|
setRenderer(mRenderer);
|
58 |
|
|
}
|
59 |
|
|
catch(Exception ex)
|
60 |
|
|
{
|
61 |
|
|
act.OpenGLError();
|
62 |
|
|
|
63 |
|
|
String shading = GLES30.glGetString(GLES30.GL_SHADING_LANGUAGE_VERSION);
|
64 |
|
|
String version = GLES30.glGetString(GLES30.GL_VERSION);
|
65 |
|
|
String vendor = GLES30.glGetString(GLES30.GL_VENDOR);
|
66 |
|
|
String renderer= GLES30.glGetString(GLES30.GL_RENDERER);
|
67 |
|
|
|
68 |
|
|
FirebaseCrashlytics crashlytics = FirebaseCrashlytics.getInstance();
|
69 |
|
|
crashlytics.setCustomKey("GLSL Version" , shading );
|
70 |
|
|
crashlytics.setCustomKey("GL version" , version );
|
71 |
|
|
crashlytics.setCustomKey("GL Vendor " , vendor );
|
72 |
|
|
crashlytics.setCustomKey("GLSL renderer" , renderer);
|
73 |
|
|
crashlytics.recordException(ex);
|
74 |
|
|
}
|
75 |
|
|
}
|
76 |
|
|
}
|
77 |
|
|
|
78 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
79 |
|
|
|
80 |
|
|
@Override
|
81 |
|
|
public void onPause()
|
82 |
|
|
{
|
83 |
|
|
super.onPause();
|
84 |
|
|
}
|
85 |
|
|
|
86 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
87 |
|
|
|
88 |
|
|
@Override
|
89 |
|
|
public void onResume()
|
90 |
|
|
{
|
91 |
|
|
super.onResume();
|
92 |
|
|
}
|
93 |
|
|
}
|