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

Function loop

deps/SDL2/test/teststreaming.c:94–124  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

92}
93
94void
95loop()
96{
97 SDL_Event event;
98
99 while (SDL_PollEvent(&event)) {
100 switch (event.type) {
101 case SDL_KEYDOWN:
102 if (event.key.keysym.sym == SDLK_ESCAPE) {
103 done = SDL_TRUE;
104 }
105 break;
106 case SDL_QUIT:
107 done = SDL_TRUE;
108 break;
109 }
110 }
111
112 frame = (frame + 1) % MOOSEFRAMES_COUNT;
113 UpdateTexture(MooseTexture, frame);
114
115 SDL_RenderClear(renderer);
116 SDL_RenderCopy(renderer, MooseTexture, NULL, NULL);
117 SDL_RenderPresent(renderer);
118
119#ifdef __EMSCRIPTEN__
120 if (done) {
121 emscripten_cancel_main_loop();
122 }
123#endif
124}
125
126int
127main(int argc, char **argv)

Callers 1

mainFunction · 0.70

Calls 5

SDL_PollEventFunction · 0.85
UpdateTextureFunction · 0.85
SDL_RenderClearFunction · 0.85
SDL_RenderCopyFunction · 0.85
SDL_RenderPresentFunction · 0.85

Tested by

no test coverage detected