omap3-sgx-modules: strip unneeded stuff
[openembedded.git] / recipes / numptyphysics / numptyphysics / replay_off.patch
1 --- old_Game.cpp        2008-10-30 15:46:15.000000000 +0200
2 +++ Game.cpp    2008-10-30 15:49:14.000000000 +0200
3 @@ -1197,100 +1197,9 @@
4    }
5  };
6  
7 -class DemoRecorder
8 -{
9 -public:
10 -
11 -  void start() 
12 -  {
13 -    m_running = true;
14 -    m_log.empty();
15 -    m_log.capacity(512);
16 -    m_lastTick = 0;
17 -    m_lastTickTime = SDL_GetTicks();
18 -  }
19  
20 -  void stop()  
21 -  { 
22 -    printf("stop recording: %d events\n",m_log.size());
23 -    m_running = false; 
24 -  }
25  
26 -  void tick() 
27 -  {
28 -    if ( m_running ) {
29 -      m_lastTick++;
30 -      m_lastTickTime = SDL_GetTicks();
31 -    }
32 -  }
33  
34 -  void record( SDL_Event& ev )
35 -  {
36 -    if ( m_running ) {
37 -      m_log.append( m_lastTick, SDL_GetTicks()-m_lastTickTime, ev );
38 -    }
39 -  }
40 -  
41 -  DemoLog& getLog() { return m_log; }
42 -
43 -private:
44 -  bool          m_running;
45 -  DemoLog       m_log;
46 -  int          m_lastTick;
47 -  int          m_lastTickTime;
48 -};
49 -
50 -
51 -class DemoPlayer
52 -{
53 -public:
54 -
55 -  void start( const DemoLog* log ) 
56 -  {
57 -    m_playing = true;
58 -    m_log = log;
59 -    m_index = 0;
60 -    m_lastTick = 0;
61 -    m_lastTickTime = SDL_GetTicks();
62 -    printf("start playback: %d events\n",m_log->size());
63 -  }
64 -
65 -  bool isRunning() { return m_playing; }
66 -
67 -  void stop()  
68 -  { 
69 -    m_playing = false; 
70 -    m_log = NULL;
71 -  }
72 -
73 -  void tick() 
74 -  {
75 -    if ( m_playing ) {
76 -      m_lastTick++;
77 -      m_lastTickTime = SDL_GetTicks();
78 -    }
79 -  }
80 -
81 -  bool fetchEvent( SDL_Event& ev )
82 -  {
83 -    if ( m_playing
84 -        && m_index < m_log->size()
85 -        && m_log->at(m_index).t <= m_lastTick
86 -        && m_log->at(m_index).o <= SDL_GetTicks()-m_lastTickTime ) {
87 -      ev = m_log->at(m_index).e;
88 -      m_index++;
89 -      return true;
90 -    }
91 -    return false;
92 -  }
93 -  
94 -private:
95 -  bool           m_playing;
96 -  const DemoLog* m_log;
97 -  int            m_index;
98 -  int                   m_lastTick;
99 -  int                   m_lastTickTime;
100 -};
101  
102  
103  class Game : public GameParams
104 @@ -1303,8 +1212,6 @@
105    IconOverlay       m_pauseOverlay;
106    EditOverlay       m_editOverlay;
107    //  DemoOverlay       m_demoOverlay;
108 -  DemoRecorder      m_recorder;
109 -  DemoPlayer        m_player;
110    Os               *m_os;
111  public:
112    Game( int width, int height ) 
113 @@ -1328,15 +1235,11 @@
114        if ( m_edit ) {
115         m_scene.protect(0);
116        }
117 -      m_recorder.stop();
118 -      m_player.stop();
119        if ( replay ) {
120         // for ( int i=0; i<m_recorder.getLog().size(); i++ ) {
121  //       printf("DEMO: %s\n",m_recorder.getLog().asString(i).c_str());
122  //     }
123 -       m_player.start( &m_recorder.getLog() );
124        } else {
125 -       m_recorder.start();
126        }
127        return true;
128      }
129 @@ -1659,26 +1562,23 @@
130        while ( iterateCounter < ITERATION_RATE ) {
131         if ( !isPaused() ) {
132           m_scene.step();
133 -         m_recorder.tick();
134 -         m_player.tick();
135         }
136  
137         SDL_Event ev;
138         bool more = true;
139         while ( more ) {
140           more = SDL_PollEvent(&ev);
141 -         if ( m_player.isRunning() 
142 +         if ( 0 
143                && ( ev.type==SDL_MOUSEMOTION || 
144                     ev.type==SDL_MOUSEBUTTONDOWN || 
145                     ev.type==SDL_MOUSEBUTTONUP ) ) {
146             more = false; //discard
147           }
148           if (!more) {
149 -           more = m_player.fetchEvent(ev);
150 +           more = 0;
151           }
152           if ( more ) {
153             bool handled = false;
154 -           m_recorder.record( ev );
155             for ( int i=m_overlays.size()-1; i>=0 && !handled; i-- ) {
156               handled = m_overlays[i]->handleEvent(ev);
157             }
158 @@ -1703,8 +1603,6 @@
159        if ( m_scene.isCompleted() != isComplete && !m_edit ) {
160         isComplete = m_scene.isCompleted();
161         if ( isComplete ) {
162 -         m_player.stop();
163 -         m_recorder.stop();
164           showOverlay( completedOverlay );
165         } else {
166           hideOverlay( completedOverlay );