comparison Samples/Sdl/SingleFrameViewer/SdlSimpleViewer.cpp @ 1407:9c5a8cb3d856

Fixed event loop in simple viewer
author Benjamin Golinvaux <bgo@osimis.io>
date Mon, 04 May 2020 13:17:11 +0200
parents 62dc0d737e7b
children 1e132fe7090e
comparison
equal deleted inserted replaced
1406:5d7ee14dc1eb 1407:9c5a8cb3d856
119 119
120 application->LoadOrthancFrame(source, instanceId, frameIndex); 120 application->LoadOrthancFrame(source, instanceId, frameIndex);
121 121
122 OrthancStone::DefaultViewportInteractor interactor; 122 OrthancStone::DefaultViewportInteractor interactor;
123 123
124 #if 1
125 OrthancStoneHelpers::SdlRunLoop(viewport, interactor);
126
127 #else
128
129 { 124 {
130 int scancodeCount = 0; 125 int scancodeCount = 0;
131 const uint8_t* keyboardState = SDL_GetKeyboardState(&scancodeCount); 126 const uint8_t* keyboardState = SDL_GetKeyboardState(&scancodeCount);
132 127
133 bool stop = false; 128 bool stop = false;
225 220
226 // Small delay to avoid using 100% of CPU 221 // Small delay to avoid using 100% of CPU
227 SDL_Delay(1); 222 SDL_Delay(1);
228 } 223 }
229 } 224 }
230 #endif
231 context.StopOracle(); 225 context.StopOracle();
232 } 226 }
233 } 227 }
234 228
235 OrthancStone::StoneFinalize(); 229 OrthancStone::StoneFinalize();