Project

General

Profile

« Previous | Next » 

Revision 643844c9

Added by Leszek Koltunski about 7 years ago

Improve Around the World.

View differences:

src/main/java/org/distorted/examples/aroundtheworld/AroundTheWorldActivity.java
32 32
///////////////////////////////////////////////////////////////////////////////////////////////////
33 33
    
34 34
    @Override
35
    protected void onCreate(Bundle icicle) 
35
    protected void onCreate(Bundle savedState)
36 36
      {
37
      super.onCreate(icicle);
37
      super.onCreate(savedState);
38 38
      setContentView(R.layout.aroundtheworldlayout);
39 39

  
40 40
      AroundTheWorldSurfaceView       view = (AroundTheWorldSurfaceView)       this.findViewById(R.id.aroundTheWorldSurfaceView);
......
42 42
      AroundTheWorldEffectsManager    mana = view.getManager();
43 43
      AroundTheWorldRendererPicker    renp = pick.getRenderer();
44 44

  
45
      renp.move(0,0);
46
      mana.setRace(0.33f,0.33f);
45
      if( savedState==null )
46
        {
47
        renp.move(0, 0);
48
        mana.setRace(0.33f, 0.33f);
49
        }
47 50

  
48 51
      pick.setEffectsManager(mana);
49 52
      }
......
78 81
      Distorted.onDestroy();  
79 82
      super.onDestroy();
80 83
      }
84

  
85
///////////////////////////////////////////////////////////////////////////////////////////////////
86

  
87
    @Override
88
    public void onSaveInstanceState(Bundle savedInstanceState)
89
      {
90
      super.onSaveInstanceState(savedInstanceState);
91

  
92
      AroundTheWorldSurfaceViewPicker pick = (AroundTheWorldSurfaceViewPicker) this.findViewById(R.id.aroundTheWorldSurfaceViewPicker);
93

  
94
      savedInstanceState.putFloat("x", pick.getx() );
95
      savedInstanceState.putFloat("y", pick.gety() );
96
      }
97

  
98
///////////////////////////////////////////////////////////////////////////////////////////////////
99

  
100
    @Override
101
    public void onRestoreInstanceState(Bundle savedInstanceState)
102
      {
103
      super.onRestoreInstanceState(savedInstanceState);
104

  
105
      AroundTheWorldSurfaceViewPicker pick = (AroundTheWorldSurfaceViewPicker) this.findViewById(R.id.aroundTheWorldSurfaceViewPicker);
106

  
107
      float x = savedInstanceState.getFloat("x");
108
      float y = savedInstanceState.getFloat("y");
109

  
110
      pick.set(x,y);
111
      }
112

  
81 113
}

Also available in: Unified diff