Project

General

Profile

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

examples / src / main / java / org / distorted / examples / fov / FOVActivity.java @ 7bf107f7

1
///////////////////////////////////////////////////////////////////////////////////////////////////
2
// Copyright 2016 Leszek Koltunski                                                               //
3
//                                                                                               //
4
// This file is part of Distorted.                                                               //
5
//                                                                                               //
6
// Distorted is free software: you can redistribute it and/or modify                             //
7
// 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
// Distorted is distributed in the hope that it will be useful,                                  //
12
// 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
// along with Distorted.  If not, see <http://www.gnu.org/licenses/>.                            //
18
///////////////////////////////////////////////////////////////////////////////////////////////////
19

    
20
package org.distorted.examples.fov;
21

    
22
import org.distorted.library.Distorted;
23
import org.distorted.examples.R;
24

    
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 FOVActivity extends Activity implements OnSeekBarChangeListener
35
{
36
    private SeekBar barFOV;
37
    private TextView textFOV;
38
    
39
///////////////////////////////////////////////////////////////////////////////////////////////////
40
    
41
    @Override
42
    protected void onCreate(Bundle icicle) 
43
      {
44
      super.onCreate(icicle);
45
      setContentView(R.layout.fovlayout);
46
       
47
      barFOV = (SeekBar)findViewById(R.id.seekFOV);
48
      barFOV.setOnSeekBarChangeListener(this); 
49
        
50
      textFOV = (TextView)findViewById(R.id.textFOV);
51
     
52
      barFOV.setProgress(50);
53
      
54
      textFOV.setText("FOV: 50");
55
      }
56

    
57
///////////////////////////////////////////////////////////////////////////////////////////////////
58
    
59
    @Override
60
    protected void onPause() 
61
      {
62
      GLSurfaceView mView = (GLSurfaceView) this.findViewById(R.id.surfaceViewFOV);
63
      mView.onPause();
64
      
65
      super.onPause();
66
      }
67

    
68
///////////////////////////////////////////////////////////////////////////////////////////////////
69
    
70
    @Override
71
    protected void onResume() 
72
      {
73
      super.onResume();
74
      
75
      GLSurfaceView mView = (GLSurfaceView) this.findViewById(R.id.surfaceViewFOV);
76
      mView.onResume();    
77
      }
78
 
79
///////////////////////////////////////////////////////////////////////////////////////////////////
80
    
81
    @Override
82
    protected void onDestroy() 
83
      {
84
      Distorted.onDestroy();  
85
      super.onDestroy();
86
      }
87

    
88
///////////////////////////////////////////////////////////////////////////////////////////////////
89
    
90
    public void onProgressChanged(SeekBar bar, int progress, boolean fromUser) 
91
      {
92
      switch (bar.getId()) 
93
        {
94
        case R.id.seekFOV: FOVRenderer.setFOV(progress);
95
                           textFOV.setText("FOV: "+progress);
96
                           break;
97
        }
98
      }
99

    
100
///////////////////////////////////////////////////////////////////////////////////////////////////
101

    
102
    public void onStartTrackingTouch(SeekBar bar) { }
103
    
104
///////////////////////////////////////////////////////////////////////////////////////////////////
105

    
106
    public void onStopTrackingTouch(SeekBar bar)  { }
107

    
108
///////////////////////////////////////////////////////////////////////////////////////////////////
109
    
110
}
(1-1/3)