Project

General

Profile

« Previous | Next » 

Revision 2f9752c5

Added by Leszek Koltunski about 8 years ago

Tidy up 'FOV'

View differences:

src/main/java/org/distorted/examples/fov/FOVActivity.java
33 33

  
34 34
public class FOVActivity extends Activity implements OnSeekBarChangeListener
35 35
{
36
    private SeekBar barFOV;
37 36
    private TextView textFOV;
38 37
    
39 38
///////////////////////////////////////////////////////////////////////////////////////////////////
......
44 43
      super.onCreate(icicle);
45 44
      setContentView(R.layout.fovlayout);
46 45
       
47
      barFOV = (SeekBar)findViewById(R.id.seekFOV);
46
      SeekBar barFOV = (SeekBar)findViewById(R.id.seekFOV);
48 47
      barFOV.setOnSeekBarChangeListener(this); 
49 48
        
50 49
      textFOV = (TextView)findViewById(R.id.textFOV);
src/main/java/org/distorted/examples/fov/FOVRenderer.java
43 43
   
44 44
   private GLSurfaceView mView;
45 45
   private DistortedBitmap fov;
46
   private Paint mPaint;
47
    
46

  
48 47
///////////////////////////////////////////////////////////////////////////////////////////////////
49 48

  
50
   public FOVRenderer(GLSurfaceView view) 
49
   FOVRenderer(GLSurfaceView view)
51 50
      { 
52 51
      mView = view;
53 52
      }
54 53

  
55 54
///////////////////////////////////////////////////////////////////////////////////////////////////
56 55

  
57
   public static void setFOV(int fov)
56
   static void setFOV(int fov)
58 57
      {
59 58
      Distorted.setFov(fov);
60 59
      }
......
95 94

  
96 95
    private void setupBitmap(int w, int h)
97 96
      {
98
      mPaint = new Paint();
97
      Paint paint = new Paint();
99 98
      fov = new DistortedBitmap(w,h, 50);
100 99
      Bitmap fovBitmap = Bitmap.createBitmap(w,h, Bitmap.Config.ARGB_8888);
101 100
      Canvas fovCanvas = new Canvas(fovBitmap);    
102 101

  
103
      mPaint.setColor(0xff008800);
104
      mPaint.setStyle(Style.FILL);
105
      fovCanvas.drawRect(0, 0, w, h, mPaint);
106
      mPaint.setColor(0xffffffff);
102
      paint.setColor(0xff008800);
103
      paint.setStyle(Style.FILL);
104
      fovCanvas.drawRect(0, 0, w, h, paint);
105
      paint.setColor(0xffffffff);
107 106
      
108 107
      for(int i=0; i<=NUMLINES ; i++ )
109 108
        {
110
        fovCanvas.drawRect(w*i/NUMLINES - 1,                0,  w*i/NUMLINES + 1,  h               , mPaint);
111
        fovCanvas.drawRect(               0, h *i/NUMLINES -1,  w               ,  h*i/NUMLINES + 1, mPaint);  
109
        fovCanvas.drawRect(w*i/NUMLINES - 1,                0,  w*i/NUMLINES + 1,  h               , paint);
110
        fovCanvas.drawRect(               0, h *i/NUMLINES -1,  w               ,  h*i/NUMLINES + 1, paint);
112 111
        }
113 112
        
114 113
      fov.setBitmap(fovBitmap);
src/main/java/org/distorted/examples/fov/FOVSurfaceView.java
28 28

  
29 29
class FOVSurfaceView extends GLSurfaceView 
30 30
{
31
    private FOVRenderer renderer;
32
   
33 31
///////////////////////////////////////////////////////////////////////////////////////////////////
34 32
   
35 33
    public FOVSurfaceView(Context c, AttributeSet attrs) 
......
45 43
          setEGLConfigChooser(8, 8, 8, 8, 16, 0);   
46 44
          }
47 45
    
48
        renderer = new FOVRenderer(this);
46
        FOVRenderer renderer = new FOVRenderer(this);
49 47
        setRenderer(renderer);
50 48
        }
51 49
      }

Also available in: Unified diff