commit 6ab5da9a26b5aa1f8068858fbc77fa8fd7c51f14
Author: Leszek Koltunski <leszek@distoretedandroid.org>
Date:   Wed Feb 15 15:32:49 2017 +0000

    Improve Olimpic.

diff --git a/src/main/java/org/distorted/examples/olimpic/OlimpicActivity.java b/src/main/java/org/distorted/examples/olimpic/OlimpicActivity.java
index b5fa4c3..77e4aa8 100644
--- a/src/main/java/org/distorted/examples/olimpic/OlimpicActivity.java
+++ b/src/main/java/org/distorted/examples/olimpic/OlimpicActivity.java
@@ -25,6 +25,8 @@ import org.distorted.library.Distorted;
 import android.app.Activity;
 import android.opengl.GLSurfaceView;
 import android.os.Bundle;
+import android.view.View;
+import android.widget.Button;
 import android.widget.TextView;
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
@@ -40,6 +42,68 @@ public class OlimpicActivity extends Activity
       mText.setText(text);
       }
 
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  public void onClick(View view)
+    {
+    Button tmp = (Button)view;
+    int id = tmp.getId();
+    OlimpicSurfaceView sView = (OlimpicSurfaceView) this.findViewById(R.id.olimpicSurfaceView);
+
+    switch(id)
+      {
+      case R.id.olimpicCheckBoxBlue0  : sView.getRenderer().pressed(0,0); break;
+      case R.id.olimpicCheckBoxBlue1  : sView.getRenderer().pressed(0,1); break;
+      case R.id.olimpicCheckBoxBlue2  : sView.getRenderer().pressed(0,2); break;
+      case R.id.olimpicCheckBoxBlue3  : sView.getRenderer().pressed(0,3); break;
+      case R.id.olimpicCheckBoxBlue4  : sView.getRenderer().pressed(0,4); break;
+      case R.id.olimpicCheckBoxBlue5  : sView.getRenderer().pressed(0,5); break;
+      case R.id.olimpicCheckBoxBlue6  : sView.getRenderer().pressed(0,6); break;
+      case R.id.olimpicCheckBoxBlue7  : sView.getRenderer().pressed(0,7); break;
+      case R.id.olimpicCheckBoxBlue8  : sView.getRenderer().pressed(0,8); break;
+
+      case R.id.olimpicCheckBoxBlack0 : sView.getRenderer().pressed(1,0); break;
+      case R.id.olimpicCheckBoxBlack1 : sView.getRenderer().pressed(1,1); break;
+      case R.id.olimpicCheckBoxBlack2 : sView.getRenderer().pressed(1,2); break;
+      case R.id.olimpicCheckBoxBlack3 : sView.getRenderer().pressed(1,3); break;
+      case R.id.olimpicCheckBoxBlack4 : sView.getRenderer().pressed(1,4); break;
+      case R.id.olimpicCheckBoxBlack5 : sView.getRenderer().pressed(1,5); break;
+      case R.id.olimpicCheckBoxBlack6 : sView.getRenderer().pressed(1,6); break;
+      case R.id.olimpicCheckBoxBlack7 : sView.getRenderer().pressed(1,7); break;
+      case R.id.olimpicCheckBoxBlack8 : sView.getRenderer().pressed(1,8); break;
+
+      case R.id.olimpicCheckBoxRed0   : sView.getRenderer().pressed(2,0); break;
+      case R.id.olimpicCheckBoxRed1   : sView.getRenderer().pressed(2,1); break;
+      case R.id.olimpicCheckBoxRed2   : sView.getRenderer().pressed(2,2); break;
+      case R.id.olimpicCheckBoxRed3   : sView.getRenderer().pressed(2,3); break;
+      case R.id.olimpicCheckBoxRed4   : sView.getRenderer().pressed(2,4); break;
+      case R.id.olimpicCheckBoxRed5   : sView.getRenderer().pressed(2,5); break;
+      case R.id.olimpicCheckBoxRed6   : sView.getRenderer().pressed(2,6); break;
+      case R.id.olimpicCheckBoxRed7   : sView.getRenderer().pressed(2,7); break;
+      case R.id.olimpicCheckBoxRed8   : sView.getRenderer().pressed(2,8); break;
+
+      case R.id.olimpicCheckBoxYellow0: sView.getRenderer().pressed(3,0); break;
+      case R.id.olimpicCheckBoxYellow1: sView.getRenderer().pressed(3,1); break;
+      case R.id.olimpicCheckBoxYellow2: sView.getRenderer().pressed(3,2); break;
+      case R.id.olimpicCheckBoxYellow3: sView.getRenderer().pressed(3,3); break;
+      case R.id.olimpicCheckBoxYellow4: sView.getRenderer().pressed(3,4); break;
+      case R.id.olimpicCheckBoxYellow5: sView.getRenderer().pressed(3,5); break;
+      case R.id.olimpicCheckBoxYellow6: sView.getRenderer().pressed(3,6); break;
+      case R.id.olimpicCheckBoxYellow7: sView.getRenderer().pressed(3,7); break;
+      case R.id.olimpicCheckBoxYellow8: sView.getRenderer().pressed(3,8); break;
+
+      case R.id.olimpicCheckBoxGreen0 : sView.getRenderer().pressed(4,0); break;
+      case R.id.olimpicCheckBoxGreen1 : sView.getRenderer().pressed(4,1); break;
+      case R.id.olimpicCheckBoxGreen2 : sView.getRenderer().pressed(4,2); break;
+      case R.id.olimpicCheckBoxGreen3 : sView.getRenderer().pressed(4,3); break;
+      case R.id.olimpicCheckBoxGreen4 : sView.getRenderer().pressed(4,4); break;
+      case R.id.olimpicCheckBoxGreen5 : sView.getRenderer().pressed(4,5); break;
+      case R.id.olimpicCheckBoxGreen6 : sView.getRenderer().pressed(4,6); break;
+      case R.id.olimpicCheckBoxGreen7 : sView.getRenderer().pressed(4,7); break;
+      case R.id.olimpicCheckBoxGreen8 : sView.getRenderer().pressed(4,8); break;
+      }
+    }
+
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
     @Override
diff --git a/src/main/java/org/distorted/examples/olimpic/OlimpicRenderer.java b/src/main/java/org/distorted/examples/olimpic/OlimpicRenderer.java
index 34942d7..4b9effd 100644
--- a/src/main/java/org/distorted/examples/olimpic/OlimpicRenderer.java
+++ b/src/main/java/org/distorted/examples/olimpic/OlimpicRenderer.java
@@ -59,6 +59,13 @@ class OlimpicRenderer implements GLSurfaceView.Renderer
    private int mScreenW, mScreenH;
    private int mPrevRendered, mCurrRendered;
 
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+   void pressed(int color, int number)
+     {
+     android.util.Log.d("Olimpic","Color: "+color+" number:"+number+" pressed!");
+     }
+
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
    OlimpicRenderer(GLSurfaceView v)
diff --git a/src/main/java/org/distorted/examples/olimpic/OlimpicSurfaceView.java b/src/main/java/org/distorted/examples/olimpic/OlimpicSurfaceView.java
index 8b56aab..c6acbad 100644
--- a/src/main/java/org/distorted/examples/olimpic/OlimpicSurfaceView.java
+++ b/src/main/java/org/distorted/examples/olimpic/OlimpicSurfaceView.java
@@ -29,6 +29,8 @@ import android.util.AttributeSet;
 
 class OlimpicSurfaceView extends GLSurfaceView 
 {
+    private OlimpicRenderer mRenderer;
+
 ///////////////////////////////////////////////////////////////////////////////////////////////////
    
     public OlimpicSurfaceView(Context context, AttributeSet attrs)
@@ -41,8 +43,17 @@ class OlimpicSurfaceView extends GLSurfaceView
         final ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo();
         android.util.Log.e("View", "Using OpenGL ES "+configurationInfo.getGlEsVersion());
         setEGLContextClientVersion( (configurationInfo.reqGlEsVersion>>16) >= 3 ? 3:2 );
-        setRenderer(new OlimpicRenderer(this));
+
+        mRenderer = new OlimpicRenderer(this);
+        setRenderer(mRenderer);
         }
       }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+    OlimpicRenderer getRenderer()
+      {
+      return mRenderer;
+      }
 }
 
diff --git a/src/main/res/layout/olimpiclayout.xml b/src/main/res/layout/olimpiclayout.xml
index 611eab6..279f69a 100644
--- a/src/main/res/layout/olimpiclayout.xml
+++ b/src/main/res/layout/olimpiclayout.xml
@@ -25,6 +25,361 @@
                 android:gravity="center_vertical|center"
                 android:textAppearance="?android:attr/textAppearanceMedium" />
 
+        <LinearLayout
+            android:orientation="horizontal"
+            android:layout_width="match_parent"
+            android:layout_height="0dp"
+            android:layout_weight="0.5">
+
+            <CheckBox
+                android:layout_width="wrap_content"
+                android:layout_height="match_parent"
+                android:id="@+id/olimpicCheckBoxBlue0"
+                android:layout_weight="2"
+                android:onClick="onClick"
+                android:checked="true"/>
+            <CheckBox
+                android:layout_width="wrap_content"
+                android:layout_height="match_parent"
+                android:id="@+id/olimpicCheckBoxBlue1"
+                android:layout_weight="1"
+                android:onClick="onClick"
+                android:checked="true"/>
+            <CheckBox
+                android:layout_width="wrap_content"
+                android:layout_height="match_parent"
+                android:id="@+id/olimpicCheckBoxBlue2"
+                android:layout_weight="1"
+                android:onClick="onClick"
+                android:checked="true"/>
+            <CheckBox
+                android:layout_width="wrap_content"
+                android:layout_height="match_parent"
+                android:id="@+id/olimpicCheckBoxBlue3"
+                android:layout_weight="1"
+                android:onClick="onClick"
+                android:checked="true"/>
+             <CheckBox
+                 android:layout_width="wrap_content"
+                 android:layout_height="match_parent"
+                 android:id="@+id/olimpicCheckBoxBlue4"
+                 android:layout_weight="1"
+                 android:onClick="onClick"
+                 android:checked="true"/>
+             <CheckBox
+                 android:layout_width="wrap_content"
+                 android:layout_height="match_parent"
+                 android:id="@+id/olimpicCheckBoxBlue5"
+                 android:layout_weight="1"
+                 android:onClick="onClick"
+                 android:checked="true"/>
+             <CheckBox
+                 android:layout_width="wrap_content"
+                 android:layout_height="match_parent"
+                 android:id="@+id/olimpicCheckBoxBlue6"
+                 android:layout_weight="1"
+                 android:onClick="onClick"
+                 android:checked="true"/>
+             <CheckBox
+                 android:layout_width="wrap_content"
+                 android:layout_height="match_parent"
+                 android:id="@+id/olimpicCheckBoxBlue7"
+                 android:layout_weight="1"
+                 android:onClick="onClick"
+                 android:checked="true"/>
+             <CheckBox
+                 android:layout_width="wrap_content"
+                 android:layout_height="match_parent"
+                 android:id="@+id/olimpicCheckBoxBlue8"
+                 android:layout_weight="1"
+                 android:onClick="onClick"
+                 android:checked="true"/>
+        </LinearLayout>
+
+        <LinearLayout
+            android:orientation="horizontal"
+            android:layout_width="match_parent"
+            android:layout_height="0dp"
+            android:layout_weight="0.5">
+
+            <CheckBox
+                android:layout_width="wrap_content"
+                android:layout_height="match_parent"
+                android:id="@+id/olimpicCheckBoxBlack0"
+                android:layout_weight="2"
+                android:onClick="onClick"
+                android:checked="true"/>
+            <CheckBox
+                android:layout_width="wrap_content"
+                android:layout_height="match_parent"
+                android:id="@+id/olimpicCheckBoxBlack1"
+                android:layout_weight="1"
+                android:onClick="onClick"
+                android:checked="true"/>
+            <CheckBox
+                android:layout_width="wrap_content"
+                android:layout_height="match_parent"
+                android:id="@+id/olimpicCheckBoxBlack2"
+                android:layout_weight="1"
+                android:onClick="onClick"
+                android:checked="true"/>
+            <CheckBox
+                android:layout_width="wrap_content"
+                android:layout_height="match_parent"
+                android:id="@+id/olimpicCheckBoxBlack3"
+                android:layout_weight="1"
+                android:onClick="onClick"
+                android:checked="true"/>
+             <CheckBox
+                 android:layout_width="wrap_content"
+                 android:layout_height="match_parent"
+                 android:id="@+id/olimpicCheckBoxBlack4"
+                 android:layout_weight="1"
+                 android:onClick="onClick"
+                 android:checked="true"/>
+             <CheckBox
+                 android:layout_width="wrap_content"
+                 android:layout_height="match_parent"
+                 android:id="@+id/olimpicCheckBoxBlack5"
+                 android:layout_weight="1"
+                 android:onClick="onClick"
+                 android:checked="true"/>
+             <CheckBox
+                 android:layout_width="wrap_content"
+                 android:layout_height="match_parent"
+                 android:id="@+id/olimpicCheckBoxBlack6"
+                 android:layout_weight="1"
+                 android:onClick="onClick"
+                 android:checked="true"/>
+             <CheckBox
+                 android:layout_width="wrap_content"
+                 android:layout_height="match_parent"
+                 android:id="@+id/olimpicCheckBoxBlack7"
+                 android:layout_weight="1"
+                 android:onClick="onClick"
+                 android:checked="true"/>
+             <CheckBox
+                 android:layout_width="wrap_content"
+                 android:layout_height="match_parent"
+                 android:id="@+id/olimpicCheckBoxBlack8"
+                 android:layout_weight="1"
+                 android:onClick="onClick"
+                 android:checked="true"/>
+        </LinearLayout>
+
+        <LinearLayout
+            android:orientation="horizontal"
+            android:layout_width="match_parent"
+            android:layout_height="0dp"
+            android:layout_weight="0.5">
+
+            <CheckBox
+                android:layout_width="wrap_content"
+                android:layout_height="match_parent"
+                android:id="@+id/olimpicCheckBoxRed0"
+                android:layout_weight="2"
+                android:onClick="onClick"
+                android:checked="true"/>
+            <CheckBox
+                android:layout_width="wrap_content"
+                android:layout_height="match_parent"
+                android:id="@+id/olimpicCheckBoxRed1"
+                android:layout_weight="1"
+                android:onClick="onClick"
+                android:checked="true"/>
+            <CheckBox
+                android:layout_width="wrap_content"
+                android:layout_height="match_parent"
+                android:id="@+id/olimpicCheckBoxRed2"
+                android:layout_weight="1"
+                android:onClick="onClick"
+                android:checked="true"/>
+            <CheckBox
+                android:layout_width="wrap_content"
+                android:layout_height="match_parent"
+                android:id="@+id/olimpicCheckBoxRed3"
+                android:layout_weight="1"
+                android:onClick="onClick"
+                android:checked="true"/>
+             <CheckBox
+                 android:layout_width="wrap_content"
+                 android:layout_height="match_parent"
+                 android:id="@+id/olimpicCheckBoxRed4"
+                 android:layout_weight="1"
+                 android:onClick="onClick"
+                 android:checked="true"/>
+             <CheckBox
+                 android:layout_width="wrap_content"
+                 android:layout_height="match_parent"
+                 android:id="@+id/olimpicCheckBoxRed5"
+                 android:layout_weight="1"
+                 android:onClick="onClick"
+                 android:checked="true"/>
+             <CheckBox
+                 android:layout_width="wrap_content"
+                 android:layout_height="match_parent"
+                 android:id="@+id/olimpicCheckBoxRed6"
+                 android:layout_weight="1"
+                 android:onClick="onClick"
+                 android:checked="true"/>
+             <CheckBox
+                 android:layout_width="wrap_content"
+                 android:layout_height="match_parent"
+                 android:id="@+id/olimpicCheckBoxRed7"
+                 android:layout_weight="1"
+                 android:onClick="onClick"
+                 android:checked="true"/>
+             <CheckBox
+                 android:layout_width="wrap_content"
+                 android:layout_height="match_parent"
+                 android:id="@+id/olimpicCheckBoxRed8"
+                 android:layout_weight="1"
+                 android:onClick="onClick"
+                 android:checked="true"/>
+        </LinearLayout>
+
+        <LinearLayout
+            android:orientation="horizontal"
+            android:layout_width="match_parent"
+            android:layout_height="0dp"
+            android:layout_weight="0.5">
+
+            <CheckBox
+                android:layout_width="wrap_content"
+                android:layout_height="match_parent"
+                android:id="@+id/olimpicCheckBoxYellow0"
+                android:layout_weight="2"
+                android:onClick="onClick"
+                android:checked="true"/>
+            <CheckBox
+                android:layout_width="wrap_content"
+                android:layout_height="match_parent"
+                android:id="@+id/olimpicCheckBoxYellow1"
+                android:layout_weight="1"
+                android:onClick="onClick"
+                android:checked="true"/>
+            <CheckBox
+                android:layout_width="wrap_content"
+                android:layout_height="match_parent"
+                android:id="@+id/olimpicCheckBoxYellow2"
+                android:layout_weight="1"
+                android:onClick="onClick"
+                android:checked="true"/>
+            <CheckBox
+                android:layout_width="wrap_content"
+                android:layout_height="match_parent"
+                android:id="@+id/olimpicCheckBoxYellow3"
+                android:layout_weight="1"
+                android:onClick="onClick"
+                android:checked="true"/>
+             <CheckBox
+                 android:layout_width="wrap_content"
+                 android:layout_height="match_parent"
+                 android:id="@+id/olimpicCheckBoxYellow4"
+                 android:layout_weight="1"
+                 android:onClick="onClick"
+                 android:checked="true"/>
+             <CheckBox
+                 android:layout_width="wrap_content"
+                 android:layout_height="match_parent"
+                 android:id="@+id/olimpicCheckBoxYellow5"
+                 android:layout_weight="1"
+                 android:onClick="onClick"
+                 android:checked="true"/>
+             <CheckBox
+                 android:layout_width="wrap_content"
+                 android:layout_height="match_parent"
+                 android:id="@+id/olimpicCheckBoxYellow6"
+                 android:layout_weight="1"
+                 android:onClick="onClick"
+                 android:checked="true"/>
+             <CheckBox
+                 android:layout_width="wrap_content"
+                 android:layout_height="match_parent"
+                 android:id="@+id/olimpicCheckBoxYellow7"
+                 android:layout_weight="1"
+                 android:onClick="onClick"
+                 android:checked="true"/>
+             <CheckBox
+                 android:layout_width="wrap_content"
+                 android:layout_height="match_parent"
+                 android:id="@+id/olimpicCheckBoxYellow8"
+                 android:layout_weight="1"
+                 android:onClick="onClick"
+                 android:checked="true"/>
+        </LinearLayout>
+
+        <LinearLayout
+            android:orientation="horizontal"
+            android:layout_width="match_parent"
+            android:layout_height="0dp"
+            android:layout_weight="0.5">
+
+            <CheckBox
+                android:layout_width="wrap_content"
+                android:layout_height="match_parent"
+                android:id="@+id/olimpicCheckBoxGreen0"
+                android:layout_weight="2"
+                android:onClick="onClick"
+                android:checked="true"/>
+            <CheckBox
+                android:layout_width="wrap_content"
+                android:layout_height="match_parent"
+                android:id="@+id/olimpicCheckBoxGreen1"
+                android:layout_weight="1"
+                android:onClick="onClick"
+                android:checked="true"/>
+            <CheckBox
+                android:layout_width="wrap_content"
+                android:layout_height="match_parent"
+                android:id="@+id/olimpicCheckBoxGreen2"
+                android:layout_weight="1"
+                android:onClick="onClick"
+                android:checked="true"/>
+            <CheckBox
+                android:layout_width="wrap_content"
+                android:layout_height="match_parent"
+                android:id="@+id/olimpicCheckBoxGreen3"
+                android:layout_weight="1"
+                android:onClick="onClick"
+                android:checked="true"/>
+             <CheckBox
+                 android:layout_width="wrap_content"
+                 android:layout_height="match_parent"
+                 android:id="@+id/olimpicCheckBoxGreen4"
+                 android:layout_weight="1"
+                 android:onClick="onClick"
+                 android:checked="true"/>
+             <CheckBox
+                 android:layout_width="wrap_content"
+                 android:layout_height="match_parent"
+                 android:id="@+id/olimpicCheckBoxGreen5"
+                 android:layout_weight="1"
+                 android:onClick="onClick"
+                 android:checked="true"/>
+             <CheckBox
+                 android:layout_width="wrap_content"
+                 android:layout_height="match_parent"
+                 android:id="@+id/olimpicCheckBoxGreen6"
+                 android:layout_weight="1"
+                 android:onClick="onClick"
+                 android:checked="true"/>
+             <CheckBox
+                 android:layout_width="wrap_content"
+                 android:layout_height="match_parent"
+                 android:id="@+id/olimpicCheckBoxGreen7"
+                 android:layout_weight="1"
+                 android:onClick="onClick"
+                 android:checked="true"/>
+             <CheckBox
+                 android:layout_width="wrap_content"
+                 android:layout_height="match_parent"
+                 android:id="@+id/olimpicCheckBoxGreen8"
+                 android:layout_weight="1"
+                 android:onClick="onClick"
+                 android:checked="true"/>
+        </LinearLayout>
+
     </LinearLayout>
 
 </LinearLayout>
