Project

General

Profile

« Previous | Next » 

Revision f8eece7d

Added by Leszek Koltunski over 3 years ago

Attach the control nodes directly to the screen, not to the Object Node.

View differences:

src/main/java/org/distorted/control/RubikControl.java
20 20
package org.distorted.control;
21 21

  
22 22
import org.distorted.library.main.DistortedNode;
23
import org.distorted.library.main.DistortedScreen;
23 24
import org.distorted.library.message.EffectListener;
24 25
import org.distorted.main.RubikActivity;
25
import org.distorted.main.RubikPreRender;
26
import org.distorted.objects.TwistyObject;
27 26

  
28 27
import java.lang.ref.WeakReference;
29 28

  
......
39 38

  
40 39
///////////////////////////////////////////////////////////////////////////////////////////////////
41 40

  
42
  private TwistyObject getObject()
41
  private DistortedScreen getScreen()
43 42
    {
44 43
    RubikActivity act = mRefAct.get();
45

  
46
    if( act!=null )
47
      {
48
      RubikPreRender pre = act.getPreRender();
49
      return pre!=null ? pre.getObject() : null;
50
      }
51

  
52
    return null;
44
    return act!=null ? act.getScreen() : null;
53 45
    }
54 46

  
55 47
///////////////////////////////////////////////////////////////////////////////////////////////////
56 48

  
57 49
  private void addWholeObjects()
58 50
    {
59
    TwistyObject object = getObject();
51
    DistortedScreen screen = getScreen();
60 52
    DistortedNode[] nodes = mWhole.getNodes();
61 53

  
62
    if( object!=null && nodes!=null )
54
    if( screen!=null && nodes!=null )
63 55
      {
64
      for (DistortedNode node : nodes) object.attach(node);
56
      for (DistortedNode node : nodes) screen.attach(node);
65 57
      }
66 58
    }
67 59

  
......
69 61

  
70 62
  private void removeWholeObjects()
71 63
    {
72
    TwistyObject object = getObject();
64
    DistortedScreen screen = getScreen();
73 65
    DistortedNode[] nodes = mWhole.returnNodes();
74 66

  
75
    if( object!=null && nodes!=null )
67
    if( screen!=null && nodes!=null )
76 68
      {
77
      for (DistortedNode node : nodes) object.detach(node);
69
      for (DistortedNode node : nodes) screen.detach(node);
78 70
      }
79 71
    }
80 72

  
......
82 74

  
83 75
  private void addRotateObjects()
84 76
    {
85
    TwistyObject object = getObject();
77
    DistortedScreen screen = getScreen();
86 78
    DistortedNode[] nodes = mRotate.getNodes();
87 79

  
88
    if( object!=null && nodes!=null )
80
    if( screen!=null && nodes!=null )
89 81
      {
90
      for (DistortedNode node : nodes) object.attach(node);
82
      for (DistortedNode node : nodes) screen.attach(node);
91 83
      }
92 84
    }
93 85

  
......
95 87

  
96 88
  private void removeRotateObjects()
97 89
    {
98
    TwistyObject object = getObject();
90
    DistortedScreen screen = getScreen();
99 91
    DistortedNode[] nodes = mRotate.returnNodes();
100 92

  
101
    if( object!=null && nodes!=null )
93
    if( screen!=null && nodes!=null )
102 94
      {
103
      for (DistortedNode node : nodes) object.detach(node);
95
      for (DistortedNode node : nodes) screen.detach(node);
104 96
      }
105 97
    }
106 98

  
src/main/java/org/distorted/main/RubikActivity.java
41 41
import org.distorted.effects.BaseEffect;
42 42
import org.distorted.library.main.DistortedLibrary;
43 43

  
44
import org.distorted.library.main.DistortedScreen;
44 45
import org.distorted.objects.TwistyObject;
45 46
import org.distorted.network.RubikScores;
46 47
import org.distorted.network.RubikNetwork;
......
383 384
      return pre.getObject();
384 385
      }
385 386

  
387
///////////////////////////////////////////////////////////////////////////////////////////////////
388

  
389
    public DistortedScreen getScreen()
390
      {
391
      RubikSurfaceView view = findViewById(R.id.rubikSurfaceView);
392
      RubikRenderer renderer = view.getRenderer();
393
      return renderer.getScreen();
394
      }
395

  
386 396
///////////////////////////////////////////////////////////////////////////////////////////////////
387 397

  
388 398
    public int getScreenWidthInPixels()

Also available in: Unified diff