MCPcopy Create free account
hub / github.com/RavEngine/RavEngine / loop

Function loop

deps/SDL2/test/testgesture.c:171–267  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

169}
170
171static void
172loop(void)
173{
174 SDL_Event event;
175 SDL_RWops *stream;
176 int i;
177
178 while (SDL_PollEvent(&event)) {
179 SDLTest_CommonEvent(state, &event, &quitting);
180
181 /* Record _all_ events */
182 events[eventWrite & (EVENT_BUF_SIZE-1)] = event;
183 eventWrite++;
184
185 switch (event.type) {
186 case SDL_KEYDOWN:
187 switch (event.key.keysym.sym) {
188 case SDLK_i: {
189 for (i = 0; i < SDL_GetNumTouchDevices(); ++i) {
190 const SDL_TouchID id = SDL_GetTouchDevice(i);
191 SDL_Log("Fingers Down on device %"SDL_PRIs64": %d", id, SDL_GetNumTouchFingers(id));
192 }
193 break;
194 }
195
196 case SDLK_SPACE:
197 SDL_RecordGesture(-1);
198 break;
199
200 case SDLK_s:
201 stream = SDL_RWFromFile("gestureSave", "w");
202 SDL_Log("Wrote %i templates", SDL_SaveAllDollarTemplates(stream));
203 SDL_RWclose(stream);
204 break;
205
206 case SDLK_l:
207 stream = SDL_RWFromFile("gestureSave", "r");
208 SDL_Log("Loaded: %i", SDL_LoadDollarTemplates(-1, stream));
209 SDL_RWclose(stream);
210 break;
211 }
212 break;
213
214#if VERBOSE
215 case SDL_FINGERMOTION:
216 SDL_Log("Finger: %"SDL_PRIs64",x: %f, y: %f",event.tfinger.fingerId,
217 event.tfinger.x,event.tfinger.y);
218 break;
219
220 case SDL_FINGERDOWN:
221 SDL_Log("Finger: %"SDL_PRIs64" down - x: %f, y: %f",
222 event.tfinger.fingerId,event.tfinger.x,event.tfinger.y);
223 break;
224
225 case SDL_FINGERUP:
226 SDL_Log("Finger: %"SDL_PRIs64" up - x: %f, y: %f",
227 event.tfinger.fingerId,event.tfinger.x,event.tfinger.y);
228 break;

Callers 1

mainFunction · 0.70

Calls 12

SDL_PollEventFunction · 0.85
SDLTest_CommonEventFunction · 0.85
SDL_GetNumTouchDevicesFunction · 0.85
SDL_GetTouchDeviceFunction · 0.85
SDL_LogFunction · 0.85
SDL_GetNumTouchFingersFunction · 0.85
SDL_RecordGestureFunction · 0.85
SDL_RWFromFileFunction · 0.85
SDL_RWcloseFunction · 0.85
SDL_LoadDollarTemplatesFunction · 0.85
DrawScreenFunction · 0.85

Tested by

no test coverage detected