Blame view

build2/epsilon-master/ion/src/shared/events_replay.cpp 671 Bytes
6663b6c9   adorian   projet complet av...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
  #include <ion.h>
  
  /* Use this implementation of Ion::Events::getEvent to simulate pre-recorded key
   * presses. This implementation doesn't wait at all, which can be useful when
   * profiling code execution. */
  
  const int loopLength = 12;
  
  using namespace Ion::Events;
  
  const Event sequence[] = {
    Right,
    Right,
    Right,
    OK,
    Down, Down, Down, Down, Down, Down,
    Up, Up, Up, Up, Up, Up
  };
  
  Event Ion::Events::getEvent(int * timeout) {
    static int i = 0;
    int sequenceLength = sizeof(sequence)/sizeof(sequence[0]);
    if (i == sequenceLength) {
      i = sequenceLength - loopLength;
    }
    if (i > sequenceLength) {
      while (1) {
      }
    }
    return sequence[i++];
  }