Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<pre><code> while(event.type != SDL_QUIT) { SDL_RenderClear(sdlRenderer); SDL_SetRenderDrawColor(sdlRenderer, 150, 0, 0, 255); SDL_RenderPresent(sdlRenderer); } </code></pre> <p>You are comparing a variable that doesn't change in your <code>while</code> loop. You need to update it in every iteration of loop using <code>SDL_PollEvent(&amp;event)</code> Something like this: </p> <pre><code>bool quit = false; SDL_Event event; // Loop while user hasn't quit while ( !quit ) { // Check all new event to see if a SDL_QUIT event has come in... while (SDL_PollEvent(&amp;event) ) { // SDL_QUIT event has come in, quit. if ( event.type == SDL_QUIT ) { quit = true; } } SDL_RenderClear(sdlRenderer); SDL_SetRenderDrawColor(sdlRenderer, 150, 0, 0, 255); SDL_RenderPresent(sdlRenderer); } </code></pre> <hr> <p>Also I don't think you need SDL2_main anymore. At least I don't use it in my code. Nor do you need <code>#include &lt;stdio.h&gt;</code> and <code>#include &lt;stdlib.h&gt;</code> in your specific example. </p> <hr> <p><strong>Tutorials</strong></p> <p>SDL2 is fairly new, so there aren't that much tutorials around. The only ones I know is <a href="http://twinklebeardev.blogspot.no/p/sdl-20-tutorial-index.html" rel="nofollow">TwinklebearDev</a>.But in most cases SDL1.3 and SDL2 are quite similar. So in most cases you can use SDL1.3 code with <code>SDL_Texture</code>, <code>SDL_Renderer</code> and <code>SDL_Window.</code>You can have a look <a href="http://wiki.libsdl.org/MigrationGuide" rel="nofollow">here</a> for more information on porting from 1.3 to 2.0. For SDL1.3 I have used <a href="http://www.lazyfoo.net/SDL_tutorials/" rel="nofollow">LazyFoo's</a> tutorials.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload