Re: have to use task manager to abort program
Clangray <[email protected]> Wed, 15 Mar 2017 12:44:21 -0400
| Newsgroups | gmane.comp.lib.sdl |
|---|---|
| Message-ID | <[email protected]> |
This is a multi-part message in MIME format. --===============1445022468554279510== Content-Transfer-Encoding: 7bit Content-Type: multipart/alternative; boundary="_----------=_14895962619028463" This is a multi-part message in MIME format. --_----------=_14895962619028463 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" I made done= SDL_True put in a delay and it worked well, thanks. Also, there is no border which is great. I think its because of my chosen resolution. Is there any was to actually turn it off? Murphy's Law. -- Gray Family [email protected] On Wed, Mar 15, 2017, at 11:23 AM, Mason Wheeler wrote: > The code looks pretty straightforward. There are three reasons why it > might not be quitting for you. > > 1) Most likely: you're never getting the SDL_QUIT event. > 2) SDL_DestroyRenderer is never returning for some reason. > 3) SDL_DestroyWindow is never returning for some reason. > > Probably #1 though. Have you tried running it under a debugger to > check on what's happening? > > Mason > **From:** speartip <[email protected]> **To:** > [email protected] **Sent:** Wednesday, March 15, 2017 9:46 AM > **Subject:** [SDL] have to use task manager to abort program > > What am I doing wrong here? This is lifted code. When the program runs > it produces a black screen with a geometric pattern which is fine. But > it sticks, it can only abort with task manager: > Second, it has no border (which is what I want) but I would like to > be able to toggle that rather than just watch it disappear b/c I use > use 1920 x 1080 res. > > > > > > > > > > > Code: > #include > #include > using namespace std; > > int main(int argc, char* argv[]) > { > if (SDL_Init(SDL_INIT_VIDEO) == 0) { > SDL_Window* window = NULL; > SDL_Renderer* renderer = NULL; > > if (SDL_CreateWindowAndRenderer(1920, 1080, 0, &window, > &renderer) == 0) { > SDL_bool done = SDL_FALSE; > > while (!done) { > SDL_Event event; > > SDL_SetRenderDrawColor(renderer, 0, 0, 0, > SDL_ALPHA_OPAQUE); > SDL_RenderClear(renderer); > > SDL_SetRenderDrawColor(renderer, 0, 0, 255, > SDL_ALPHA_OPAQUE); > SDL_RenderDrawLine(renderer, 320, 200, 300, 240); > SDL_RenderDrawLine(renderer, 300, 240, 340, 240); > SDL_RenderDrawLine(renderer, 340, 240, 320, 200); > SDL_RenderPresent(renderer); > > while (SDL_PollEvent(&event)) { > if (event.type == SDL_QUIT) { > done = SDL_TRUE; > } > } > } > } > > if (renderer) { > SDL_DestroyRenderer(renderer); > } > if (window) { > SDL_DestroyWindow(window); > } > } > SDL_Quit(); > return 0; > > } > _______________________________________________ > SDL mailing list > [email protected] > http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org > > _________________________________________________ > SDL mailing list > [email protected] > http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org --_----------=_14895962619028463 Content-Transfer-Encoding: 7bit Content-Type: text/html; charset="utf-8" <!DOCTYPE html> <html> <head> <title></title> </head> <body><div>I made done= SDL_True put in a delay and it worked well, thanks. Also, there is no border which is great. I think its because of my chosen resolution. Is there any was to actually turn it off? Murphy's Law.</div> <div><br></div> <div id="sig43414442"><div class="signature">--<br></div> <div class="signature"> Gray Family<br></div> <div class="signature"> [email protected]<br></div> <div class="signature"><br></div> </div> <div><br></div> <div><br></div> <div>On Wed, Mar 15, 2017, at 11:23 AM, Mason Wheeler wrote:<br></div> <blockquote type="cite"><div style="color:rgb(0, 0, 0);background-color:rgb(255, 255, 255);font-family:HelveticaNeue, "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;font-size:13px;"><div>The code looks pretty straightforward. There are three reasons why it might not be quitting for you.<br></div> <div><br></div> <div>1) Most likely: you're never getting the SDL_QUIT event.<br></div> <div dir="ltr">2) SDL_DestroyRenderer is never returning for some reason.<br></div> <div dir="ltr"><span>3) </span>SDL_DestroyWindow is never returning for some reason.<br></div> <div><div><br></div> <div>Probably #1 though. Have you tried running it under a debugger to check on what's happening?<br></div> <div><br></div> <div>Mason<br></div> </div> <div style="display:block;"><div style="font-family:HelveticaNeue, "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;font-size:13px;"><div style="font-family:HelveticaNeue, "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;font-size:16px;"><div dir="ltr"><span class="font" style="font-family:Arial"><span class="size" style="font-size:small"><hr size="1"><b><b>From:</b></b> speartip <[email protected]><br> <b><b>To:</b></b> [email protected] <br> <b><b>Sent:</b></b> Wednesday, March 15, 2017 9:46 AM<br> <b><b>Subject:</b></b> [SDL] have to use task manager to abort program</span></span></div> <div><div><br></div> <div><div><div><div>What am I doing wrong here? This is lifted code. When the program runs it produces a black screen with a geometric pattern which is fine. But it sticks, it can only abort with task manager:<br></div> <div> Second, it has no border (which is what I want) but I would like to be able to toggle that rather than just watch it disappear b/c I use use 1920 x 1080 res.<br></div> <div> <br></div> <div> <br></div> <div> <br></div> <div align="center"><div><br></div> <div><br></div> <div><br></div> <div><br></div> <div><br></div> <div><br></div> <div><br></div> <table cellspacing="1" cellpadding="2" align="center" width="90%" border="0"><tbody><tr><td align="left">Code:<br></td></tr><tr><td align="left"><div>#include<br></div> <div> #include<br></div> <div> using namespace std;<br></div> <div> <br></div> <div> int main(int argc, char* argv[])<br></div> <div> {<br></div> <div> if (SDL_Init(SDL_INIT_VIDEO) == 0) {<br></div> <div> SDL_Window* window = NULL;<br></div> <div> SDL_Renderer* renderer = NULL;<br></div> <div> <br></div> <div> if (SDL_CreateWindowAndRenderer(1920, 1080, 0, &window, &renderer) == 0) {<br></div> <div> SDL_bool done = SDL_FALSE;<br></div> <div> <br></div> <div> while (!done) {<br></div> <div> SDL_Event event;<br></div> <div> <br></div> <div> SDL_SetRenderDrawColor(renderer, 0, 0, 0, SDL_ALPHA_OPAQUE);<br></div> <div> SDL_RenderClear(renderer);<br></div> <div> <br></div> <div> SDL_SetRenderDrawColor(renderer, 0, 0, 255, SDL_ALPHA_OPAQUE);<br></div> <div> SDL_RenderDrawLine(renderer, 320, 200, 300, 240);<br></div> <div> SDL_RenderDrawLine(renderer, 300, 240, 340, 240);<br></div> <div> SDL_RenderDrawLine(renderer, 340, 240, 320, 200);<br></div> <div> SDL_RenderPresent(renderer);<br></div> <div> <br></div> <div> while (SDL_PollEvent(&event)) {<br></div> <div> if (event.type == SDL_QUIT) {<br></div> <div> done = SDL_TRUE;<br></div> <div> }<br></div> <div> }<br></div> <div> }<br></div> <div> }<br></div> <div> <br></div> <div> if (renderer) {<br></div> <div> SDL_DestroyRenderer(renderer);<br></div> <div> }<br></div> <div> if (window) {<br></div> <div> SDL_DestroyWindow(window);<br></div> <div> }<br></div> <div> }<br></div> <div> SDL_Quit();<br></div> <div> return 0;<br></div> <div> <br></div> <div> }<br></div> </td></tr></tbody></table></div> </div> </div> </div> <div>_______________________________________________<br></div> <div>SDL mailing list<br></div> <div><a href="mailto:[email protected]">[email protected]</a><br></div> <div><a href="http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org">http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org</a><br></div> <div><br></div> </div> </div> </div> </div> </div> <div><u>_______________________________________________</u><br></div> <div>SDL mailing list<br></div> <div><a href="mailto:[email protected]">[email protected]</a><br></div> <div><a href="http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org">http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org</a><br></div> </blockquote><div><br></div> </body> </html> --_----------=_14895962619028463-- --===============1445022468554279510== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ SDL mailing list [email protected] http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org --===============1445022468554279510==--