Numworks Epsilon  1.4.1
Graphing Calculator Operating System
events_replay.cpp
Go to the documentation of this file.
1 #include <ion.h>
2 
3 /* Use this implementation of Ion::Events::getEvent to simulate pre-recorded key
4  * presses. This implementation doesn't wait at all, which can be useful when
5  * profiling code execution. */
6 
7 const int loopLength = 12;
8 
9 using namespace Ion::Events;
10 
11 const Event sequence[] = {
12  Right,
13  Right,
14  Right,
15  OK,
16  Down, Down, Down, Down, Down, Down,
17  Up, Up, Up, Up, Up, Up
18 };
19 
20 Event Ion::Events::getEvent(int * timeout) {
21  static int i = 0;
22  int sequenceLength = sizeof(sequence)/sizeof(sequence[0]);
23  if (i == sequenceLength) {
24  i = sequenceLength - loopLength;
25  }
26  if (i > sequenceLength) {
27  while (1) {
28  }
29  }
30  return sequence[i++];
31 }
Event getEvent(int *timeout)
Definition: events.cpp:12
const Event sequence[]
constexpr Event Up
Definition: events.h:62
constexpr Event Down
Definition: events.h:63
constexpr Event Right
Definition: events.h:64
constexpr Event OK
Definition: events.h:65
const int loopLength