<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>Transitioning from Allegro 4; fullscreen question...</title>
		<link>http://www.allegro.cc/forums/view/609769</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Thu, 22 Mar 2012 20:15:01 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>In Allegro 4, I am used to doing this, for example:<br /><span class="source-code"><a href="http://www.allegro.cc/manual/set_gfx_mode"><span class="a">set_gfx_mode</span></a><span class="k2">(</span>GFX_AUTODETECT_FULLSCREEN, <span class="n">320</span>, <span class="n">200</span>, <span class="n">0</span>, <span class="n">0</span><span class="k2">)</span><span class="k2">;</span></span></p><p>I just jumped into the new API of Allegro 5 and am getting my bearings.  Considering the code I whipped up below, how would I get this to full screen?</p><div class="source-code"><div class="toolbar"><span class="button numbers"><b>#</b></span><span class="button select">Select</span><span class="button expand">Expand</span></div><div class="inner"><span class="number">  1</span><span class="p">#include &lt;stdio.h&gt;</span>
<span class="number">  2</span><span class="p">#include &lt;allegro5/allegro.h&gt;</span>
<span class="number">  3</span><span class="p">#include &lt;allegro5/allegro_font.h&gt;</span>
<span class="number">  4</span><span class="p">#include &lt;allegro5/allegro_image.h&gt;</span>
<span class="number">  5</span>
<span class="number">  6</span><a href="http://www.allegro.cc/manual/ALLEGRO_DISPLAY"><span class="a">ALLEGRO_DISPLAY</span></a> <span class="k3">*</span>display <span class="k3">=</span> NULL<span class="k2">;</span>
<span class="number">  7</span><a href="http://www.allegro.cc/manual/ALLEGRO_FONT"><span class="a">ALLEGRO_FONT</span></a> <span class="k3">*</span><a href="http://www.allegro.cc/manual/font"><span class="a">font</span></a> <span class="k3">=</span> NULL<span class="k2">;</span>
<span class="number">  8</span>
<span class="number">  9</span><span class="k1">int</span> init<span class="k2">(</span><span class="k2">)</span> <span class="k2">{</span>
<span class="number"> 10</span>  <a href="http://www.allegro.cc/manual/al_init"><span class="a">al_init</span></a><span class="k2">(</span><span class="k2">)</span><span class="k2">;</span>
<span class="number"> 11</span>  <span class="k1">if</span><span class="k2">(</span><span class="k3">!</span><a href="http://www.allegro.cc/manual/al_init"><span class="a">al_init</span></a><span class="k2">(</span><span class="k2">)</span><span class="k2">)</span> <span class="k2">{</span> <a href="http://www.delorie.com/djgpp/doc/libc/libc_345.html" target="_blank">fprintf</a><span class="k2">(</span>stderr, <span class="s">"failed to initialize allegro!\n"</span><span class="k2">)</span><span class="k2">;</span> <span class="k1">return</span> <span class="k3">-</span><span class="n">1</span><span class="k2">;</span> <span class="k2">}</span>
<span class="number"> 12</span>  <a href="http://www.allegro.cc/manual/al_init_font_addon"><span class="a">al_init_font_addon</span></a><span class="k2">(</span><span class="k2">)</span><span class="k2">;</span>
<span class="number"> 13</span>  <a href="http://www.allegro.cc/manual/al_init_image_addon"><span class="a">al_init_image_addon</span></a><span class="k2">(</span><span class="k2">)</span><span class="k2">;</span>
<span class="number"> 14</span>
<span class="number"> 15</span>  display <span class="k3">=</span> <a href="http://www.allegro.cc/manual/al_create_display"><span class="a">al_create_display</span></a><span class="k2">(</span><span class="n">320</span>, <span class="n">200</span><span class="k2">)</span><span class="k2">;</span>
<span class="number"> 16</span>  <span class="k1">if</span><span class="k2">(</span><span class="k3">!</span>display<span class="k2">)</span> <span class="k2">{</span> <a href="http://www.delorie.com/djgpp/doc/libc/libc_345.html" target="_blank">fprintf</a><span class="k2">(</span>stderr, <span class="s">"failed to create display!\n"</span><span class="k2">)</span><span class="k2">;</span> <span class="k1">return</span> <span class="k3">-</span><span class="n">1</span><span class="k2">;</span> <span class="k2">}</span>  
<span class="number"> 17</span>  <a href="http://www.allegro.cc/manual/font"><span class="a">font</span></a> <span class="k3">=</span> <a href="http://www.allegro.cc/manual/al_load_bitmap_font"><span class="a">al_load_bitmap_font</span></a><span class="k2">(</span><span class="s">"a4_font.tga"</span><span class="k2">)</span><span class="k2">;</span>  
<span class="number"> 18</span><span class="k2">}</span>
<span class="number"> 19</span>
<span class="number"> 20</span><span class="k1">void</span> print<span class="k2">(</span><span class="k1">int</span> color, <span class="k1">const</span> <span class="k1">char</span> <span class="k3">*</span>text<span class="k2">)</span> <span class="k2">{</span>
<span class="number"> 21</span>  <a href="http://www.allegro.cc/manual/al_draw_text"><span class="a">al_draw_text</span></a><span class="k2">(</span><a href="http://www.allegro.cc/manual/font"><span class="a">font</span></a>, <a href="http://www.allegro.cc/manual/al_map_rgb"><span class="a">al_map_rgb</span></a><span class="k2">(</span><span class="n">255</span>,<span class="n">255</span>,<span class="n">255</span><span class="k2">)</span>, <span class="n">0</span>,<span class="n">0</span>,<span class="n">0</span>, text<span class="k2">)</span><span class="k2">;</span>
<span class="number"> 22</span><span class="k2">}</span>
<span class="number"> 23</span>
<span class="number"> 24</span><span class="k1">void</span> print<span class="k2">(</span><span class="k1">const</span> <span class="k1">char</span> <span class="k3">*</span>text<span class="k2">)</span> <span class="k2">{</span>
<span class="number"> 25</span>  <a href="http://www.allegro.cc/manual/al_draw_text"><span class="a">al_draw_text</span></a><span class="k2">(</span><a href="http://www.allegro.cc/manual/font"><span class="a">font</span></a>, <a href="http://www.allegro.cc/manual/al_map_rgb"><span class="a">al_map_rgb</span></a><span class="k2">(</span><span class="n">255</span>,<span class="n">255</span>,<span class="n">255</span><span class="k2">)</span>, <span class="n">0</span>,<span class="n">0</span>,<span class="n">0</span>, text<span class="k2">)</span><span class="k2">;</span>
<span class="number"> 26</span><span class="k2">}</span>
<span class="number"> 27</span>
<span class="number"> 28</span><span class="k1">void</span> terminate<span class="k2">(</span><span class="k2">)</span> <span class="k2">{</span> <a href="http://www.allegro.cc/manual/al_destroy_display"><span class="a">al_destroy_display</span></a><span class="k2">(</span>display<span class="k2">)</span><span class="k2">;</span> <span class="k2">}</span>
<span class="number"> 29</span>
<span class="number"> 30</span><span class="k1">int</span> main<span class="k2">(</span><span class="k1">int</span> argc, <span class="k1">char</span> <span class="k3">*</span><span class="k3">*</span>argv<span class="k2">)</span> <span class="k2">{</span>
<span class="number"> 31</span>    
<span class="number"> 32</span>  init<span class="k2">(</span><span class="k2">)</span><span class="k2">;</span>
<span class="number"> 33</span>  print<span class="k2">(</span><span class="s">"Hello World!"</span><span class="k2">)</span><span class="k2">;</span>
<span class="number"> 34</span>
<span class="number"> 35</span>  <a href="http://www.allegro.cc/manual/al_flip_display"><span class="a">al_flip_display</span></a><span class="k2">(</span><span class="k2">)</span><span class="k2">;</span>
<span class="number"> 36</span>  <a href="http://www.allegro.cc/manual/al_rest"><span class="a">al_rest</span></a><span class="k2">(</span><span class="n">10</span>.<span class="n">0</span><span class="k2">)</span><span class="k2">;</span>
<span class="number"> 37</span> 
<span class="number"> 38</span>  terminate<span class="k2">(</span><span class="k2">)</span><span class="k2">;</span>
<span class="number"> 39</span>
<span class="number"> 40</span>  <span class="k1">return</span> <span class="n">0</span><span class="k2">;</span>
<span class="number"> 41</span><span class="k2">}</span>
</div></div><p>

Lastly, I&#39;m using the HTML version of the Allegro 5 manual and just want to make sure there isn&#39;t a better guide available.  I&#39;m used to Allegro 4&#39;s slightly more thorough documentation.  I hate bothering the forums with petty questions.</p><p>Appreciate any insight.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (cantide5ga)</author>
		<pubDate>Fri, 16 Mar 2012 21:28:44 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p><span class="source-code"><a href="http://www.allegro.cc/manual/al_set_new_display_flags"><span class="a">al_set_new_display_flags</span></a><span class="k2">(</span>ALLEGRO_FULLSCREEN<span class="k2">)</span><span class="k2">;</span></span> before <span class="source-code">display <span class="k3">=</span> <a href="http://www.allegro.cc/manual/al_create_display"><span class="a">al_create_display</span></a><span class="k2">(</span><span class="n">320</span>, <span class="n">200</span><span class="k2">)</span><span class="k2">;</span></span>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (AMCerasoli)</author>
		<pubDate>Fri, 16 Mar 2012 21:40:39 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Thanks.</p><p>I get an Access Violation, and guess it has to do with the mode I am requesting.  320 x 200 is preferred, but I could live with 320 x 240.  Both throw the violation.</p><p>With 640 x 480 being a commonly supported resolution, is a good method of getting my preferred 320 x 200 to stretch the bitmap to 640 x 480?  Nothing fancy and want to avoid anti-aliasing.  Anything else I should consider?</p><p>I&#39;m attempting to rewrite a program that used mode 13h with a reduced 4-bit color set.  Trying to get to that point before I dive into it further.</p><p>Thanks for any follow-ups.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (cantide5ga)</author>
		<pubDate>Fri, 16 Mar 2012 22:34:37 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I think the best way to do fullscreen is to do <span class="source-code"><a href="http://www.allegro.cc/manual/al_set_new_display_flags"><span class="a">al_set_new_display_flags</span></a><span class="k2">(</span>ALLEGRO_FULLSCREEN_WINDOW<span class="k2">)</span></span> the same size as the main resolution, and then manually resize/letterbox your game to fit. You can stretch the bitmap or use transformations to accomplish the latter (I&#39;m sure there are a few threads with the required code).
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (SiegeLord)</author>
		<pubDate>Sat, 17 Mar 2012 00:15:24 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>This smells like tutorial worthy material! <img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc ( Arvidsson)</author>
		<pubDate>Sat, 17 Mar 2012 01:13:16 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I imagined before each screen update, I could do the resizing.  Can you explain why you suggest ALLEGRO_FULLSCREEN_WINDOW and not ALLEGRO_FULLSCREEN?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (cantide5ga)</author>
		<pubDate>Sat, 17 Mar 2012 01:26:24 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>It&#39;s easier to alt-tab away from the windowed fullscreen mode in my experience.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (SiegeLord)</author>
		<pubDate>Sat, 17 Mar 2012 02:57:17 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>With FULLSCREEN_WINDOW you&#39;re also guaranteed the mode is supported. A lot of monitors these days (ie: LCDs) have a native mode. Setting anything else will either fail, or get resized by a potentially crappy scaler. My old LCD has probably one of the crappiest scalers ever. It looks so awful its not even funny.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thomas Fjellstrom)</author>
		<pubDate>Sat, 17 Mar 2012 03:22:41 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title"><a href="http://www.allegro.cc/forums/thread/609769/950042#target">cantide5ga</a> said:</div><div class="quote"><p> I imagined before each screen update, I could do the resizing.</p></div></div><p>You don&#39;t need to resize at each screen update. Depending on the monitor resolution you can resize all of your images, load different ones (bigger/smaller) or both.</p><p>I have always wanted to make a tutorial about this, but I really don&#39;t have the time right now. </p><p>You can use transformations which I don&#39;t know anything about, or you can resize your images individually depending on the screen resolution. Resizing it&#39;s the most easiest approach after the raw <span class="source-code">ALLEGRO_FULLSCREEN</span> display option. But you won&#39;t notice the difference at least you add black bars in the left and right part of the screen to make the game keep its aspect ratio. </p><p>Now, the ideal way would be to not resize the images at all, and show more or less depending on the monitor resolution. A good example would be to play Angry Birds for PC, which resizes the view depending on your monitor resolution, or in case you want a resizing example the card game Spiders which comes with Windows.</p><p>The unique one in which you don&#39;t need to think about anything but just resize the windows is when using the <span class="source-code">ALLEGRO_FULLSCREEN</span> flag. With the rest of them the first thing that comes to mind is collision detection, which obviously needs to change when the image increase or decrease. Now if you go with the &quot;ideal&quot; approach in which you don&#39;t change any image, the collision detection still the same, but the layout of the game will be your nightmare.</p><p>Neither of them are really difficult, the thing is if you&#39;re just used to set a flag... Obviously this will be something new that will take you some time.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (AMCerasoli)</author>
		<pubDate>Sat, 17 Mar 2012 04:20:29 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="source-code"><div class="toolbar"><span class="button numbers"><b>#</b></span><span class="button select">Select</span><span class="button expand">Expand</span></div><div class="inner"><span class="number"> 1</span><a href="http://www.allegro.cc/manual/al_set_new_display_flags"><span class="a">al_set_new_display_flags</span></a><span class="k2">(</span>ALLEGRO_RESIZABLE <span class="k3">|</span> ALLEGRO_OPENGL <span class="k3">|</span> ALLEGRO_OPENGL_3_0<span class="k2">)</span><span class="k2">;</span>
<span class="number"> 2</span><a href="http://www.allegro.cc/manual/ALLEGRO_DISPLAY"><span class="a">ALLEGRO_DISPLAY</span></a> <span class="k3">*</span> display <span class="k3">=</span> <a href="http://www.allegro.cc/manual/al_create_display"><span class="a">al_create_display</span></a><span class="k2">(</span><span class="n">1280</span>, <span class="n">800</span><span class="k2">)</span><span class="k2">;</span>
<span class="number"> 3</span><a href="http://www.allegro.cc/manual/al_set_window_title"><span class="a">al_set_window_title</span></a><span class="k2">(</span>display, <span class="s">"Allegro 5 &amp;"</span><span class="k2">)</span><span class="k2">;</span>
<span class="number"> 4</span>GLenum error <span class="k3">=</span> glewInit<span class="k2">(</span><span class="k2">)</span><span class="k2">;</span>
</div></div><p>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (flowbsd)</author>
		<pubDate>Sat, 17 Mar 2012 18:41:40 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title"><a href="http://www.allegro.cc/forums/thread/609769/950055#target">AMCerasoli</a> said:</div><div class="quote"><p>Neither of them are really difficult, the thing is if you&#39;re just used to set a flag... Obviously this will be something new that will take you some time.</p></div></div><p>
I don&#39;t clearly understand everything you were suggesting and am assuming it is lingo related to this library.  It seems you are suggesting a lot of resource use in the manipulation of sprites/tiles on an image by image basis.  Why wouldn&#39;t it be best practice to work on the 320x200 bitmap in the buffer and on each update expand it to a fullscreen size?</p><p>The code/logic has already been produced btw.  But even if I wasn&#39;t attempting a port of sorts, I&#39;m trying to imagine why I would use such unnecessary complication when making this from the ground up...</p><p>Hopefully a follow-up will clear things up.  I must be misunderstanding something.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (cantide5ga)</author>
		<pubDate>Mon, 19 Mar 2012 21:59:38 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Basically what he&#39;s saying is, why not scale ALL of your images on startup (so in your case double the size of ALL the bitmaps on startup) rather than stretching the screen every frame.</p><p>I hope that helps!
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Dizzy Egg)</author>
		<pubDate>Wed, 21 Mar 2012 20:35:55 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Wow, got nothing of the sorts from what he said.  Great idea though, as the collision routine would work on the same multiplier applied to the graphics.</p><p>Thanks
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (cantide5ga)</author>
		<pubDate>Thu, 22 Mar 2012 02:04:59 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>If you already have everything working for 320x200, then just set an <span class="source-code"><a href="http://www.allegro.cc/manual/ALLEGRO_TRANSFORM"><span class="a">ALLEGRO_TRANSFORM</span></a></span> to scale everything up to the screen, letter boxing as appropriate. You don&#39;t need to manipulate your world coordinates at all, except to translate between screen coords and world coords.</p><p>I think the steps to build your transform would be :<br />1) Translate to center on the camera center<br />2) Scale up to screen dimensions<br />3) Set this as your transform</p><p>(Never tried this before, could be wrong...)
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Edgar Reynaldo)</author>
		<pubDate>Thu, 22 Mar 2012 03:32:48 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Then you can invert that transform and use <span class="source-code"><a href="http://www.allegro.cc/manual/al_transform_coordinates"><span class="a">al_transform_coordinates</span></a></span> to map coordinates back.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thomas Fjellstrom)</author>
		<pubDate>Thu, 22 Mar 2012 10:16:31 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Thanks everybody.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (cantide5ga)</author>
		<pubDate>Thu, 22 Mar 2012 20:15:01 +0000</pubDate>
	</item>
</rss>
