Project

General

Profile

Download (5.62 KB) Statistics
| Branch: | Revision:

examples / src / main / java / org / distorted / examples / girl / GirlActivity.java @ c0f27889

1 bc0a685b Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
2
// Copyright 2016 Leszek Koltunski                                                               //
3
//                                                                                               //
4 71c8884f Leszek Koltunski
// This file is part of Distorted.                                                               //
5 bc0a685b Leszek Koltunski
//                                                                                               //
6 71c8884f Leszek Koltunski
// Distorted is free software: you can redistribute it and/or modify                             //
7 bc0a685b Leszek Koltunski
// 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 71c8884f Leszek Koltunski
// Distorted is distributed in the hope that it will be useful,                                  //
12 bc0a685b Leszek Koltunski
// 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 71c8884f Leszek Koltunski
// along with Distorted.  If not, see <http://www.gnu.org/licenses/>.                            //
18 bc0a685b Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
19 427ab7bf Leszek Koltunski
20 5068fa06 Leszek Koltunski
package org.distorted.examples.girl;
21 427ab7bf Leszek Koltunski
22 e3900503 Leszek Koltunski
import org.distorted.library.main.DistortedLibrary;
23 5068fa06 Leszek Koltunski
import org.distorted.examples.R;
24 427ab7bf Leszek Koltunski
25
import android.app.Activity;
26
import android.opengl.GLSurfaceView;
27
import android.os.Bundle;
28
import android.widget.SeekBar;
29
import android.widget.TextView;
30
import android.widget.SeekBar.OnSeekBarChangeListener;
31
32
///////////////////////////////////////////////////////////////////////////////////////////////////
33
34
public class GirlActivity extends Activity  implements OnSeekBarChangeListener
35
{
36
    private TextView textSwing, textSize, textHips;
37
   
38
///////////////////////////////////////////////////////////////////////////////////////////////////
39
    
40
    @Override
41
    protected void onCreate(Bundle icicle) 
42
      {
43
      super.onCreate(icicle);
44
      
45
      setContentView(R.layout.girllayout);
46
           
47 a4d59c0b Leszek Koltunski
      textSwing = findViewById(R.id.girlTextSwing);
48
      textSize  = findViewById(R.id.girlTextSize);
49
      textHips  = findViewById(R.id.girlTextHips);
50 427ab7bf Leszek Koltunski
51 a4d59c0b Leszek Koltunski
      SeekBar barSwing = findViewById(R.id.girlSeekSwing);
52
      SeekBar barSize  = findViewById(R.id.girlSeekSize);
53
      SeekBar barHips  = findViewById(R.id.girlSeekHips);
54 427ab7bf Leszek Koltunski
      
55
      barSwing.setOnSeekBarChangeListener(this); 
56
      barSize.setOnSeekBarChangeListener(this); 
57
      barHips.setOnSeekBarChangeListener(this); 
58
  
59
      barSwing.setProgress(0);
60
      barSize.setProgress(50);
61
      barHips.setProgress(0);
62 100e2da7 Leszek Koltunski
63 25eeb4d4 Leszek Koltunski
      textSwing.setText(getString(R.string.swing_placeholder,0.0f));
64 6f3024ae Leszek Koltunski
      textSize.setText(getString(R.string.size_placeholder,1.0f));
65 bf0d1908 Leszek Koltunski
      textHips.setText(getString(R.string.hips_placeholder,0));
66 427ab7bf Leszek Koltunski
      }
67
68
///////////////////////////////////////////////////////////////////////////////////////////////////
69
    
70
    @Override
71
    protected void onPause() 
72
      {
73 c0f27889 Leszek Koltunski
      super.onPause();
74 a4d59c0b Leszek Koltunski
      GLSurfaceView view = findViewById(R.id.girlSurfaceView);
75 abc3054d Leszek Koltunski
      view.onPause();
76 e3900503 Leszek Koltunski
      DistortedLibrary.onPause();
77 427ab7bf Leszek Koltunski
      }
78
79
///////////////////////////////////////////////////////////////////////////////////////////////////
80
    
81
    @Override
82
    protected void onResume() 
83
      {
84
      super.onResume();
85 a4d59c0b Leszek Koltunski
      GLSurfaceView view = findViewById(R.id.girlSurfaceView);
86 abc3054d Leszek Koltunski
      view.onResume();
87 427ab7bf Leszek Koltunski
      }
88
 
89
///////////////////////////////////////////////////////////////////////////////////////////////////
90
    
91
    @Override
92
    protected void onDestroy() 
93
      {
94 e3900503 Leszek Koltunski
      DistortedLibrary.onDestroy();
95 427ab7bf Leszek Koltunski
      super.onDestroy();
96
      }
97 25eeb4d4 Leszek Koltunski
98
///////////////////////////////////////////////////////////////////////////////////////////////////
99
100 427ab7bf Leszek Koltunski
    public void onProgressChanged(SeekBar bar, int progress, boolean fromUser) 
101
      {
102 25eeb4d4 Leszek Koltunski
      float v;
103
      int i;
104 a4d59c0b Leszek Koltunski
      GirlSurfaceView view = findViewById(R.id.girlSurfaceView);
105 abc3054d Leszek Koltunski
106 427ab7bf Leszek Koltunski
      switch (bar.getId()) 
107
        {
108 25eeb4d4 Leszek Koltunski
        case R.id.girlSeekSwing: v = progress/(5*400.0f);
109 abc3054d Leszek Koltunski
                                 view.getRenderer().setSwing(v);
110 6f3024ae Leszek Koltunski
                                 textSwing.setText(getString(R.string.swing_placeholder,v));
111 100e2da7 Leszek Koltunski
                                 break;
112 25eeb4d4 Leszek Koltunski
        case R.id.girlSeekSize : if( progress> 50) v = (progress-50)/18.0f + 1.0f;
113
                                 else              v = 0.015f*progress + 0.25f;
114
                                 view.getRenderer().setSize(v);
115
                                 textSize.setText(getString(R.string.size_placeholder,v));
116 100e2da7 Leszek Koltunski
                                 break;
117 25eeb4d4 Leszek Koltunski
        case R.id.girlSeekHips : i = progress/6;
118
                                 view.getRenderer().setHips(i);
119
                                 textHips.setText(getString(R.string.hips_placeholder,i));
120 100e2da7 Leszek Koltunski
                                 break;
121 427ab7bf Leszek Koltunski
        }
122
      }
123
124 25eeb4d4 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
125 427ab7bf Leszek Koltunski
126
    public void onStartTrackingTouch(SeekBar bar) { }
127 25eeb4d4 Leszek Koltunski
128
///////////////////////////////////////////////////////////////////////////////////////////////////
129 427ab7bf Leszek Koltunski
130
    public void onStopTrackingTouch(SeekBar bar)  { }
131
     
132
}