<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>Allegro 5 User Input </title>
		<link>http://www.allegro.cc/forums/view/613380</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Wed, 16 Oct 2013 04:41:15 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I have these lines in my project:</p><p>ALLEGRO_USTR *input= al_ustr_new(&quot;&quot;);	<br />int pos = (int)al_ustr_size(input);</p><p>.<br />.<br />.</p><p>if(events.keyboard.unichar &gt;= 32)<br />{<br />   pos += al_ustr_append_chr(input, events.keyboard.unichar);<br />}<br />else if(events.keyboard.keycode == ALLEGRO_KEY_BACKSPACE)<br />{								        if(al_ustr_prev(input, &amp;pos))<br />									 al_ustr_truncate(input, pos);<br />}</p><p>.<br />.<br />.</p><p>and here, I want to test the input with an if statement but I am not allowed to compare ALLEGRO_USTR format with char* or int. </p><p>How can I make something like this work : if(input == &#39;3&#39;) ?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (ma3stro)</author>
		<pubDate>Wed, 16 Oct 2013 02:01:05 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>How did you declare input?  Int?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Arthur Kalliokoski)</author>
		<pubDate>Wed, 16 Oct 2013 02:06:47 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>ALLEGRO_USTR* format.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (ma3stro)</author>
		<pubDate>Wed, 16 Oct 2013 02:09:41 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p><s>Aw crap, I just woke up and didn&#39;t see it in the original post.</s></p><p>I&#39;d think this would work
</p><div class="source-code snippet"><div class="inner"><pre><span class="k1">int</span> inchar <span class="k3">=</span> events.keyboard.unichar<span class="k2">;</span>
<span class="k1">if</span><span class="k2">(</span>inchar <span class="k3">&gt;</span><span class="k3">=</span> <span class="n">32</span><span class="k2">)</span>
<span class="k2">{</span>
  pos <span class="k3">+</span><span class="k3">=</span> <a href="http://www.allegro.cc/manual/al_ustr_append_chr"><span class="a">al_ustr_append_chr</span></a><span class="k2">(</span>input, inchar<span class="k2">)</span><span class="k2">;</span>
  blah
  blah
  <span class="k1">if</span><span class="k2">(</span>inchar <span class="k3">=</span><span class="k3">=</span> <span class="s">'3'</span><span class="k2">)</span>
  <span class="k2">{</span>
    blah
     .
     .
     .
</pre></div></div><p>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Arthur Kalliokoski)</author>
		<pubDate>Wed, 16 Oct 2013 02:16:34 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Thanks, it works! </p><p>One more question, What if I use the backspace key?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (ma3stro)</author>
		<pubDate>Wed, 16 Oct 2013 02:30:10 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I also get the keycode into an int, i.e.
</p><div class="source-code snippet"><div class="inner"><pre><span class="k1">int</span> inkey <span class="k3">=</span> events.keyboard.keycode<span class="k2">;</span>
<span class="k1">if</span><span class="k2">(</span>inkey <span class="k3">=</span><span class="k3">=</span> ALLEGRO_KEY_BACKSPACE<span class="k2">)</span>
<span class="k2">{</span>
  blah
</pre></div></div><p>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Arthur Kalliokoski)</author>
		<pubDate>Wed, 16 Oct 2013 02:37:02 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Of course, the last question was stupid <img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" /> Thanks again.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (ma3stro)</author>
		<pubDate>Wed, 16 Oct 2013 02:42:38 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>By the way, don&#39;t forget that you have to eventually free ALLEGRO_USTR* with a call to al_ustr_free()
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Aikei_c)</author>
		<pubDate>Wed, 16 Oct 2013 04:41:15 +0000</pubDate>
	</item>
</rss>
