Project

General

Profile

« Previous | Next » 

Revision bc0a685b

Added by Leszek Koltunski almost 8 years ago

Add License

View differences:

src/main/java/org/distorted/examples/save/SaveActivity.java
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
///////////////////////////////////////////////////////////////////////////////////////////////////
1 19

  
2 20
package org.distorted.examples.save;
3 21

  
......
14 32
///////////////////////////////////////////////////////////////////////////////////////////////////
15 33

  
16 34
public class SaveActivity extends Activity implements SeekBar.OnSeekBarChangeListener
17
{
18
    private Button mSave;
19
    private SeekBar barSize;
35
  {
36
  private Button mSave;
37
  private SeekBar barSize;
20 38

  
21 39
///////////////////////////////////////////////////////////////////////////////////////////////////
22 40
    
23
    @Override
24
    protected void onCreate(Bundle icicle) 
25
      {
26
      super.onCreate(icicle);
27
      
28
      setContentView(R.layout.savelayout);
41
  @Override
42
  protected void onCreate(Bundle icicle) 
43
    {
44
    super.onCreate(icicle);
45
     
46
    setContentView(R.layout.savelayout);
29 47
           
30
      mSave = (Button)findViewById(R.id.saveButton);
48
    mSave = (Button)findViewById(R.id.saveButton);
31 49

  
32
      barSize  = (SeekBar)findViewById(R.id.saveSeekBar);
33
      barSize.setOnSeekBarChangeListener(this);
34
      barSize.setProgress(50);
35
      }
50
    barSize  = (SeekBar)findViewById(R.id.saveSeekBar);
51
    barSize.setOnSeekBarChangeListener(this);
52
    barSize.setProgress(50);
53
    }
36 54

  
37 55
///////////////////////////////////////////////////////////////////////////////////////////////////
38 56
    
39
    @Override
40
    protected void onPause() 
41
      {
42
      GLSurfaceView mView = (GLSurfaceView) this.findViewById(R.id.saveSurfaceView);
43
      mView.onPause();
57
  @Override
58
  protected void onPause() 
59
    {
60
    GLSurfaceView mView = (GLSurfaceView) this.findViewById(R.id.saveSurfaceView);
61
    mView.onPause();
44 62
      
45
      super.onPause();
46
      }
63
    super.onPause();
64
    }
47 65

  
48 66
///////////////////////////////////////////////////////////////////////////////////////////////////
49 67
    
50
    @Override
51
    protected void onResume() 
52
      {
53
      super.onResume();
68
  @Override
69
  protected void onResume() 
70
    {
71
    super.onResume();
54 72
      
55
      GLSurfaceView mView = (GLSurfaceView) this.findViewById(R.id.saveSurfaceView);
56
      mView.onResume();
57
      }
73
    GLSurfaceView mView = (GLSurfaceView) this.findViewById(R.id.saveSurfaceView);
74
    mView.onResume();
75
    }
58 76
 
59 77
///////////////////////////////////////////////////////////////////////////////////////////////////
60 78
    
61
    @Override
62
    protected void onDestroy() 
63
      {
64
      Distorted.onDestroy();  
65
      super.onDestroy();
66
      }
79
  @Override
80
  protected void onDestroy() 
81
    {
82
    Distorted.onDestroy();  
83
    super.onDestroy();
84
    }
67 85
   
68 86
///////////////////////////////////////////////////////////////////////////////////////////////////
69 87

  
70
    public void Save(View v)
71
      {
72
      SaveRenderer.Save();
73
      }
88
  public void Save(View v)
89
    {
90
    SaveRenderer.Save();
91
    }
74 92

  
75 93
///////////////////////////////////////////////////////////////////////////////////////////////////
76 94

  
77
    public void onProgressChanged(SeekBar bar, int progress, boolean fromUser)
78
      {
79
      float s = (progress>50 ? ((progress-50)/16.0f + 1.0f):(0.015f*progress + 0.25f));
80
      SaveRenderer.setSize(s);
81
      }
95
  public void onProgressChanged(SeekBar bar, int progress, boolean fromUser)
96
    {
97
    float s = (progress>50 ? ((progress-50)/16.0f + 1.0f):(0.015f*progress + 0.25f));
98
    SaveRenderer.setSize(s);
99
    }
82 100

  
83 101
///////////////////////////////////////////////////////////////////////////////////////////////////
84 102

  
85
    public void onStartTrackingTouch(SeekBar bar) { }
103
  public void onStartTrackingTouch(SeekBar bar) { }
86 104

  
87 105
///////////////////////////////////////////////////////////////////////////////////////////////////
88 106

  
89
    public void onStopTrackingTouch(SeekBar bar)  { }
107
  public void onStopTrackingTouch(SeekBar bar)  { }
90 108

  
91
}
109
  }

Also available in: Unified diff