<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>How do i print numbers</title>
		<link>http://www.allegro.cc/forums/view/618054</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Fri, 06 Mar 2020 04:01:09 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I&#39;m trying to use al_draw_text but it wont work with numbers and i&#39;m not sure how to convert to const char*
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (DuncanShine)</author>
		<pubDate>Fri, 06 Mar 2020 02:39:09 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Try this instead: <a href="https://liballeg.org/a5docs/trunk/font.html#al_draw_textf">https://liballeg.org/a5docs/trunk/font.html#al_draw_textf</a>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (torhu)</author>
		<pubDate>Fri, 06 Mar 2020 02:44:10 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>that didnt make a difference it&#39;s still asking for a const char
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (DuncanShine)</author>
		<pubDate>Fri, 06 Mar 2020 03:01:05 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>The const char pointer is the format string, the values are added as extra arguments after that. Look at the examples here:<br /><a href="https://www.cplusplus.com/reference/cstdio/printf/">https://www.cplusplus.com/reference/cstdio/printf/</a>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (torhu)</author>
		<pubDate>Fri, 06 Mar 2020 03:09:03 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p><a href="http://www.cplusplus.com/reference/cstdlib/itoa/">http://www.cplusplus.com/reference/cstdlib/itoa/</a></p><p>if using c++, <a href="http://www.cplusplus.com/reference/sstream/stringstream/">http://www.cplusplus.com/reference/sstream/stringstream/</a>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (jmasterx)</author>
		<pubDate>Fri, 06 Mar 2020 03:21:19 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>but what does stringstream actually do? it doesnt seem to convert to const char*
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (DuncanShine)</author>
		<pubDate>Fri, 06 Mar 2020 03:39:33 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>It works just like std cout<br /><a href="https://github.com/jmasterx/Agui/blob/master/demo/AguiCalc/AguiCalc/Calculator.cpp#L292">https://github.com/jmasterx/Agui/blob/master/demo/AguiCalc/AguiCalc/Calculator.cpp#L292</a></p><p>it will output a std string which you can do .c_str() to get a const char*</p><p>you can &lt;&lt; whaterver you want.</p><p>Like 
</p><div class="source-code snippet"><div class="inner"><pre>std::stringstream ss<span class="k2">;</span>

ss <span class="k3">&lt;</span><span class="k3">&lt;</span> <span class="s">"I ate"</span> <span class="k3">&lt;</span><span class="k3">&lt;</span> <span class="n">22</span> <span class="k3">&lt;</span><span class="k3">&lt;</span> <span class="s">"Hot Dogs"</span><span class="k2">;</span>
<a href="http://www.allegro.cc/manual/al_draw_text"><span class="a">al_draw_text</span></a><span class="k2">(</span>ss.str<span class="k2">(</span><span class="k2">)</span>.c_str<span class="k2">(</span><span class="k2">)</span><span class="k2">)</span><span class="k2">;</span>
</pre></div></div><p>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (jmasterx)</author>
		<pubDate>Fri, 06 Mar 2020 03:46:43 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Drawing an int would look like this:
</p><div class="source-code snippet"><div class="inner"><pre><a href="http://www.allegro.cc/manual/al_draw_textf"><span class="a">al_draw_textf</span></a><span class="k2">(</span>my_font, my_color, x_pos, y_pos, <span class="n">0</span>, <span class="s">"Here it is: %d"</span>, my_value<span class="k2">)</span><span class="k2">;</span>
</pre></div></div><p>

Or replace %d with %f to draw a float or double, etc.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (torhu)</author>
		<pubDate>Fri, 06 Mar 2020 04:01:09 +0000</pubDate>
	</item>
</rss>
