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

Function loop

deps/SDL2/test/testcustomcursor.c:149–181  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

147}
148
149void
150loop()
151{
152 int i;
153 SDL_Event event;
154 /* Check for events */
155 while (SDL_PollEvent(&event)) {
156 SDLTest_CommonEvent(state, &event, &done);
157 if (event.type == SDL_MOUSEBUTTONDOWN) {
158 if (event.button.button == SDL_BUTTON_LEFT) {
159 ++current_cursor;
160 if (current_cursor == SDL_arraysize(cursors)) {
161 current_cursor = 0;
162 }
163 SDL_SetCursor(cursors[current_cursor]);
164 } else {
165 show_cursor = !show_cursor;
166 SDL_ShowCursor(show_cursor);
167 }
168 }
169 }
170
171 for (i = 0; i < state->num_windows; ++i) {
172 SDL_Renderer *renderer = state->renderers[i];
173 SDL_RenderClear(renderer);
174 SDL_RenderPresent(renderer);
175 }
176#ifdef __EMSCRIPTEN__
177 if (done) {
178 emscripten_cancel_main_loop();
179 }
180#endif
181}
182
183int
184main(int argc, char *argv[])

Callers 1

mainFunction · 0.70

Calls 6

SDL_PollEventFunction · 0.85
SDLTest_CommonEventFunction · 0.85
SDL_SetCursorFunction · 0.85
SDL_ShowCursorFunction · 0.85
SDL_RenderClearFunction · 0.85
SDL_RenderPresentFunction · 0.85

Tested by

no test coverage detected