Project

General

Profile

« Previous | Next » 

Revision 201376f3

Added by Leszek Koltunski about 5 years ago

Rubk App: add 4 buttons in the top.

View differences:

src/main/java/org/distorted/examples/rubik/RubikSurfaceView.java
23 23
import android.content.Context;
24 24
import android.content.pm.ConfigurationInfo;
25 25
import android.opengl.GLSurfaceView;
26
import android.util.AttributeSet;
26 27
import android.view.MotionEvent;
27 28

  
28 29
import org.distorted.library.type.Static4D;
......
59 60

  
60 61
///////////////////////////////////////////////////////////////////////////////////////////////////
61 62

  
62
    public RubikSurfaceView(Context context)
63
    public RubikSurfaceView(Context context, AttributeSet attrs)
63 64
      {
64
      super(context);
65
      super(context,attrs);
65 66

  
66
      mRotationVect = VECT[0];
67
      if(!isInEditMode())
68
        {
69
        mRotationVect = VECT[0];
67 70

  
68
      mPoint = new float[3];
69
      mCamera= new float[3];
70
      mDiff  = new float[3];
71
      mTouchPoint = new float[3];
72
      mTouchPointCastOntoFace = new float[3];
71
        mPoint = new float[3];
72
        mCamera= new float[3];
73
        mDiff  = new float[3];
74
        mTouchPoint = new float[3];
75
        mTouchPointCastOntoFace = new float[3];
73 76

  
74
      mScreenWidth = mScreenHeight = mScreenMin = 0;
77
        mScreenWidth = mScreenHeight = mScreenMin = 0;
75 78

  
76
      mRenderer = new RubikRenderer(this);
77
      mCube = mRenderer.getCube();
79
        mRenderer = new RubikRenderer(this);
80
        mCube = mRenderer.getCube();
78 81

  
79
      mQuatCurrent     = new Static4D(0,0,0,1);
80
      mQuatAccumulated = mRenderer.initializeQuat();
82
        mQuatCurrent     = new Static4D(0,0,0,1);
83
        mQuatAccumulated = mRenderer.initializeQuat();
81 84

  
82
      final ActivityManager activityManager     = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
83
      final ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo();
84
      setEGLContextClientVersion( (configurationInfo.reqGlEsVersion>>16) >= 3 ? 3:2 );
85
      setRenderer(mRenderer);
85
        final ActivityManager activityManager     = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
86
        final ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo();
87
        setEGLContextClientVersion( (configurationInfo.reqGlEsVersion>>16) >= 3 ? 3:2 );
88
        setRenderer(mRenderer);
89
        }
86 90
      }
87 91

  
88 92
///////////////////////////////////////////////////////////////////////////////////////////////////

Also available in: Unified diff