<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>How to make a ASCII game?</title>
		<link>http://www.allegro.cc/forums/view/615617</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Sun, 02 Aug 2015 00:12:58 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>What would be your way to go about making the graphics for a Nethack, or Dwarf Fortress game?</p><p>I realize I could use Allegro and cache all the text. (Though, it&#39;d probably need shaders to handle color, considering all of the possible permutations.) You also lose any &quot;real&quot; advantage of text (telnet/ssh).</p><p>I brought up ncurses and tried it. It&#39;s insanely simple to setup and use. One include, and two or three lines of code. However, immediately I was struck with a problem. Linux doesn&#39;t support extended ASCII.</p><p>Supposedly, you can change terminal emulation modes to get it to work. Nope. None of those work.</p><p>Supposedly, you can get a font that has ASCII code pages. But then you&#39;re requiring people to have appropriate fonts.</p><p>An hour or two of sifting through people&#39;s dead links has yielded no success in getting extended page ASCII to work. Which pisses me off. <img src="http://www.allegro.cc/forums/smileys/angry.gif" alt="&gt;:(" /></p><p>So I guess I should just go with Allegro, but does anyone here of experience in the matter?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Chris Katko)</author>
		<pubDate>Sat, 01 Aug 2015 08:24:21 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>DwarfFortress uses an SDL window, hence the support for custom graphics. I think that&#39;s superior to a plain terminal, since it&#39;s easier to create custom bitmap fonts. </p><p>If you wanted to stick to text mode, I imagine a better method these days is to use UTF8 rather than extended ASCII.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (SiegeLord)</author>
		<pubDate>Sat, 01 Aug 2015 09:23:20 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I guess I&#39;m just gonna have to use a window. It makes sense, I&#39;m just dragging my feet about writing the renderer.</p><p>The thing about UTF-8 is you lose all of the special ASCII characters. </p><p>You can&#39;t do this:</p><p><span class="remote-thumbnail"><span class="json">{"name":"x4ujtucwz6etb6ed8n7m.gif","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/a\/0\/a03715c7166b97eb040e1574efd3f368.gif","w":640,"h":350,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/a\/0\/a03715c7166b97eb040e1574efd3f368"}</span><img src="http://www.allegro.cc//djungxnpq2nug.cloudfront.net/image/cache/a/0/a03715c7166b97eb040e1574efd3f368-240.jpg" alt="x4ujtucwz6etb6ed8n7m.gif" width="240" height="131" /></span></p><p>With UTF-8, because it doesn&#39;t have all the nifty text UI characters.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Chris Katko)</author>
		<pubDate>Sat, 01 Aug 2015 09:33:41 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>What do you mean? UTF-8 has every single unicode character, which has every single 8-bit ASCII character <img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" />
</p><pre>
╔══════════════════════╗
║▛▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▜║
║▌▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▐║
║▌▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▐║
║▌▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▐║
║▌▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▐║
║▌▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▐║
║▌░░░░░░░░░░░░░░░░░░░░▐║
║▙▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▟║
╚══════════════════════╝
</pre><p>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Elias)</author>
		<pubDate>Sat, 01 Aug 2015 10:15:54 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Do allegro&#39;s font parsers support all 256 characters? Because I&#39;ve got a font that supposedily supports extended characters and all I&#39;m getting is blank over and over for special characters.</p><p>Using this font:</p><p><a href="http://webdraft.hu/fonts/classic-console/">http://webdraft.hu/fonts/classic-console/</a></p><p>I&#39;m getting nothing but blanks.</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="number">  2</span><span class="k1">class</span> text_renderer_t
<span class="number">  3</span>  <span class="k2">{</span>
<span class="number">  4</span>  public:
<span class="number">  5</span>  <span class="k1">bool</span> is_initialized <span class="k3">=</span> <span class="k1">false</span><span class="k2">;</span>
<span class="number">  6</span>  <a href="http://www.allegro.cc/manual/ALLEGRO_FONT"><span class="a">ALLEGRO_FONT</span></a> <span class="k3">*</span>_font<span class="k2">;</span> 
<span class="number">  7</span>  
<span class="number">  8</span>  <span class="k1">void</span> load_ttf_font<span class="k2">(</span><span class="k1">const</span> <span class="k1">char</span> <span class="k3">*</span>filename, <span class="k1">int</span> size, <span class="k1">int</span> flags<span class="k2">)</span>
<span class="number">  9</span>    <span class="k2">{</span>    
<span class="number"> 10</span>    _font <span class="k3">=</span> <a href="http://www.allegro.cc/manual/al_load_ttf_font"><span class="a">al_load_ttf_font</span></a><span class="k2">(</span>filename, size, flags<span class="k2">)</span><span class="k2">;</span>  
<span class="number"> 11</span>    <span class="k1">if</span><span class="k2">(</span>_font <span class="k3">!</span><span class="k3">=</span> NULL<span class="k2">)</span>is_initialized <span class="k3">=</span> <span class="k1">true</span><span class="k2">;</span>
<span class="number"> 12</span>    
<span class="number"> 13</span>    <a href="http://www.delorie.com/djgpp/doc/libc/libc_48.html" target="_blank">assert</a><span class="k2">(</span>_font<span class="k2">)</span><span class="k2">;</span> <span class="c">//debugging for now. no error handler</span>
<span class="number"> 14</span>    <span class="k2">}</span>
<span class="number"> 15</span>    
<span class="number"> 16</span>  <span class="k1">void</span> <a href="http://www.allegro.cc/manual/load_bitmap_font"><span class="a">load_bitmap_font</span></a><span class="k2">(</span><span class="k1">const</span> <span class="k1">char</span> <span class="k3">*</span>filename<span class="k2">)</span>
<span class="number"> 17</span>    <span class="k2">{</span>    
<span class="number"> 18</span>    _font <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>filename<span class="k2">)</span><span class="k2">;</span>  
<span class="number"> 19</span>    <span class="k1">if</span><span class="k2">(</span>_font <span class="k3">!</span><span class="k3">=</span> NULL<span class="k2">)</span>is_initialized <span class="k3">=</span> <span class="k1">true</span><span class="k2">;</span>
<span class="number"> 20</span>    
<span class="number"> 21</span>    <a href="http://www.delorie.com/djgpp/doc/libc/libc_48.html" target="_blank">assert</a><span class="k2">(</span>_font<span class="k2">)</span><span class="k2">;</span> <span class="c">//debugging for now. no error handler</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> draw_char<span class="k2">(</span><span class="k1">int</span> x, <span class="k1">int</span> y, <span class="k1">char</span> character, <a href="http://www.allegro.cc/manual/ALLEGRO_COLOR"><span class="a">ALLEGRO_COLOR</span></a> color<span class="k2">)</span>
<span class="number"> 25</span>    <span class="k2">{</span>
<span class="number"> 26</span>    <a href="http://www.delorie.com/djgpp/doc/libc/libc_48.html" target="_blank">assert</a><span class="k2">(</span>is_initialized<span class="k2">)</span><span class="k2">;</span>
<span class="number"> 27</span>    <span class="k1">char</span> text<span class="k2">[</span><span class="n">2</span><span class="k2">]</span><span class="k2">;</span>
<span class="number"> 28</span>    text<span class="k2">[</span><span class="n">0</span><span class="k2">]</span> <span class="k3">=</span> character<span class="k2">;</span>
<span class="number"> 29</span>    text<span class="k2">[</span><span class="n">1</span><span class="k2">]</span> <span class="k3">=</span> <span class="s">'\0'</span><span class="k2">;</span>
<span class="number"> 30</span>    <a href="http://www.allegro.cc/manual/al_draw_text"><span class="a">al_draw_text</span></a><span class="k2">(</span>_font, color, x, y, <span class="n">0</span>, text<span class="k2">)</span><span class="k2">;</span> 
<span class="number"> 31</span>    <span class="k2">}</span>
<span class="number"> 32</span>  
<span class="number"> 33</span>  
<span class="number"> 34</span>  <span class="k2">}</span>text<span class="k2">;</span>
<span class="number"> 35</span>
<span class="number"> 36</span>
<span class="number"> 37</span><span class="c">//</span>
<span class="number"> 38</span>
<span class="number"> 39</span>  text.load_ttf_font<span class="k2">(</span><span class="s">"data/clacon.ttf"</span>, <span class="n">16</span>, <span class="n">0</span><span class="k2">)</span><span class="k2">;</span>
</div></div><p>


Using Allegro 5.1.7, Ubuntu.</p><p>[edit] Going through all 256 entries gives:</p><p><span class="remote-thumbnail"><span class="json">{"name":"609682","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/5\/e\/5e30134ab2a74e70ecf216544545b3f9.png","w":640,"h":222,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/5\/e\/5e30134ab2a74e70ecf216544545b3f9"}</span><img src="http://www.allegro.cc//djungxnpq2nug.cloudfront.net/image/cache/5/e/5e30134ab2a74e70ecf216544545b3f9-240.jpg" alt="609682" width="240" height="83" /></span></p><p>*Note the blue rectangle is not related to the font.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Chris Katko)</author>
		<pubDate>Sat, 01 Aug 2015 11:07:18 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>You need to type in unicode like I did above, or otherwise use a translation table from codepage 437 to unicode. E.g. ╔ is ASCII 201 in cp437 which is unicode 9556, so:
</p><div class="source-code snippet"><div class="inner"><pre><a href="http://www.allegro.cc/manual/al_draw_text"><span class="a">al_draw_text</span></a><span class="k2">(</span><span class="s">"╔"</span><span class="k2">)</span> <span class="c">// wors</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/al_utf8_encode"><span class="a">al_utf8_encode</span></a><span class="k2">(</span><span class="n">9556</span><span class="k2">)</span><span class="k2">)</span> <span class="c">// works</span>
<a href="http://www.allegro.cc/manual/al_draw_text"><span class="a">al_draw_text</span></a><span class="k2">(</span><span class="k2">{</span><span class="n">0xE2</span>, <span class="n">0x95</span>, <span class="n">0x94</span>, <span class="n">0</span><span class="k2">}</span><span class="k2">)</span> <span class="c">// works</span>
</pre></div></div><p>
(pseudo code, need to add missing arguments to all functions)
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Elias)</author>
		<pubDate>Sat, 01 Aug 2015 18:02:39 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>If you are going only for the ASCII looks then you can just load one of those <a href="http://dwarffortresswiki.org/index.php/Tileset_repository">character tilesets</a>.<br />Then create 256 subbitmaps, one for each character. And just draw them to the screen using normal drawing functions.<br />That way you can even tint them to any color you desire.<br />This way you can make really nice ASCII looking game backed up by modern hardware. <a href="http://xcomrl.blogspot.sk/search/label/Screenshots">( X@COM )</a>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Izual)</author>
		<pubDate>Sat, 01 Aug 2015 22:26:03 +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/615617/1015627#target">Elias</a> said:</div><div class="quote"><p>
al_draw_text(&quot;╔&quot;) // wors
</p></div></div><p>
That works! But unfortunately, it appears my ASCII TTF fonts looks ugly as hell no matter what I do. So I&#39;ll have to go the bitmap route.</p><p>However, shouldn&#39;t al_load_ttf_font() support something like AL_DEFAULT_POINT_SIZE (=&quot;-1&quot;)?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Chris Katko)</author>
		<pubDate>Sun, 02 Aug 2015 00:12:58 +0000</pubDate>
	</item>
</rss>
