<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>drawing integer values...</title>
		<link>http://www.allegro.cc/forums/view/609848</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Wed, 28 Mar 2012 00:05:09 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I want to draw my score to my display, but al_draw_text() only allows the drawing of constant pointer-to-char so it&#39;s impossible to draw something like an unsigned int score, even with itoa().</p><p>Is there a way to still do this? It&#39;s probably something real simple that I&#39;m just overlooking xD</p><p>TIA <img src="http://www.allegro.cc/forums/smileys/grin.gif" alt=";D" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (xirb22)</author>
		<pubDate>Tue, 27 Mar 2012 22:47:50 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>A couple minutes of poking around in the examples found this in ex_membmp.c.</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="k1">static</span> <span class="k1">void</span> print<span class="k2">(</span><a href="http://www.allegro.cc/manual/ALLEGRO_FONT"><span class="a">ALLEGRO_FONT</span></a> <span class="k3">*</span>myfont, <span class="k1">char</span> <span class="k3">*</span>message, <span class="k1">int</span> x, <span class="k1">int</span> y<span class="k2">)</span>
<span class="number">  2</span><span class="k2">{</span>
<span class="number">  3</span>   <a href="http://www.allegro.cc/manual/al_draw_text"><span class="a">al_draw_text</span></a><span class="k2">(</span>myfont, <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">0</span>, <span class="n">0</span>, <span class="n">0</span><span class="k2">)</span>, x<span class="k3">+</span><span class="n">2</span>, y<span class="k3">+</span><span class="n">2</span>, <span class="n">0</span>, message<span class="k2">)</span><span class="k2">;</span>
<span class="number">  4</span>   <a href="http://www.allegro.cc/manual/al_draw_text"><span class="a">al_draw_text</span></a><span class="k2">(</span>myfont, <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>, x, y, <span class="n">0</span>, message<span class="k2">)</span><span class="k2">;</span>
<span class="number">  5</span><span class="k2">}</span>
<span class="number">  6</span>
<span class="number">  7</span> .
<span class="number">  8</span> .
<span class="number">  9</span> .
<span class="number"> 10</span>      print<span class="k2">(</span><a href="http://www.allegro.cc/manual/font"><span class="a">font</span></a>, message, <span class="n">0</span>, <span class="n">0</span><span class="k2">)</span><span class="k2">;</span>
<span class="number"> 11</span>      <a href="http://www.delorie.com/djgpp/doc/libc/libc_737.html" target="_blank">sprintf</a><span class="k2">(</span>second_line, <span class="s">"%.1f FPS"</span>, fps<span class="k2">)</span><span class="k2">;</span>
<span class="number"> 12</span>      print<span class="k2">(</span><a href="http://www.allegro.cc/manual/font"><span class="a">font</span></a>, second_line, <span class="n">0</span>, <a href="http://www.allegro.cc/manual/al_get_font_line_height"><span class="a">al_get_font_line_height</span></a><span class="k2">(</span><a href="http://www.allegro.cc/manual/font"><span class="a">font</span></a><span class="k2">)</span><span class="k3">+</span><span class="n">5</span><span class="k2">)</span><span class="k2">;</span>
<span class="number"> 13</span> .
<span class="number"> 14</span> .
<span class="number"> 15</span> .
</div></div><p>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Arthur Kalliokoski)</author>
		<pubDate>Tue, 27 Mar 2012 22:53:48 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I never really learned C but went straight to C++, so I am a bit confused with the C parts of this code.<br />I see that print() writes a shadowed text to the screen, but it still really used al_draw_text() to do it and so it still requires a *char.</p><p>I am guessing sprintf() is used to print fps into second line and so converts it into a string? If so I&#39;ll read up on sprintf() to see how it works so I can use this myself.</p><p>Thanks for the help bro <img src="http://www.allegro.cc/forums/smileys/grin.gif" alt=";D" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (xirb22)</author>
		<pubDate>Tue, 27 Mar 2012 23:29:20 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>How about <span class="source-code"><a href="http://www.allegro.cc/manual/al_draw_textf"><span class="a">al_draw_textf</span></a></span>? It&#39;ll take out the middle man, allowing you to pass the format string directly to the Allegro function. Look up a printf tutorial on the Internets to figure out how to use format strings (will help with sprintf too, if you end up needing it someday).</p><p>Also... you can use <span class="source-code">std::stringstream</span> alongside <span class="source-code"><a href="http://www.allegro.cc/manual/al_draw_text"><span class="a">al_draw_text</span></a></span> for a more... C++... solution.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (SiegeLord)</author>
		<pubDate>Tue, 27 Mar 2012 23:34:37 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>al_draw_textf() works perfectly!<br />I looked up some stuff about printf() and just using &quot;%d&quot; as the format works!<br />Thanks a lot everyone <img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (xirb22)</author>
		<pubDate>Wed, 28 Mar 2012 00:05:09 +0000</pubDate>
	</item>
</rss>
