<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>fixed point help</title>
		<link>http://www.allegro.cc/forums/view/591115</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Sat, 21 Apr 2007 23:28:49 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Hi, I am trying to use rotate sprite and when I just do something like <span class="source-code"><a href="http://www.allegro.cc/manual/rotate_sprite" target="_blank"><span class="a">rotate_sprite</span></a><span class="k2">(</span>buffer, image, <span class="n">0</span>, <span class="n">0</span>, <a href="http://www.allegro.cc/manual/itofix" target="_blank"><span class="a">itofix</span></a><span class="k2">(</span>angle<span class="k2">)</span><span class="k2">;</span></span> it works fine, but if I try to make it rotate int the direction of the mouse like this<span class="source-code"><span class="k1">int</span> angle <span class="k3">=</span> <a href="http://www.delorie.com/djgpp/doc/libc/libc_50.html" target="_blank">atan2</a><span class="k2">(</span><span class="k1">int</span><span class="k2">(</span><a href="http://www.allegro.cc/manual/mouse_y" target="_blank"><span class="a">mouse_y</span></a><span class="k2">)</span>, <span class="k1">int</span><span class="k2">(</span><a href="http://www.allegro.cc/manual/mouse_x" target="_blank"><span class="a">mouse_x</span></a><span class="k2">)</span><span class="k2">)</span><span class="k2">;</span></span> it gives me the error </p><p>error: conversion from `int&#39; to non-scalar type `fix&#39; requested</p><p>Can someone help? <img src="http://www.allegro.cc/forums/smileys/huh.gif" alt="???" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (chaseC)</author>
		<pubDate>Sat, 21 Apr 2007 23:16:26 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>1) atan2() returns radians, so an integer wouldn&#39;t have been of much use anyway.<br />2) rotate_sprite() uses Allegro degrees, which are *128/&pi; to the radian, meaning even if you would have used a float and ftofix it wouldn&#39;t have worked the way you wanted it to.<br />3) The conflict is because you&#39;ve just met Allegro&#39;s Dreaded Fix Class<sup>TM</sup>, which overloads the regular trig functions. Include &lt;math.h&gt; <i>before</i> &lt;allegro.h&gt; to scare it off.</p><p>[EDIT]<br />But if you&#39;re sure you actually <i>do</i> want to used fixed point (honestly, there&#39;s really no need for them on any non-ancient machine), skip the evil overload.<br /><span class="source-code"><a href="http://www.allegro.cc/manual/fixed" target="_blank"><span class="a">fixed</span></a> angle <span class="k3">=</span> <a href="http://www.allegro.cc/manual/fixatan2" target="_blank"><span class="a">fixatan2</span></a><span class="k2">(</span><a href="http://www.allegro.cc/manual/mouse_y" target="_blank"><span class="a">mouse_y</span></a>, <a href="http://www.allegro.cc/manual/mouse_x" target="_blank"><span class="a">mouse_x</span></a><span class="k2">)</span><span class="k2">;</span></span>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (gnolam)</author>
		<pubDate>Sat, 21 Apr 2007 23:20:24 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Oh yeah, I forgot the 128/&amp;pi but it works now Thanks:)
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (chaseC)</author>
		<pubDate>Sat, 21 Apr 2007 23:28:49 +0000</pubDate>
	</item>
</rss>
