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.projection;
|
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 ProjectionActivity extends Activity implements OnSeekBarChangeListener
|
35
|
{
|
36
|
private TextView textF, textX, textY;
|
37
|
|
38
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
39
|
|
40
|
@Override
|
41
|
protected void onCreate(Bundle icicle)
|
42
|
{
|
43
|
super.onCreate(icicle);
|
44
|
setContentView(R.layout.projectionlayout);
|
45
|
|
46
|
textF = (TextView)findViewById(R.id.projectionTextFOV);
|
47
|
textX = (TextView)findViewById(R.id.projectionTextX);
|
48
|
textY = (TextView)findViewById(R.id.projectionTextY);
|
49
|
|
50
|
SeekBar bar;
|
51
|
|
52
|
bar = (SeekBar)findViewById(R.id.projectionSeekFOV);
|
53
|
bar.setOnSeekBarChangeListener(this);
|
54
|
bar.setProgress(50);
|
55
|
bar = (SeekBar)findViewById(R.id.projectionSeekX);
|
56
|
bar.setOnSeekBarChangeListener(this);
|
57
|
bar.setProgress(50);
|
58
|
bar = (SeekBar)findViewById(R.id.projectionSeekY);
|
59
|
bar.setOnSeekBarChangeListener(this);
|
60
|
bar.setProgress(50);
|
61
|
}
|
62
|
|
63
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
64
|
|
65
|
@Override
|
66
|
protected void onPause()
|
67
|
{
|
68
|
GLSurfaceView mView = (GLSurfaceView) this.findViewById(R.id.surfaceViewProjection);
|
69
|
mView.onPause();
|
70
|
|
71
|
super.onPause();
|
72
|
}
|
73
|
|
74
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
75
|
|
76
|
@Override
|
77
|
protected void onResume()
|
78
|
{
|
79
|
super.onResume();
|
80
|
|
81
|
GLSurfaceView mView = (GLSurfaceView) this.findViewById(R.id.surfaceViewProjection);
|
82
|
mView.onResume();
|
83
|
}
|
84
|
|
85
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
86
|
|
87
|
@Override
|
88
|
protected void onDestroy()
|
89
|
{
|
90
|
Distorted.onDestroy();
|
91
|
super.onDestroy();
|
92
|
}
|
93
|
|
94
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
95
|
|
96
|
public void onProgressChanged(SeekBar bar, int progress, boolean fromUser)
|
97
|
{
|
98
|
int ret;
|
99
|
|
100
|
switch (bar.getId())
|
101
|
{
|
102
|
case R.id.projectionSeekFOV: ret = ProjectionRenderer.setFOV(progress);
|
103
|
textF.setText("FOV: "+ret);
|
104
|
break;
|
105
|
case R.id.projectionSeekX : ret = ProjectionRenderer.setX(progress);
|
106
|
textX.setText("X: "+ret);
|
107
|
break;
|
108
|
case R.id.projectionSeekY : ret = ProjectionRenderer.setY(progress);
|
109
|
textY.setText("Y: "+ret);
|
110
|
break;
|
111
|
}
|
112
|
}
|
113
|
|
114
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
115
|
|
116
|
public void onStartTrackingTouch(SeekBar bar) { }
|
117
|
|
118
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
119
|
|
120
|
public void onStopTrackingTouch(SeekBar bar) { }
|
121
|
|
122
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
123
|
|
124
|
}
|