Project

General

Profile

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

examples / src / main / java / org / distorted / examples / girl / GirlActivity.java @ 25eeb4d4

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 a4d59c0b Leszek Koltunski
      GLSurfaceView view = findViewById(R.id.girlSurfaceView);
74 abc3054d Leszek Koltunski
      view.onPause();
75 b0ebdf5e Leszek Koltunski
76 e3900503 Leszek Koltunski
      DistortedLibrary.onPause();
77 427ab7bf Leszek Koltunski
      super.onPause();
78
      }
79
80
///////////////////////////////////////////////////////////////////////////////////////////////////
81
    
82
    @Override
83
    protected void onResume() 
84
      {
85
      super.onResume();
86
      
87 a4d59c0b Leszek Koltunski
      GLSurfaceView view = findViewById(R.id.girlSurfaceView);
88 abc3054d Leszek Koltunski
      view.onResume();
89 427ab7bf Leszek Koltunski
      }
90
 
91
///////////////////////////////////////////////////////////////////////////////////////////////////
92
    
93
    @Override
94
    protected void onDestroy() 
95
      {
96 e3900503 Leszek Koltunski
      DistortedLibrary.onDestroy();
97 427ab7bf Leszek Koltunski
      super.onDestroy();
98
      }
99 25eeb4d4 Leszek Koltunski
100
///////////////////////////////////////////////////////////////////////////////////////////////////
101
102 427ab7bf Leszek Koltunski
    public void onProgressChanged(SeekBar bar, int progress, boolean fromUser) 
103
      {
104 25eeb4d4 Leszek Koltunski
      float v;
105
      int i;
106 a4d59c0b Leszek Koltunski
      GirlSurfaceView view = findViewById(R.id.girlSurfaceView);
107 abc3054d Leszek Koltunski
108 427ab7bf Leszek Koltunski
      switch (bar.getId()) 
109
        {
110 25eeb4d4 Leszek Koltunski
        case R.id.girlSeekSwing: v = progress/(5*400.0f);
111 abc3054d Leszek Koltunski
                                 view.getRenderer().setSwing(v);
112 6f3024ae Leszek Koltunski
                                 textSwing.setText(getString(R.string.swing_placeholder,v));
113 100e2da7 Leszek Koltunski
                                 break;
114 25eeb4d4 Leszek Koltunski
        case R.id.girlSeekSize : if( progress> 50) v = (progress-50)/18.0f + 1.0f;
115
                                 else              v = 0.015f*progress + 0.25f;
116
                                 view.getRenderer().setSize(v);
117
                                 textSize.setText(getString(R.string.size_placeholder,v));
118 100e2da7 Leszek Koltunski
                                 break;
119 25eeb4d4 Leszek Koltunski
        case R.id.girlSeekHips : i = progress/6;
120
                                 view.getRenderer().setHips(i);
121
                                 textHips.setText(getString(R.string.hips_placeholder,i));
122 100e2da7 Leszek Koltunski
                                 break;
123 427ab7bf Leszek Koltunski
        }
124
      }
125
126 25eeb4d4 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
127 427ab7bf Leszek Koltunski
128
    public void onStartTrackingTouch(SeekBar bar) { }
129 25eeb4d4 Leszek Koltunski
130
///////////////////////////////////////////////////////////////////////////////////////////////////
131 427ab7bf Leszek Koltunski
132
    public void onStopTrackingTouch(SeekBar bar)  { }
133
     
134
}