<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>So what&#39;s Allegro doing special ...</title>
		<link>http://www.allegro.cc/forums/view/593978</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Thu, 29 Nov 2007 13:42:51 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Okay, I&#39;ve mentioned this before. I&#39;m making a little program for my class that draws up a window on the second monitor of the computer, which is set up to be displayed at the front of the room via projector. Works fine and dandy, and there&#39;s been three versions. One that&#39;s just an Allegro GFX_AUTODETECT_WINDOWED, one that&#39;s Win32 and OpenGL, and one that&#39;s Win32 and uses Allegro to draw the double buffer to the device context via draw_to_hdc(). Those last two are made with the class style WS_POPUP and just drawn to cover the second monitor, making it appear fullscreen (the pure Allegro program I just drag over there <img src="http://www.allegro.cc/forums/smileys/tongue.gif" alt=":P" />) since I couldn&#39;t figure out how to make it go <i>actually</i> fullscreen on monitor two.</p><p>Now, I&#39;m hammering out the final version of this thing after all my experimenting. And the third program setup works the best for me; I can use all the fancy Win32 GUI stuff with the simple Allegro graphics routines. Works great. One catch: it&#39;s slow. Like, really slow. Like runs at a quarter the speed of the other two programs slow, at best.</p><p>Now I assume this is an issue with hardware acceleration of some kind. The other two programs are fine so I know the machine is (barely) capable. The pure Allegro setup won&#39;t work because I need a dialog box or two and it&#39;s got the ugly border. The Win32/OpenGL version is okay, but OpenGL is a pain to set up compared to Allegro, plus the Allegro code is already done anyway (the Win32/OpenGL test was actually a completely seperate program).</p><p>So, I&#39;d really like to know what Allegro is doing that it works fine in the plain version, but runs so slow in the Win32 version. I&#39;m guessing there&#39;s some DirectX of some kind running in the background? How hard would it be to add that as a wrapper between Allegro and Win32? I&#39;ve never used DirectX. Should I just bite the bullet and do the best I can with OpenGL 2D and Win32, and forget Allegro? I&#39;m hoping someone with insight into Allegro&#39;s guts can tell me how hard it is to reproduce what it&#39;s doing. Otherwise I&#39;ll just go with OpenGL, clumsy as I am with it.</p><p>I can try to provide some skeleton code of any of these programs if it would help.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (23yrold3yrold)</author>
		<pubDate>Tue, 13 Nov 2007 18:22:59 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
I can try to provide some skeleton code of any of these programs if it would help.
</p></div></div><p>

I will try to make some test if you do so.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (GullRaDriel)</author>
		<pubDate>Wed, 14 Nov 2007 04:25:06 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p><i>If I&#39;m right</i>, blit_to_hdc() should rely on GDI, not on DirectX.</p><p>Do I understand correctly that you have <i>one</i> Allegro application that needs to go fullscreen on the second monitor? So it&#39;s not a matter of multiple windows?</p><p>I won&#39;t have any real solution, though.</p><p>[edit]</p><p>A quick look at the sources under /win shows that function is in gdi.c, so I guess I&#39;m right.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Marco Radaelli)</author>
		<pubDate>Wed, 14 Nov 2007 07:58:10 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>isn&#39;t blit_to_hdc() slow as hell?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Milan Mimica)</author>
		<pubDate>Wed, 14 Nov 2007 15:42:45 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Yes.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Evert)</author>
		<pubDate>Wed, 14 Nov 2007 15:52:40 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
isn&#39;t <b>GDI</b> slow as hell?
</p></div></div><p>Fixed.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thomas Fjellstrom)</author>
		<pubDate>Wed, 14 Nov 2007 16:09:07 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>GDI is always slow as hell.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (GullRaDriel)</author>
		<pubDate>Wed, 14 Nov 2007 21:17:55 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I know less than you do about the guts <img src="http://www.allegro.cc/forums/smileys/sad.gif" alt=":(" />.</p><p>In case you didn&#39;t see my thread and do decide to go the OpenGL route yet don&#39;t want to learn OpenGL, you could look at my library:<br /><a href="http://www.allegro.cc/forums/thread/589392">Thing 1.0 Library</a><br /><a href="http://www.allegro.cc/forums/thread/590842">Sprite Thing Example</a></p><p>If you do decide to learn OpenGL, maybe my code will make the learning process easier?  I&#39;d try to analyze bitmap.h and bitmap_hardware.cpp</p><p>As for getting OpenGL up and running (albeit this isn&#39;t that difficult), you can look for that in conf.cpp</p><p><sub>
Also note this: In Conf.cpp you have included aldumb.h... this file is not needed.
I don&#39;t think I got around to fixing that line of code before the thread closed :-X
</sub>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (ImLeftFooted)</author>
		<pubDate>Thu, 15 Nov 2007 03:49:27 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>If he switches to OpenGL, we will never see TMS! <img src="http://www.allegro.cc/forums/smileys/undecided.gif" alt=":-/" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Richard Phipps)</author>
		<pubDate>Thu, 15 Nov 2007 04:15:26 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">The Masters of the Obvious said:</div><div class="quote"><p>

isn&#39;t blit_to_hdc() slow as hell?</p><p>isn&#39;t GDI slow as hell?</p><p>GDI is always slow as hell.
</p></div></div><p>
Yes, thank you all. Now, on to how we might rectify it, and more specifically, if anyone knows how Allegro in particular does it ...
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (23yrold3yrold)</author>
		<pubDate>Thu, 15 Nov 2007 07:11:06 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
I can use all the fancy Win32 GUI stuff with the simple Allegro graphics routines. Works great. One catch: it&#39;s slow. Like, really slow. Like runs at a quarter the speed of the other two programs slow, at best.
</p></div></div><p>
02:20 am idea (so discard it if sounds strange, tomorrow I&#39;ll reread it ^_^): Can&#39;t you have all the fancy Win32 GUI stuff in a window and have Allegro manage its other? Or even use a pipe to connect a Win32 program to the Allegro one, and you pass anything you get from the Win32 GUI program to the Allegro program through the pipe or some other IPC system?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Marco Radaelli)</author>
		<pubDate>Thu, 15 Nov 2007 07:24:52 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>The are many Allegro GFX drivers, some of theme are GFX_GDI and GFX_DIRECTX, go figure how allegro does it in each of the two cases.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Milan Mimica)</author>
		<pubDate>Fri, 16 Nov 2007 01:05:52 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>MR: no, because the whole point is the Allegro window is ugly. <img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" /> It&#39;s got a border I can&#39;t get rid of.</p><p>MM: I&#39;d love to &quot;go figure how&quot;, but the Allegro source code does not make for light reading the last time I examined it. :p</p><p>DD: Can I use that with Win32? I already know OpenGL fairly well, the point is to avoid re-writing old code that already works fine in Allegro. I may just bite the bullet and go that path if I can get it running at a decent speed though ....
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (23yrold3yrold)</author>
		<pubDate>Sat, 17 Nov 2007 16:28:51 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
Yes, thank you all. Now, on to how we might rectify it, and more specifically, if anyone knows how Allegro in particular does it ...
</p></div></div><p>The GDI driver is slow. Always has been. The faster drivers are all DirectX/DirectDraw.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thomas Fjellstrom)</author>
		<pubDate>Sat, 17 Nov 2007 16:33:49 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>In the other words, there is nothing special Allegro doing in GFX_GDI mode.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Milan Mimica)</author>
		<pubDate>Sat, 17 Nov 2007 16:38:01 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>That&#39;s not very helpful. I didn&#39;t ask what Allegro was doing special &quot;in GFX_GDI mode&quot; ...</p><p>Screw you guys; I&#39;ll just use OpenGL. <img src="http://www.allegro.cc/forums/smileys/tongue.gif" alt=":P" /> No cookies.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (23yrold3yrold)</author>
		<pubDate>Sat, 17 Nov 2007 16:39:59 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>That&#39;s why we mentioned DirectX. IT USES DIRECTX!. I hope you read that this time.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thomas Fjellstrom)</author>
		<pubDate>Sat, 17 Nov 2007 17:27:10 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Did you read it when I said it in the original post as well? <img src="http://www.allegro.cc/forums/smileys/rolleyes.gif" alt="::)" /> That it uses DirectX I knew already (duh). How I might easily go about doing the same thing to use Allegro in a custom Win32 window without a miserable framerate is kinda the topic. If there&#39;s no easy way, then straight up OpenGL it is since I know it better than DirectX. If there is a way, however, I was hoping an Allegro guru could tell me ...
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (23yrold3yrold)</author>
		<pubDate>Sat, 17 Nov 2007 17:33:14 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Oh, threre is, win_set_window will let you give allegro your own window. or win_get_window, and you can MODIFY allegro&#39;s.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thomas Fjellstrom)</author>
		<pubDate>Sat, 17 Nov 2007 17:39:36 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>There, now that&#39;s information I might actually be able to use. <img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" /> I didn&#39;t know the actual API made allowances for that sort of thing; guess I&#39;ll RTFM and see if it fits ....
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (23yrold3yrold)</author>
		<pubDate>Sat, 17 Nov 2007 17:45:52 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>win_set_window HAS to be done before a call to set_gfx_mode iirc.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thomas Fjellstrom)</author>
		<pubDate>Sat, 17 Nov 2007 17:46:43 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
Oh, threre is, win_set_window will let you give allegro your own window.
</p></div></div><p>

If I may offer a counterpoint, I haven&#39;t had much luck getting win_set_window to work. Allegro 4.2.2&#39;s input system doesn&#39;t seem to behave itself very well when you use this. I&#39;ve also noticed a number of other posts about win_set_window that have shown problems with various bits of Allegro when trying to use it.</p><p>It may be that the feature needs work, or has suffered bit rot.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Nicol Bolas)</author>
		<pubDate>Sun, 18 Nov 2007 04:39:46 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">23yrold23yrold said:</div><div class="quote"><p>

DD: Can I use that with Win32? I already know OpenGL fairly well, the point is to avoid re-writing old code that already works fine in Allegro. I may just bite the bullet and go that path if I can get it running at a decent speed though ....
</p></div></div><p>
It runs on windows as well as linux.  On linux you must compile with NO_D3D=1.</p><p>If by win32 you mean to ask if it can be placed inside a win32 control, then no.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (ImLeftFooted)</author>
		<pubDate>Sun, 18 Nov 2007 05:13:43 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>GDI is slow for a number of reasons;
</p><ul><li><p>different colour depths for the screens.. very slow.
</p></li><li><p>allegro in 32bit, desktop in 16 bit... very slow.
</p></li><li><p>sometimes its a drivers issue (often integrated gfx cards on laptops, the 2nd desktop is always slow.</p></li></ul><p>however..  if you match up the allegro version (32bit/16bit) with the desktop depth, and your DONT have windows spanning 2 desktops, then its wicked fast!</p><p>if your data for that screen is already in a suitably packed RGB structure, look at the GDI function StretchDiBits()  to get the desktops DC, call  GetDC(NULL);</p><p>regarding your windows without borders etc,  that is easy to do also.. by changing the win32 windows style info in the CreateWindow()</p><p>another hack i do, used shared memory, and copy it into another running process like a SDL window.</p><p>i have heaps of these multi-screen methods, at least one of them ought to work for you.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (aj5555)</author>
		<pubDate>Tue, 20 Nov 2007 13:22:12 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
however.. if you match up the allegro version (32bit/16bit) with the desktop depth, and your DONT have windows spanning 2 desktops, then its wicked fast!
</p></div></div><p>Two requests:<br />1. Please define &quot;Whicked Fast&quot; (especially compared to DDraw and D3D emulated DDraw)<br />2. Prove it.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thomas Fjellstrom)</author>
		<pubDate>Tue, 20 Nov 2007 13:37:26 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p><a href="http://www.allegro.cc/forums/thread/241899">http://www.allegro.cc/forums/thread/241899</a>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Arthur Kalliokoski)</author>
		<pubDate>Wed, 21 Nov 2007 01:35:14 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Two problems, GDI != GDI+, and Allegro doesn&#39;t use GDI+ afaik. Just plain old gdi32.dll.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thomas Fjellstrom)</author>
		<pubDate>Wed, 21 Nov 2007 06:28:49 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>ZOMG thread necro.</p><div class="source-code"><div class="toolbar"></div><div class="inner"><table width="100%"><tbody><tr><td class="number">1</td><td><span class="k1">int</span> WINAPI WinMain<span class="k2">(</span>HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, <span class="k1">int</span> nCmdShow<span class="k2">)</span></td></tr><tr><td class="number">2</td><td><span class="k2">{</span></td></tr><tr><td class="number">3</td><td>  <a href="http://www.allegro.cc/manual/BITMAP" target="_blank"><span class="a">BITMAP</span></a> <span class="k3">*</span>video_page<span class="k2">[</span><span class="n">2</span><span class="k2">]</span><span class="k2">;</span></td></tr><tr><td class="number">4</td><td>  <span class="k1">int</span> next_page <span class="k3">=</span> <span class="n">0</span><span class="k2">;</span></td></tr><tr><td class="number">5</td><td>  </td></tr><tr><td class="number">6</td><td>  WNDCLASS  wc<span class="k2">;</span></td></tr><tr><td class="number">7</td><td>  </td></tr><tr><td class="number">8</td><td>  wc.style    <span class="k3">=</span> CS_OWNDC<span class="k2">;</span></td></tr><tr><td class="number">9</td><td>  wc.lpfnWndProc    <span class="k3">=</span> <span class="k2">(</span>WNDPROC<span class="k2">)</span> WndProc<span class="k2">;</span></td></tr><tr><td class="number">10</td><td>  wc.cbClsExtra    <span class="k3">=</span> <span class="n">0</span><span class="k2">;</span></td></tr><tr><td class="number">11</td><td>  wc.cbWndExtra    <span class="k3">=</span> <span class="n">0</span><span class="k2">;</span></td></tr><tr><td class="number">12</td><td>  wc.hInstance    <span class="k3">=</span> hInstance<span class="k2">;</span></td></tr><tr><td class="number">13</td><td>  wc.hIcon    <span class="k3">=</span> LoadIcon<span class="k2">(</span>NULL, IDI_WINLOGO<span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">14</td><td>  wc.hCursor    <span class="k3">=</span> LoadCursor<span class="k2">(</span>NULL, IDC_ARROW<span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">15</td><td>  wc.hbrBackground  <span class="k3">=</span> NULL<span class="k2">;</span></td></tr><tr><td class="number">16</td><td>  wc.lpszMenuName    <span class="k3">=</span> NULL<span class="k2">;</span></td></tr><tr><td class="number">17</td><td>  wc.lpszClassName  <span class="k3">=</span> <span class="s">"Main Window Class"</span><span class="k2">;</span></td></tr><tr><td class="number">18</td><td>&#160;</td></tr><tr><td class="number">19</td><td>  <span class="k1">if</span> <span class="k2">(</span><span class="k3">!</span>RegisterClass<span class="k2">(</span><span class="k3">&amp;</span>wc<span class="k2">)</span><span class="k2">)</span></td></tr><tr><td class="number">20</td><td>  <span class="k2">{</span></td></tr><tr><td class="number">21</td><td>    MessageBox<span class="k2">(</span>NULL,<span class="s">"Failed To Register The Window Class."</span>,<span class="s">"ERROR"</span>,MB_OK<span class="k3">|</span>MB_ICONEXCLAMATION<span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">22</td><td>    <span class="k1">return</span> FALSE<span class="k2">;</span></td></tr><tr><td class="number">23</td><td>  <span class="k2">}</span></td></tr><tr><td class="number">24</td><td>&#160;</td></tr><tr><td class="number">25</td><td>  MSG    msg<span class="k2">;</span></td></tr><tr><td class="number">26</td><td>              </td></tr><tr><td class="number">27</td><td>  hWnd <span class="k3">=</span> CreateWindowEx<span class="k2">(</span>WS_EX_APPWINDOW,</td></tr><tr><td class="number">28</td><td>      <span class="s">"Main Window Class"</span>,</td></tr><tr><td class="number">29</td><td>      <span class="s">""</span>,</td></tr><tr><td class="number">30</td><td>      WS_POPUP <span class="k3">|</span> WS_CLIPSIBLINGS <span class="k3">|</span> WS_CLIPCHILDREN,</td></tr><tr><td class="number">31</td><td>      winxpos, <span class="n">0</span>,</td></tr><tr><td class="number">32</td><td>      screenw,</td></tr><tr><td class="number">33</td><td>      screenh,</td></tr><tr><td class="number">34</td><td>      NULL,</td></tr><tr><td class="number">35</td><td>      NULL,</td></tr><tr><td class="number">36</td><td>      hInstance,</td></tr><tr><td class="number">37</td><td>      NULL<span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">38</td><td>&#160;</td></tr><tr><td class="number">39</td><td>  <a href="http://www.allegro.cc/manual/win_set_window" target="_blank"><span class="a">win_set_window</span></a><span class="k2">(</span>hWnd<span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">40</td><td>  </td></tr><tr><td class="number">41</td><td>  <span class="k1">if</span> <span class="k2">(</span><a href="http://www.allegro.cc/manual/allegro_init" target="_blank"><span class="a">allegro_init</span></a><span class="k2">(</span><span class="k2">)</span> <span class="k3">!</span><span class="k3">=</span> <span class="n">0</span><span class="k2">)</span></td></tr><tr><td class="number">42</td><td>    <span class="k1">return</span> <span class="n">0</span><span class="k2">;</span></td></tr><tr><td class="number">43</td><td>&#160;</td></tr><tr><td class="number">44</td><td>  <a href="http://www.allegro.cc/manual/install_timer" target="_blank"><span class="a">install_timer</span></a><span class="k2">(</span><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">45</td><td>  <a href="http://www.allegro.cc/manual/install_keyboard" target="_blank"><span class="a">install_keyboard</span></a><span class="k2">(</span><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">46</td><td>  <a href="http://www.allegro.cc/manual/install_sound" target="_blank"><span class="a">install_sound</span></a><span class="k2">(</span>DIGI_AUTODETECT, MIDI_NONE, NULL<span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">47</td><td>  <a href="http://www.allegro.cc/manual/set_color_depth" target="_blank"><span class="a">set_color_depth</span></a><span class="k2">(</span><span class="n">24</span><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">48</td><td>&#160;</td></tr><tr><td class="number">49</td><td>  <span class="k1">if</span> <span class="k2">(</span><a href="http://www.allegro.cc/manual/set_gfx_mode" target="_blank"><span class="a">set_gfx_mode</span></a><span class="k2">(</span>GFX_DIRECTX_WIN, screenw, screenh, <span class="n">0</span>, <span class="n">0</span><span class="k2">)</span> <span class="k3">!</span><span class="k3">=</span> <span class="n">0</span><span class="k2">)</span> <span class="k2">{</span></td></tr><tr><td class="number">50</td><td>    MessageBox<span class="k2">(</span>hWnd, <span class="s">"Unable the set the graphics mode."</span>, <span class="s">"Error!"</span>, MB_ICONERROR <span class="k3">|</span> MB_OK<span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">51</td><td>    <span class="k1">return</span> <span class="n">0</span><span class="k2">;</span></td></tr><tr><td class="number">52</td><td>  <span class="k2">}</span></td></tr><tr><td class="number">53</td><td>&#160;</td></tr><tr><td class="number">54</td><td>  <a href="http://www.allegro.cc/manual/set_display_switch_mode" target="_blank"><span class="a">set_display_switch_mode</span></a><span class="k2">(</span>SWITCH_BACKGROUND<span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">55</td><td>  </td></tr><tr><td class="number">56</td><td>  video_page<span class="k2">[</span><span class="n">0</span><span class="k2">]</span> <span class="k3">=</span> <a href="http://www.allegro.cc/manual/create_video_bitmap" target="_blank"><span class="a">create_video_bitmap</span></a><span class="k2">(</span>screenw, screenh<span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">57</td><td>  video_page<span class="k2">[</span><span class="n">1</span><span class="k2">]</span> <span class="k3">=</span> <a href="http://www.allegro.cc/manual/create_video_bitmap" target="_blank"><span class="a">create_video_bitmap</span></a><span class="k2">(</span>screenw, screenh<span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">58</td><td>  </td></tr><tr><td class="number">59</td><td>  ShowWindow<span class="k2">(</span>hWnd, SW_SHOW<span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">60</td><td>  UpdateWindow<span class="k2">(</span>hWnd<span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">61</td><td>  </td></tr><tr><td class="number">62</td><td>  <span class="c">// ***********************************************************</span></td></tr><tr><td class="number">63</td><td>  DialogBox<span class="k2">(</span>hInstance, TEXT <span class="k2">(</span><span class="s">"ControlBox"</span><span class="k2">)</span>, hWnd, ControlDlgProc<span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">64</td><td>  <span class="c">// ***********************************************************</span></td></tr><tr><td class="number">65</td><td>&#160;</td></tr><tr><td class="number">66</td><td>  <span class="k1">while</span><span class="k2">(</span><span class="n">1</span><span class="k2">)</span></td></tr><tr><td class="number">67</td><td>  <span class="k2">{</span></td></tr><tr><td class="number">68</td><td>    <span class="c">// process input!</span></td></tr><tr><td class="number">69</td><td>    </td></tr><tr><td class="number">70</td><td>    <span class="c">// clear bitmap</span></td></tr><tr><td class="number">71</td><td>    <a href="http://www.allegro.cc/manual/clear_bitmap" target="_blank"><span class="a">clear_bitmap</span></a><span class="k2">(</span>video_page<span class="k2">[</span>next_page<span class="k2">]</span><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">72</td><td>&#160;</td></tr><tr><td class="number">73</td><td>    <span class="c">// Do all drawing!</span></td></tr><tr><td class="number">74</td><td>    </td></tr><tr><td class="number">75</td><td>    <span class="c">// update buffer</span></td></tr><tr><td class="number">76</td><td>    <a href="http://www.allegro.cc/manual/show_video_bitmap" target="_blank"><span class="a">show_video_bitmap</span></a><span class="k2">(</span>video_page<span class="k2">[</span>next_page<span class="k2">]</span><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">77</td><td>    next_page <span class="k3">=</span> <span class="n">1</span> <span class="k3">-</span> next_page<span class="k2">;</span></td></tr><tr><td class="number">78</td><td>&#160;</td></tr><tr><td class="number">79</td><td>    <span class="k1">while</span><span class="k2">(</span>PeekMessage<span class="k2">(</span><span class="k3">&amp;</span>msg, NULL, <span class="n">0</span>, <span class="n">0</span>, PM_NOREMOVE<span class="k2">)</span><span class="k2">)</span></td></tr><tr><td class="number">80</td><td>    <span class="k2">{</span></td></tr><tr><td class="number">81</td><td>      <span class="k1">if</span> <span class="k2">(</span>GetMessage<span class="k2">(</span><span class="k3">&amp;</span>msg, NULL, <span class="n">0</span>, <span class="n">0</span><span class="k2">)</span> <span class="k3">&amp;</span><span class="k3">&amp;</span> <span class="k3">!</span>done<span class="k2">)</span></td></tr><tr><td class="number">82</td><td>      <span class="k2">{</span></td></tr><tr><td class="number">83</td><td>        TranslateMessage<span class="k2">(</span><span class="k3">&amp;</span>msg<span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">84</td><td>        DispatchMessage<span class="k2">(</span><span class="k3">&amp;</span>msg<span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">85</td><td>      <span class="k2">}</span></td></tr><tr><td class="number">86</td><td>      <span class="k1">else</span></td></tr><tr><td class="number">87</td><td>      <span class="k2">{</span></td></tr><tr><td class="number">88</td><td>        <a href="http://www.allegro.cc/manual/destroy_bitmap" target="_blank"><span class="a">destroy_bitmap</span></a><span class="k2">(</span>video_page<span class="k2">[</span><span class="n">0</span><span class="k2">]</span><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">89</td><td>        <a href="http://www.allegro.cc/manual/destroy_bitmap" target="_blank"><span class="a">destroy_bitmap</span></a><span class="k2">(</span>video_page<span class="k2">[</span><span class="n">1</span><span class="k2">]</span><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">90</td><td>        <span class="k1">return</span> <span class="k2">(</span>msg.wParam<span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">91</td><td>      <span class="k2">}</span></td></tr><tr><td class="number">92</td><td>    <span class="k2">}</span></td></tr><tr><td class="number">93</td><td>  <span class="k2">}</span></td></tr><tr><td class="number">94</td><td>  </td></tr><tr><td class="number">95</td><td><span class="k2">}</span></td></tr></tbody></table></div></div><p>
This is my main loop and I pretty much have it working. Small question: why is it the dialog box I create (highlighted in stars) seem to block the loop? Nothing happens until I close the dialog, which then causes the program to do all the drawing it wassupposed to do before it closes (program is designed to close when the dialog is). I&#39;m too rusty to spot my error.</p><p>Otherwise works great. Going to try it on the intended computer this morning to see how fast it goes.</p><p>EDIT: Um, almost seems like the program is outright blocking at that highlighted line. I think I&#39;m calling the wrong dialog creating function .... but it works in all my other programs ....
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (23yrold3yrold)</author>
		<pubDate>Sun, 25 Nov 2007 17:56:08 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I think DialogBox is meant to block — it&#39;s for modal dialogues. I&#39;ve no idea why you haven&#39;t had problems before. Maybe you want CreateDialog? I&#39;m think that one&#39;s modeless.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thomas Harte)</author>
		<pubDate>Sun, 25 Nov 2007 18:58:19 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Just because it&#39;s modal doesn&#39;t (or shouldn&#39;t, I don&#39;t think) block execution of the program; just means you can&#39;t interact with the lower window until the dialog closes. Which is fine for this. Changing DialogBox to CreateDialog makes the dialog box not even open.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (23yrold3yrold)</author>
		<pubDate>Mon, 26 Nov 2007 06:16:32 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I think you need to call ShowDialog or something like that to open a CreateDialog&#39;d dialog.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Ron Ofir)</author>
		<pubDate>Mon, 26 Nov 2007 17:06:59 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
Just because it&#39;s modal doesn&#39;t (or shouldn&#39;t, I don&#39;t think) block execution of the program
</p></div></div><p>
I think it often does in Win32 land because of it&#39;s basis on the Win16 API (and the Win16 API&#39;s historic basis on ye olde Mac OS).</p><p>In any case, per <a href="http://msdn2.microsoft.com/en-us/library/ms645452.aspx">Microsoft</a>, &quot;DialogBox does not return control until the specified callback function terminates the modal dialog box&quot; so this particular function definitely does block unless you programmatically close the modal dialog box early.</p><p>EDIT: I thought of CreateDialog as a suggestion for a function you might have used before that looks like DialogBox but doesn&#39;t block. <a href="http://msdn2.microsoft.com/en-us/library/ms644996.aspx#modeless_box">This page</a> suggests a CreateDialog/ShowWindow combo, but then it implies you&#39;ll have to do some message passing yourself.</p><p>I think these sort of complications explain why Microsoft provide several higher level alternatives to Win32 nowadays.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thomas Harte)</author>
		<pubDate>Mon, 26 Nov 2007 18:27:14 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>blit_to_hdc() uses StretchDIBits for some reason, but it doesn&#39;t seem to incur any scaling speed penalties, so there must be a test in the function.</p><p>Have you tried the new D3D driver in 4.9?  I haven&#39;t so I can&#39;t really comment on what it can do yet, but it <i>should</i> be ready to open a full, fast display on the 2nd screen.  One drawback is that the 4.0 compatability layer is not written, so you&#39;ll have to rewrite your whole program for the new API
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Matt Smith)</author>
		<pubDate>Mon, 26 Nov 2007 19:12:01 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>It uses StretchDIBits because (I believe) it is required to flip the bitmaps around from Allegro&#39;s top-down format to Windows&#39; bottom-up format. StretchDIBits does do some sort of optimization checks because there&#39;s at least one buggy one that they introduced that required a work-around in Allegro...
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Matthew Leverton)</author>
		<pubDate>Mon, 26 Nov 2007 22:36:27 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I didn&#39;t get a chance to try this on the system intended for it to run on; it seems to be having issues that won&#39;t even allow it to boot up in safe mode. But it seems to be working fine now. I was going to scatter cookies about before this locked, but I guess I forgot to set it up for that. <img src="http://www.allegro.cc/forums/smileys/cry.gif" alt=":&#39;(" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (23yrold3yrold)</author>
		<pubDate>Thu, 29 Nov 2007 13:42:51 +0000</pubDate>
	</item>
</rss>
