<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[zufällige polygone]]></title><description><![CDATA[<p>war beim petzold lesen beim RANDRECT programm angekommen und hab dieses progrämmchen etwas erweitern wollen, und zwar hab ich eine Funktion eingbaut, die Zufällige Polygone Zeichnen soll, klappt sogar, nur leider stürzt das programm nach ner Zeit (millisekundenbereich) mit einem Fehler ab. Hier der Code von der Polygonzeichenfunktion:</p>
<pre><code>void DrawPoly(HWND hWnd)
{
	if(cxClient == 0 || cyClient == 0)
		return;

	HBRUSH hBrush;
	HDC hdc;
	RECT rect;
	HRGN hrgnpol;
	int i = rand()%10;
	POINT* pt = new POINT[i];

	SetRect(&amp;rect,	rand()%cxClient, rand()%cyClient,
					rand()%cxClient, rand()%cyClient);

	for(int k = 0; k&lt;i; k++)
	{
		pt[k].x = max(rect.left,rand()% rect.right);
		pt[k].y = max(rect.top,rand()% rect.bottom);
	}

	hBrush = CreateSolidBrush (
                    RGB (rand () % 256, rand () % 256, rand () % 256)) ;
    hdc = GetDC (hWnd) ;
	hrgnpol = CreatePolygonRgn(pt, i, WINDING);
	FillRgn(hdc, hrgnpol,hBrush);
	ReleaseDC(hWnd, hdc);
	 DeleteObject(hBrush);
	 DeleteObject(hrgnpol);
	 delete[] pt;
	 pt= NULL;
}
</code></pre>
<p>sehe meinen Fehler irgendwie nicht, aber es ist ja 100%ig sicher, dass im forum einige bessere Augen haben als ich</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/168871/zufällige-polygone</link><generator>RSS for Node</generator><lastBuildDate>Thu, 16 Jul 2026 02:22:57 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/168871.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 29 Dec 2006 01:28:49 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to zufällige polygone on Fri, 29 Dec 2006 01:28:49 GMT]]></title><description><![CDATA[<p>war beim petzold lesen beim RANDRECT programm angekommen und hab dieses progrämmchen etwas erweitern wollen, und zwar hab ich eine Funktion eingbaut, die Zufällige Polygone Zeichnen soll, klappt sogar, nur leider stürzt das programm nach ner Zeit (millisekundenbereich) mit einem Fehler ab. Hier der Code von der Polygonzeichenfunktion:</p>
<pre><code>void DrawPoly(HWND hWnd)
{
	if(cxClient == 0 || cyClient == 0)
		return;

	HBRUSH hBrush;
	HDC hdc;
	RECT rect;
	HRGN hrgnpol;
	int i = rand()%10;
	POINT* pt = new POINT[i];

	SetRect(&amp;rect,	rand()%cxClient, rand()%cyClient,
					rand()%cxClient, rand()%cyClient);

	for(int k = 0; k&lt;i; k++)
	{
		pt[k].x = max(rect.left,rand()% rect.right);
		pt[k].y = max(rect.top,rand()% rect.bottom);
	}

	hBrush = CreateSolidBrush (
                    RGB (rand () % 256, rand () % 256, rand () % 256)) ;
    hdc = GetDC (hWnd) ;
	hrgnpol = CreatePolygonRgn(pt, i, WINDING);
	FillRgn(hdc, hrgnpol,hBrush);
	ReleaseDC(hWnd, hdc);
	 DeleteObject(hBrush);
	 DeleteObject(hrgnpol);
	 delete[] pt;
	 pt= NULL;
}
</code></pre>
<p>sehe meinen Fehler irgendwie nicht, aber es ist ja 100%ig sicher, dass im forum einige bessere Augen haben als ich</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1199286</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1199286</guid><dc:creator><![CDATA[Azrael* il Meraz]]></dc:creator><pubDate>Fri, 29 Dec 2006 01:28:49 GMT</pubDate></item><item><title><![CDATA[Reply to zufällige polygone on Fri, 29 Dec 2006 01:35:09 GMT]]></title><description><![CDATA[<p>sorry, war zu doof, hab nicht debuggt - da seh ichs schon - division by zero beim modulo, problem gelöst.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1199287</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1199287</guid><dc:creator><![CDATA[Azrael* il Meraz]]></dc:creator><pubDate>Fri, 29 Dec 2006 01:35:09 GMT</pubDate></item></channel></rss>