MCPcopy Create free account
hub / github.com/clementgallet/libTAS / processEvent

Method processEvent

src/program/GameEvents.cpp:45–361  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

43}
44
45bool GameEvents::processEvent(GameEvents::EventType type, const HotKey &hk)
46{
47 switch (type) {
48
49 case EVENT_TYPE_FOCUS_OUT:
50 ar_ticks = -1; // Deactivate auto-repeat
51 return false;
52
53 case EVENT_TYPE_EXPOSE:
54 /* Send an expose message to the game so that he can redrawn the screen */
55 if (!context->config.sc.running)
56 sendMessage(MSGN_EXPOSE);
57 return false;
58
59 case EVENT_TYPE_PRESS:
60
61 switch(hk.type) {
62
63 case HOTKEY_FRAMEADVANCE:
64 /* Advance a frame */
65 if (context->config.sc.running) {
66 context->config.sc.running = false;
67
68 /* Disable seeking */
69 if (context->seek_frame) {
70 context->seek_frame = 0;
71
72 /* Disable fast-forward */
73 context->config.sc.fastforward = false;
74 }
75
76 emit sharedConfigChanged();
77 context->config.sc_modified = true;
78 }
79 ar_ticks = 0; // Activate auto-repeat
80 return true;
81
82 case HOTKEY_PLAYPAUSE:
83 /* Toggle between play and pause */
84 context->config.sc.running = !context->config.sc.running;
85
86 /* Disable seeking */
87 if (!context->config.sc.running && context->seek_frame) {
88 context->seek_frame = 0;
89
90 /* Disable fast-forward */
91 context->config.sc.fastforward = false;
92 }
93
94 emit sharedConfigChanged();
95 context->config.sc_modified = true;
96 return false;
97
98 case HOTKEY_FASTFORWARD:
99 /* Enable fastforward */
100 context->config.sc.fastforward = true;
101 emit sharedConfigChanged();
102 context->config.sc_modified = true;

Callers

nothing calls this directly

Calls 5

sendMessageFunction · 0.85
sendStringFunction · 0.85
getMethod · 0.80
loadSavestateMovieMethod · 0.80
nbFramesMethod · 0.80

Tested by

no test coverage detected