<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>mouse_b problem</title>
		<link>http://www.allegro.cc/forums/view/587972</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Thu, 12 Oct 2006 01:56:12 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Hi;<br />I was reading allegro-manual-4.2.0.I found mouse click variable. When I try to this variable, program do nothing about mouse. Mouse display on the screen and move everywhere on the screen but click variables  don&#39;t work.</p><p>I am using so:</p><p>at the top of program;</p><p>install_mouse();<br />show_mouse(screen);</p><p>and after</p><p>if(mouse_b&amp;0)<br />        printf(&quot;Left side is pressed\n&quot;);<br />if(mouse_b&amp;1)<br />        printf(&quot;Right side is pressed\n&quot;);</p><p>when program run, i don&#39;t see anything in console.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (bendenote)</author>
		<pubDate>Tue, 10 Oct 2006 16:32:34 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>
Try the mouse example and see if that works for you first.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Richard Phipps)</author>
		<pubDate>Tue, 10 Oct 2006 16:33:46 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Did you set gfx mode or not?</p><p>EDIT: Also you got the logic wrong. mouse_b&amp;0 doesn&#39;t make sense. It&#39;s mouse_b&amp;1 for left and mouse_b&amp;2 for the right button (middle button is mouse_b&amp;4).
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (miran)</author>
		<pubDate>Tue, 10 Oct 2006 16:35:48 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>All of my code</p><p>#include &lt;allegro.h&gt;<br />#include &lt;stdio.h&gt;</p><p>int get_mouse(void){<br />	int x,y;<br />	if( (mouse_x&lt;100) || (mouse_x&gt;550) || (mouse_y&lt;100) || (mouse_y&gt;550))<br />		return -1;<br />	else{<br />		x=(mouse_x-100)/50;<br />		y=(mouse_y-100)/50;<br />		return x+y*9;<br />	 }<br />}</p><p>int main(int argc, char *argv[]){<br />	<br />	<br />	allegro_init();<br />	<br />	BITMAP *resmim=NULL,*top=NULL;<br />	int light_wood_1 = makecol(195, 135, 55);<br />	set_color_depth(32);<br />	install_keyboard();<br />	install_mouse();<br />	install_timer();<br />	<br />	if (set_gfx_mode(GFX_AUTODETECT, 600, 600, 0, 0) != 0) {<br />                if (set_gfx_mode(GFX_SAFE, 600, 600, 0, 0) != 0) {<br />                        set_gfx_mode(GFX_TEXT, 0, 0, 0, 0);<br />                        allegro_message(&quot;Unable to set any graphic mode\n%s\n&quot;, allegro_error);<br />                        return 1;<br />                }<br />        }<br />	<br />	</p><p>	<br />	set_palette(desktop_palette);<br />	clear_to_color(screen,light_wood_1);<br />	show_mouse(screen);<br />	resmim=load_bitmap(&quot;bg81.bmp&quot;,desktop_palette);<br />	top=load_bitmap(&quot;brown00.bmp&quot;,desktop_palette);<br />	draw_sprite(resmim,top,0,0);<br />	<br />	blit(resmim,screen,0,0,100,100,450,450);<br />	<br />	while(mouse_b &amp; 1){/*This loop doesn&#39;t work. What can I do?*/<br />		if ( get_mouse()&gt;0)<br />			printf(&quot;%d\n&quot;,fare_deger_al());<br />	}<br />	<br />		<br />	readkey();<br />	destroy_bitmap(resmim);<br />	destroy_bitmap(top); <br />	return 0;<br />}
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (bendenote)</author>
		<pubDate>Tue, 10 Oct 2006 16:48:30 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
What can I do?
</p></div></div><p>
You can start by using code tags.</p><p>EDIT: What do you expect your code to do? It makes no sense.</p><p>Here&#39;s some sample code that does work:
</p><div class="source-code"><div class="toolbar"></div><div class="inner"><table width="100%"><tbody><tr><td class="number">1</td><td><span class="p">#include &lt;allegro.h&gt;</span></td></tr><tr><td class="number">2</td><td><span class="p">#include &lt;stdio.h&gt;</span></td></tr><tr><td class="number">3</td><td>&#160;</td></tr><tr><td class="number">4</td><td><span class="k1">int</span> main<span class="k2">(</span><span class="k2">)</span> <span class="k2">{</span></td></tr><tr><td class="number">5</td><td>  <a href="http://www.allegro.cc/manual/allegro_init" target="_blank"><span class="a">allegro_init</span></a><span class="k2">(</span><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">6</td><td>  <a href="http://www.allegro.cc/manual/set_gfx_mode" target="_blank"><span class="a">set_gfx_mode</span></a><span class="k2">(</span>GFX_AUTODETECT_WINDOWED, <span class="n">640</span>,<span class="n">480</span>,<span class="n">0</span>,<span class="n">0</span><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">7</td><td>  <a href="http://www.allegro.cc/manual/install_mouse" target="_blank"><span class="a">install_mouse</span></a><span class="k2">(</span><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">8</td><td>  <a href="http://www.allegro.cc/manual/install_keyboard" target="_blank"><span class="a">install_keyboard</span></a><span class="k2">(</span><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">9</td><td>&#160;</td></tr><tr><td class="number">10</td><td>  <span class="k1">while</span> <span class="k2">(</span><span class="k3">!</span><a href="http://www.allegro.cc/manual/key" target="_blank"><span class="a">key</span></a><span class="k2">[</span>KEY_ESC<span class="k2">]</span><span class="k2">)</span> <span class="k2">{</span></td></tr><tr><td class="number">11</td><td>    <span class="k1">if</span><span class="k2">(</span><a href="http://www.allegro.cc/manual/mouse_b" target="_blank"><span class="a">mouse_b</span></a><span class="k3">&amp;</span><span class="n">1</span><span class="k2">)</span></td></tr><tr><td class="number">12</td><td>    <a href="http://www.delorie.com/djgpp/doc/libc/libc_624.html" target="_blank">printf</a><span class="k2">(</span><span class="s">"Left side is pressed\n"</span><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">13</td><td>    <span class="k1">if</span><span class="k2">(</span><a href="http://www.allegro.cc/manual/mouse_b" target="_blank"><span class="a">mouse_b</span></a><span class="k3">&amp;</span><span class="n">2</span><span class="k2">)</span></td></tr><tr><td class="number">14</td><td>    <a href="http://www.delorie.com/djgpp/doc/libc/libc_624.html" target="_blank">printf</a><span class="k2">(</span><span class="s">"Right side is pressed\n"</span><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">15</td><td>    <a href="http://www.allegro.cc/manual/rest" target="_blank"><span class="a">rest</span></a><span class="k2">(</span><span class="n">10</span><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">16</td><td>  <span class="k2">}</span></td></tr><tr><td class="number">17</td><td>&#160;</td></tr><tr><td class="number">18</td><td>  <span class="k1">return</span> <span class="n">0</span><span class="k2">;</span></td></tr><tr><td class="number">19</td><td><span class="k2">}</span></td></tr><tr><td class="number">20</td><td><a href="http://www.allegro.cc/manual/END_OF_MAIN" target="_blank"><span class="a">END_OF_MAIN</span></a><span class="k2">(</span><span class="k2">)</span></td></tr></tbody></table></div></div><p>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (miran)</author>
		<pubDate>Tue, 10 Oct 2006 16:50:47 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Thanks miran I try your code. Mouse works. Default variable was &quot;left side is pressed&quot;. So it couldn&#39;t display screen. when I correct so while loop it works:</p><p>while(!key[KEY_ESC]){<br />		if(mouse_b&amp;1){if ( fare_deger_al()&gt;0)<br />			printf(&quot;%d\n&quot;,fare_deger_al());<br />			}<br />		printf(&quot;Left side is pressed\n&quot;);<br />		if(mouse_b&amp;2)<br />		printf(&quot;Right side is pressed\n&quot;);<br />		rest(10);<br />			}
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (bendenote)</author>
		<pubDate>Tue, 10 Oct 2006 17:02:15 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>bendenote: please use the <a href="http://www.allegro.cc/mockup.html">code tags</a>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (GullRaDriel)</author>
		<pubDate>Tue, 10 Oct 2006 17:31:50 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>sorry <img src="http://www.allegro.cc/forums/smileys/sad.gif" alt=":(" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (bendenote)</author>
		<pubDate>Wed, 11 Oct 2006 02:18:27 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>You can edit your thread you know, and just add the right tag around your piece of code will make them looking as nice as the one you can see in Miran&#39;s post.</p><p>The edit button is the second one following &quot;Posted on 10-10-2006 14:31&quot; in each of your posts.</p><p>Don&#39;t be that sorry. I was doing the same when I was just coming here.</p><p>In fact, the code-tags also have a nice utility: each function who is in the allegro manual is shown in blue and is in fact a link into the function documentation in the manual.</p><p>It is also better because of syntax coloration, and it will not &quot;eat&quot; your indentation. Looking at it will be better for us.</p><p>:-)
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (GullRaDriel)</author>
		<pubDate>Wed, 11 Oct 2006 11:58:43 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Out of curiosity, does Allegro pick up scroll wheel clicks as well (i.e. depressing the scroll wheel instead of rolling it)?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Sirocco)</author>
		<pubDate>Wed, 11 Oct 2006 18:55:53 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>
I think that counts as a middle button click?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Richard Phipps)</author>
		<pubDate>Wed, 11 Oct 2006 18:56:20 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Hmm... I&#39;ll have to try that out later and see. I&#39;ve got a few situations where that could come in handy.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Sirocco)</author>
		<pubDate>Wed, 11 Oct 2006 19:40:34 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>What the blue monster said.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Evert)</author>
		<pubDate>Wed, 11 Oct 2006 22:11:16 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
Out of curiosity, does Allegro pick up scroll wheel clicks as well (i.e. depressing the scroll wheel instead of rolling it)?
</p></div></div><p>
As in pressing the scroll wheel as a button? Yes, it does. Unless I&#39;m mistaken, just use mouse_b &amp; 4
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Dale M.A. Johnson)</author>
		<pubDate>Thu, 12 Oct 2006 01:42:57 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="source-code snippet"><div class="inner"><pre><span class="k1">while</span><span class="k2">(</span><span class="k3">!</span><a href="http://www.allegro.cc/manual/key" target="_blank"><span class="a">key</span></a><span class="k2">[</span>KEY_ESC<span class="k2">]</span><span class="k2">)</span><span class="k2">{</span>

   <span class="k1">if</span><span class="k2">(</span><a href="http://www.allegro.cc/manual/mouse_b" target="_blank"><span class="a">mouse_b</span></a><span class="k3">&amp;</span><span class="n">1</span><span class="k2">)</span><span class="k2">{</span>
      <span class="k1">if</span> <span class="k2">(</span> fare_deger_al<span class="k2">(</span><span class="k2">)</span><span class="k3">&gt;</span><span class="n">0</span><span class="k2">)</span>
         <a href="http://www.delorie.com/djgpp/doc/libc/libc_624.html" target="_blank">printf</a><span class="k2">(</span><span class="s">"%d\n"</span>,fare_deger_al<span class="k2">(</span><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_624.html" target="_blank">printf</a><span class="k2">(</span><span class="s">"Left side is pressed\n"</span><span class="k2">)</span><span class="k2">;</span>

   <span class="k1">if</span><span class="k2">(</span><a href="http://www.allegro.cc/manual/mouse_b" target="_blank"><span class="a">mouse_b</span></a><span class="k3">&amp;</span><span class="n">2</span><span class="k2">)</span>
      <a href="http://www.delorie.com/djgpp/doc/libc/libc_624.html" target="_blank">printf</a><span class="k2">(</span><span class="s">"Right side is pressed\n"</span><span class="k2">)</span><span class="k2">;</span>
   <a href="http://www.allegro.cc/manual/rest" target="_blank"><span class="a">rest</span></a><span class="k2">(</span><span class="n">10</span><span class="k2">)</span><span class="k2">;</span>
<span class="k2">}</span>
</pre></div></div><p>

First off, tell me what you think may be wrong with that?</p><p>...</p><p>Yup, its that printf in the middle there, which will be printed every single loop, as you forgot to put it inside the <i>{}</i>s for <i>mouse_b&amp;1</i>.</p><p>Indentation and proper formatting really, really helps.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thomas Fjellstrom)</author>
		<pubDate>Thu, 12 Oct 2006 01:56:12 +0000</pubDate>
	</item>
</rss>
