Project

General

Profile

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

examples / src / main / java / org / distorted / examples / fov / FOVActivity.java @ 2f9752c5

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

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

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

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

    
99
///////////////////////////////////////////////////////////////////////////////////////////////////
100

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

    
105
    public void onStopTrackingTouch(SeekBar bar)  { }
106

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