Project

General

Profile

« Previous | Next » 

Revision 9a645457

Added by Leszek Koltunski almost 2 years ago

simplify the crash app.

View differences:

src/main/java/org/distorted/examples/flatblur2/FlatBlur2Activity.java
71 71

  
72 72
///////////////////////////////////////////////////////////////////////////////////////////////////
73 73

  
74
    public void button1(View view)
74
    public void crash(View view)
75 75
      {
76 76
      FlatBlur2SurfaceView v = findViewById(R.id.flatblur2SurfaceView);
77 77
      FlatBlur2Renderer renderer = v.getRenderer();
78
      renderer.button1();
79
      }
80

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

  
83
    public void button2(View view)
84
      {
85
      FlatBlur2SurfaceView v = findViewById(R.id.flatblur2SurfaceView);
86
      FlatBlur2Renderer renderer = v.getRenderer();
87
      renderer.button2();
78
      renderer.crash();
88 79
      }
89 80
}
src/main/java/org/distorted/examples/flatblur2/FlatBlur2Renderer.java
60 60
      {
61 61
      mView = v;
62 62
      mScreen = new DistortedScreen();
63

  
64
      DistortedTexture texture1 = new DistortedTexture();
65
      texture1.setColorARGB(0xffff0000);
66
      MeshQuad mesh1 = new MeshQuad();
67
      DistortedEffects effects1 = new DistortedEffects();
68
      VertexEffectScale mainScale= new VertexEffectScale(200);
69
      effects1.apply(mainScale);
70
      mNode1 = new DistortedNode(texture1,effects1,mesh1);
71
      mScreen.attach(mNode1);
72

  
73
      DistortedTexture texture2 = new DistortedTexture();
74
      texture2.setColorARGB(0xffff0000);
75
      MeshQuad mesh2 = new MeshQuad();
76
      DistortedEffects effects2 = new DistortedEffects();
77
      mNode2 = new DistortedNode(texture2,effects2,mesh2);
78
      mScreen.attach(mNode2);
63 79
      }
64 80

  
65 81
///////////////////////////////////////////////////////////////////////////////////////////////////
......
94 110

  
95 111
///////////////////////////////////////////////////////////////////////////////////////////////////
96 112

  
97
    public void button1()
98
      {
99
      DistortedTexture texture1 = new DistortedTexture();
100
      texture1.setColorARGB(0xffff0000);
101
      MeshQuad mesh1 = new MeshQuad();
102
      DistortedEffects effects1 = new DistortedEffects();
103
      VertexEffectScale mainScale= new VertexEffectScale(200);
104
      effects1.apply(mainScale);
105
      mNode1 = new DistortedNode(texture1,effects1,mesh1);
106
      mScreen.attach(mNode1);
107

  
108
      DistortedTexture texture2 = new DistortedTexture();
109
      texture2.setColorARGB(0xffff0000);
110
      MeshQuad mesh2 = new MeshQuad();
111
      DistortedEffects effects2 = new DistortedEffects();
112
      mNode2 = new DistortedNode(texture2,effects2,mesh2);
113
      mScreen.attach(mNode2);
114
      }
115

  
116
///////////////////////////////////////////////////////////////////////////////////////////////////
117

  
118
    public void button2()
113
    public void crash()
119 114
      {
120 115
      Dynamic2D haloRadius = new Dynamic2D(DUR_GLO,1.0f);
121 116
      haloRadius.add(new Static2D( 0, 0));
src/main/res/layout/flatblur2layout.xml
10 10
        android:layout_height="0dp"
11 11
        android:layout_weight="1" />
12 12

  
13
    <LinearLayout
14
        android:orientation="horizontal"
15
        android:layout_width="match_parent"
16
        android:layout_height="wrap_content"
17
        android:gravity="center">
18

  
19
        <Button
20
                android:id="@+id/flatblur2Button1"
21
                android:layout_width="0dp"
22
                android:layout_height="match_parent"
23
                android:layout_weight="1"
24
                android:onClick="button1"
25
                android:checked="false"/>
26 13
        <Button
27 14
                android:id="@+id/flatblur2Button2"
28
                android:layout_width="0dp"
29
                android:layout_height="match_parent"
30
                android:layout_weight="1"
31
                android:onClick="button2"
15
                android:text="CRASH"
16
                android:layout_width="match_parent"
17
                android:layout_height="100dp"
18
                android:onClick="crash"
32 19
                android:checked="false"/>
33 20

  
34
    </LinearLayout>
35

  
36 21
</LinearLayout>

Also available in: Unified diff