have to use task manager to abort program

"speartip" <[email protected]> Wed, 15 Mar 2017 13:46:09 +0000
Newsgroups gmane.comp.lib.sdl
Message-ID <[email protected]>
--===============5606495098699801567==
Content-Type: multipart/alternative;
	boundary="=_23e5bafb992cb2b707fafca56605a6cf"

--=_23e5bafb992cb2b707fafca56605a6cf
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 7bit

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<iostream>
#include<SDL.h>
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;

}







--=_23e5bafb992cb2b707fafca56605a6cf
Content-Type: text/html; charset="ISO-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<style type=3D"text/css">
<!--

/*
  The original subSilver Theme for phpBB version 2+
  Created by subBlue design
  http://www.subBlue.com

  NOTE: These CSS definitions are stored within the main page body so that =
you can use the phpBB2
  theme administration centre. When you have finalised your style you could=
 cut the final CSS code
  and place it in an external file, deleting this section to save bandwidth=
.
*/


 /* General page style. The scroll bar colours only visible in IE5.5+ */
body {
	background-color: #;
	font-family: ;
	font-size: 11;
	color: #;
}

/* General font families for common tags */
font,th,td,p { font-family:  }
p, td		{ font-size : 11; color : #; }
a:link,a:active,a:visited { color : #; }
a:hover		{ text-decoration: underline; color : #; }
hr	{ height: 0px; border: solid # 0px; border-top-width: 1px;}
h1,h2		{ font-family: "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif=
; font-size : 22px; font-weight : bold; text-decoration : none; line-height=
 : 120%; color : #000000;}


/* This is the border line & background colour round the entire page */
.bodyline	{ background-color: #; border: 1px # solid; }


/* General text */
.gen { font-size : 12px; }
.genmed { font-size : 11px; }
.gensmall { font-size : 10px; line-height: 12px}
.gen,.genmed,.gensmall { color : #; }
a.gen,a.genmed,a.gensmall { color: #; text-decoration: none; }
a.gen:hover,a.genmed:hover,a.gensmall:hover	{ color: #; text-decoration: un=
derline; }


/* Forum title: Text and link to the forums used in: index.php */
.forumlink		{ font-weight: bold; font-size: 12px; color : #; }
a.forumlink 	{ text-decoration: none; color : #; }
a.forumlink:hover{ text-decoration: underline; color : #; }


/* The content of the posts (body of text) */
.postbody { font-size : 12px; line-height: 18px}
a.postlink:link	{ text-decoration: none; color : # }
a.postlink:visited { text-decoration: none; color : #; }
a.postlink:hover { text-decoration: underline; color : #}


/* Quote & Code blocks */
.code {
	font-family: ; font-size: 11px; color: #3FB753;
	background-color: #; border: #; border-style: solid;
	border-left-width: 1px; border-top-width: 1px; border-right-width: 1px; bo=
rder-bottom-width: 1px
}

.quote {
	font-family: ; font-size: 11px; color: #444444; line-height: 125%;
	background-color: #; border: #; border-style: solid;
	border-left-width: 1px; border-top-width: 1px; border-right-width: 1px; bo=
rder-bottom-width: 1px
}

-->
</style>
</head>
	<body>

	<div class=3D"postbody">What am I doing wrong here? This is lifted code. W=
hen the program runs it produces a black screen with a geometric pattern wh=
ich is fine. But it sticks, it can only abort with task manager:<br />
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 10=
80 res.<br />
<br />
<br />
<div align=3D"center"><table width=3D"90%" align=3D"center" cellspacing=3D"=
1" cellpadding=3D"2" border=3D"0" class=3D"code"><br />=0D<tr> <br />=0D	<t=
d class=3D"code_header" align=3D"left">Code:</td><br />=0D</tr><br />=0D<tr=
><br />=0D	<td class=3D"code" align=3D"left">#include<iostream><br />
#include<SDL.h><br />
using namespace std;<br />
<br />
int main&#40;int argc, char* argv&#91;&#93;&#41;<br />
&#123;<br />
&nbsp; &nbsp;if &#40;SDL_Init&#40;SDL_INIT_VIDEO&#41; =3D=3D 0&#41; &#123;<=
br />
&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; SDL_Window* window =3D NULL;<br />
&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; SDL_Renderer* renderer =3D NULL;<b=
r />
<br />
&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; if &#40;SDL_CreateWindowAndRendere=
r&#40;1920, 1080, 0, &window, &renderer&#41; =3D=3D 0&#41; &#123;<br />
&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SDL_bool done =3D SD=
L_FALSE;<br />
<br />
&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; while &#40;!done&#41=
; &#123;<br />
&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SDL_Ev=
ent event;<br />
<br />
&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SDL_Se=
tRenderDrawColor&#40;renderer, 0, 0, 0, SDL_ALPHA_OPAQUE&#41;;<br />
&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SDL_Re=
nderClear&#40;renderer&#41;;<br />
<br />
&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SDL_Se=
tRenderDrawColor&#40;renderer, 0, 0, 255, SDL_ALPHA_OPAQUE&#41;;<br />
&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SDL_Re=
nderDrawLine&#40;renderer, 320, 200, 300, 240&#41;;<br />
&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SDL_Re=
nderDrawLine&#40;renderer, 300, 240, 340, 240&#41;;<br />
&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SDL_Re=
nderDrawLine&#40;renderer, 340, 240, 320, 200&#41;;<br />
&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SDL_Re=
nderPresent&#40;renderer&#41;;<br />
<br />
&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; while =
&#40;SDL_PollEvent&#40;&event&#41;&#41; &#123;<br />
&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;=
 &nbsp; if &#40;event.type =3D=3D SDL_QUIT&#41; &#123;<br />
&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;=
 &nbsp; &nbsp; &nbsp; done =3D SDL_TRUE;<br />
&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;=
 &nbsp; &#125;<br />
&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#125;=
<br />
&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#125;<br />
&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &#125;<br />
<br />
&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; if &#40;renderer&#41; &#123;<br />
&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SDL_DestroyRenderer&=
#40;renderer&#41;;<br />
&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &#125;<br />
&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; if &#40;window&#41; &#123;<br />
&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SDL_DestroyWindow&#4=
0;window&#41;;<br />
&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &#125;<br />
&nbsp; &nbsp;&nbsp; &nbsp; &#125;<br />
&nbsp; &nbsp;&nbsp; &nbsp; SDL_Quit&#40;&#41;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; return 0;<br />
<br />
&#125;</td><br />=0D	</tr><br />=0D</table></div></div>
	</body>
</html>

--=_23e5bafb992cb2b707fafca56605a6cf--

--===============5606495098699801567==
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

--===============5606495098699801567==--