724 lines
50 KiB
HTML
724 lines
50 KiB
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
<head>
|
|
<title>SFML - Simple and Fast Multimedia Library</title>
|
|
<meta http-equiv="Content-Type" content="text/html;"/>
|
|
<meta charset="utf-8"/>
|
|
<!--<link rel='stylesheet' type='text/css' href="https://fonts.googleapis.com/css?family=Ubuntu:400,700,400italic"/>-->
|
|
<link rel="stylesheet" type="text/css" href="doxygen.css" title="default" media="screen,print" />
|
|
<script type="text/javascript" src="jquery.js"></script>
|
|
<script type="text/javascript" src="dynsections.js"></script>
|
|
</head>
|
|
<body>
|
|
<div id="banner-container">
|
|
<div id="banner">
|
|
<span id="sfml">SFML 2.5.1</span>
|
|
</div>
|
|
</div>
|
|
<div id="content">
|
|
<!-- Generated by Doxygen 1.8.14 -->
|
|
<div id="navrow1" class="tabs">
|
|
<ul class="tablist">
|
|
<li><a href="index.html"><span>Main Page</span></a></li>
|
|
<li><a href="pages.html"><span>Related Pages</span></a></li>
|
|
<li><a href="modules.html"><span>Modules</span></a></li>
|
|
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
|
|
<li class="current"><a href="annotated.html"><span>Classes</span></a></li>
|
|
<li><a href="files.html"><span>Files</span></a></li>
|
|
</ul>
|
|
</div>
|
|
<div id="navrow2" class="tabs2">
|
|
<ul class="tablist">
|
|
<li><a href="annotated.html"><span>Class List</span></a></li>
|
|
<li><a href="classes.html"><span>Class Index</span></a></li>
|
|
<li><a href="hierarchy.html"><span>Class Hierarchy</span></a></li>
|
|
<li><a href="functions.html"><span>Class Members</span></a></li>
|
|
</ul>
|
|
</div>
|
|
<div id="nav-path" class="navpath">
|
|
<ul>
|
|
<li class="navelem"><b>sf</b></li><li class="navelem"><a class="el" href="classsf_1_1Transformable.html">Transformable</a></li> </ul>
|
|
</div>
|
|
</div><!-- top -->
|
|
<div class="header">
|
|
<div class="summary">
|
|
<a href="#pub-methods">Public Member Functions</a> |
|
|
<a href="classsf_1_1Transformable-members.html">List of all members</a> </div>
|
|
<div class="headertitle">
|
|
<div class="title">sf::Transformable Class Reference<div class="ingroups"><a class="el" href="group__graphics.html">Graphics module</a></div></div> </div>
|
|
</div><!--header-->
|
|
<div class="contents">
|
|
|
|
<p>Decomposed transform defined by a position, a rotation and a scale.
|
|
<a href="classsf_1_1Transformable.html#details">More...</a></p>
|
|
|
|
<p><code>#include <<a class="el" href="Transformable_8hpp_source.html">Transformable.hpp</a>></code></p>
|
|
<div class="dynheader">
|
|
Inheritance diagram for sf::Transformable:</div>
|
|
<div class="dyncontent">
|
|
<div class="center">
|
|
<img src="classsf_1_1Transformable.png" usemap="#sf::Transformable_map" alt=""/>
|
|
<map id="sf::Transformable_map" name="sf::Transformable_map">
|
|
<area href="classsf_1_1Shape.html" title="Base class for textured shapes with outline. " alt="sf::Shape" shape="rect" coords="130,56,250,80"/>
|
|
<area href="classsf_1_1Sprite.html" title="Drawable representation of a texture, with its own transformations, color, etc. " alt="sf::Sprite" shape="rect" coords="260,56,380,80"/>
|
|
<area href="classsf_1_1Text.html" title="Graphical text that can be drawn to a render target. " alt="sf::Text" shape="rect" coords="390,56,510,80"/>
|
|
<area href="classsf_1_1CircleShape.html" title="Specialized shape representing a circle. " alt="sf::CircleShape" shape="rect" coords="0,112,120,136"/>
|
|
<area href="classsf_1_1ConvexShape.html" title="Specialized shape representing a convex polygon. " alt="sf::ConvexShape" shape="rect" coords="130,112,250,136"/>
|
|
<area href="classsf_1_1RectangleShape.html" title="Specialized shape representing a rectangle. " alt="sf::RectangleShape" shape="rect" coords="260,112,380,136"/>
|
|
</map>
|
|
</div></div>
|
|
<table class="memberdecls">
|
|
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
|
|
Public Member Functions</h2></td></tr>
|
|
<tr class="memitem:ae71710de0fef423121bab1c684954a2e"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classsf_1_1Transformable.html#ae71710de0fef423121bab1c684954a2e">Transformable</a> ()</td></tr>
|
|
<tr class="memdesc:ae71710de0fef423121bab1c684954a2e"><td class="mdescLeft"> </td><td class="mdescRight">Default constructor. <a href="#ae71710de0fef423121bab1c684954a2e">More...</a><br /></td></tr>
|
|
<tr class="separator:ae71710de0fef423121bab1c684954a2e"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:a43253abcb863195a673c2a347a7425cc"><td class="memItemLeft" align="right" valign="top">virtual </td><td class="memItemRight" valign="bottom"><a class="el" href="classsf_1_1Transformable.html#a43253abcb863195a673c2a347a7425cc">~Transformable</a> ()</td></tr>
|
|
<tr class="memdesc:a43253abcb863195a673c2a347a7425cc"><td class="mdescLeft"> </td><td class="mdescRight">Virtual destructor. <a href="#a43253abcb863195a673c2a347a7425cc">More...</a><br /></td></tr>
|
|
<tr class="separator:a43253abcb863195a673c2a347a7425cc"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:a4dbfb1a7c80688b0b4c477d706550208"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classsf_1_1Transformable.html#a4dbfb1a7c80688b0b4c477d706550208">setPosition</a> (float x, float y)</td></tr>
|
|
<tr class="memdesc:a4dbfb1a7c80688b0b4c477d706550208"><td class="mdescLeft"> </td><td class="mdescRight">set the position of the object <a href="#a4dbfb1a7c80688b0b4c477d706550208">More...</a><br /></td></tr>
|
|
<tr class="separator:a4dbfb1a7c80688b0b4c477d706550208"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:af1a42209ce2b5d3f07b00f917bcd8015"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classsf_1_1Transformable.html#af1a42209ce2b5d3f07b00f917bcd8015">setPosition</a> (const <a class="el" href="classsf_1_1Vector2.html">Vector2f</a> &position)</td></tr>
|
|
<tr class="memdesc:af1a42209ce2b5d3f07b00f917bcd8015"><td class="mdescLeft"> </td><td class="mdescRight">set the position of the object <a href="#af1a42209ce2b5d3f07b00f917bcd8015">More...</a><br /></td></tr>
|
|
<tr class="separator:af1a42209ce2b5d3f07b00f917bcd8015"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:a32baf2bf1a74699b03bf8c95030a38ed"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classsf_1_1Transformable.html#a32baf2bf1a74699b03bf8c95030a38ed">setRotation</a> (float angle)</td></tr>
|
|
<tr class="memdesc:a32baf2bf1a74699b03bf8c95030a38ed"><td class="mdescLeft"> </td><td class="mdescRight">set the orientation of the object <a href="#a32baf2bf1a74699b03bf8c95030a38ed">More...</a><br /></td></tr>
|
|
<tr class="separator:a32baf2bf1a74699b03bf8c95030a38ed"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:aaec50b46b3f41b054763304d1e727471"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classsf_1_1Transformable.html#aaec50b46b3f41b054763304d1e727471">setScale</a> (float factorX, float factorY)</td></tr>
|
|
<tr class="memdesc:aaec50b46b3f41b054763304d1e727471"><td class="mdescLeft"> </td><td class="mdescRight">set the scale factors of the object <a href="#aaec50b46b3f41b054763304d1e727471">More...</a><br /></td></tr>
|
|
<tr class="separator:aaec50b46b3f41b054763304d1e727471"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:a4c48a87f1626047e448f9c1a68ff167e"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classsf_1_1Transformable.html#a4c48a87f1626047e448f9c1a68ff167e">setScale</a> (const <a class="el" href="classsf_1_1Vector2.html">Vector2f</a> &factors)</td></tr>
|
|
<tr class="memdesc:a4c48a87f1626047e448f9c1a68ff167e"><td class="mdescLeft"> </td><td class="mdescRight">set the scale factors of the object <a href="#a4c48a87f1626047e448f9c1a68ff167e">More...</a><br /></td></tr>
|
|
<tr class="separator:a4c48a87f1626047e448f9c1a68ff167e"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:a56c67bd80aae8418d13fb96c034d25ec"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classsf_1_1Transformable.html#a56c67bd80aae8418d13fb96c034d25ec">setOrigin</a> (float x, float y)</td></tr>
|
|
<tr class="memdesc:a56c67bd80aae8418d13fb96c034d25ec"><td class="mdescLeft"> </td><td class="mdescRight">set the local origin of the object <a href="#a56c67bd80aae8418d13fb96c034d25ec">More...</a><br /></td></tr>
|
|
<tr class="separator:a56c67bd80aae8418d13fb96c034d25ec"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:aa93a835ffbf3bee2098dfbbc695a7f05"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classsf_1_1Transformable.html#aa93a835ffbf3bee2098dfbbc695a7f05">setOrigin</a> (const <a class="el" href="classsf_1_1Vector2.html">Vector2f</a> &origin)</td></tr>
|
|
<tr class="memdesc:aa93a835ffbf3bee2098dfbbc695a7f05"><td class="mdescLeft"> </td><td class="mdescRight">set the local origin of the object <a href="#aa93a835ffbf3bee2098dfbbc695a7f05">More...</a><br /></td></tr>
|
|
<tr class="separator:aa93a835ffbf3bee2098dfbbc695a7f05"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:a73f9739bc6e74db2cea154bc8e94ec46"><td class="memItemLeft" align="right" valign="top">const <a class="el" href="classsf_1_1Vector2.html">Vector2f</a> & </td><td class="memItemRight" valign="bottom"><a class="el" href="classsf_1_1Transformable.html#a73f9739bc6e74db2cea154bc8e94ec46">getPosition</a> () const</td></tr>
|
|
<tr class="memdesc:a73f9739bc6e74db2cea154bc8e94ec46"><td class="mdescLeft"> </td><td class="mdescRight">get the position of the object <a href="#a73f9739bc6e74db2cea154bc8e94ec46">More...</a><br /></td></tr>
|
|
<tr class="separator:a73f9739bc6e74db2cea154bc8e94ec46"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:aa00b5c5d4a06ac24a94dd72c56931d3a"><td class="memItemLeft" align="right" valign="top">float </td><td class="memItemRight" valign="bottom"><a class="el" href="classsf_1_1Transformable.html#aa00b5c5d4a06ac24a94dd72c56931d3a">getRotation</a> () const</td></tr>
|
|
<tr class="memdesc:aa00b5c5d4a06ac24a94dd72c56931d3a"><td class="mdescLeft"> </td><td class="mdescRight">get the orientation of the object <a href="#aa00b5c5d4a06ac24a94dd72c56931d3a">More...</a><br /></td></tr>
|
|
<tr class="separator:aa00b5c5d4a06ac24a94dd72c56931d3a"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:a73819fdea80ca8a06fad8a0067b4588c"><td class="memItemLeft" align="right" valign="top">const <a class="el" href="classsf_1_1Vector2.html">Vector2f</a> & </td><td class="memItemRight" valign="bottom"><a class="el" href="classsf_1_1Transformable.html#a73819fdea80ca8a06fad8a0067b4588c">getScale</a> () const</td></tr>
|
|
<tr class="memdesc:a73819fdea80ca8a06fad8a0067b4588c"><td class="mdescLeft"> </td><td class="mdescRight">get the current scale of the object <a href="#a73819fdea80ca8a06fad8a0067b4588c">More...</a><br /></td></tr>
|
|
<tr class="separator:a73819fdea80ca8a06fad8a0067b4588c"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:a37ea3500afac234814a43ce809ef264e"><td class="memItemLeft" align="right" valign="top">const <a class="el" href="classsf_1_1Vector2.html">Vector2f</a> & </td><td class="memItemRight" valign="bottom"><a class="el" href="classsf_1_1Transformable.html#a37ea3500afac234814a43ce809ef264e">getOrigin</a> () const</td></tr>
|
|
<tr class="memdesc:a37ea3500afac234814a43ce809ef264e"><td class="mdescLeft"> </td><td class="mdescRight">get the local origin of the object <a href="#a37ea3500afac234814a43ce809ef264e">More...</a><br /></td></tr>
|
|
<tr class="separator:a37ea3500afac234814a43ce809ef264e"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:a86b461d6a941ad390c2ad8b6a4a20391"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classsf_1_1Transformable.html#a86b461d6a941ad390c2ad8b6a4a20391">move</a> (float offsetX, float offsetY)</td></tr>
|
|
<tr class="memdesc:a86b461d6a941ad390c2ad8b6a4a20391"><td class="mdescLeft"> </td><td class="mdescRight">Move the object by a given offset. <a href="#a86b461d6a941ad390c2ad8b6a4a20391">More...</a><br /></td></tr>
|
|
<tr class="separator:a86b461d6a941ad390c2ad8b6a4a20391"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:ab9ca691522f6ddc1a40406849b87c469"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classsf_1_1Transformable.html#ab9ca691522f6ddc1a40406849b87c469">move</a> (const <a class="el" href="classsf_1_1Vector2.html">Vector2f</a> &offset)</td></tr>
|
|
<tr class="memdesc:ab9ca691522f6ddc1a40406849b87c469"><td class="mdescLeft"> </td><td class="mdescRight">Move the object by a given offset. <a href="#ab9ca691522f6ddc1a40406849b87c469">More...</a><br /></td></tr>
|
|
<tr class="separator:ab9ca691522f6ddc1a40406849b87c469"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:af8a5ffddc0d93f238fee3bf8efe1ebda"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classsf_1_1Transformable.html#af8a5ffddc0d93f238fee3bf8efe1ebda">rotate</a> (float angle)</td></tr>
|
|
<tr class="memdesc:af8a5ffddc0d93f238fee3bf8efe1ebda"><td class="mdescLeft"> </td><td class="mdescRight">Rotate the object. <a href="#af8a5ffddc0d93f238fee3bf8efe1ebda">More...</a><br /></td></tr>
|
|
<tr class="separator:af8a5ffddc0d93f238fee3bf8efe1ebda"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:a3de0c6d8957f3cf318092f3f60656391"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classsf_1_1Transformable.html#a3de0c6d8957f3cf318092f3f60656391">scale</a> (float factorX, float factorY)</td></tr>
|
|
<tr class="memdesc:a3de0c6d8957f3cf318092f3f60656391"><td class="mdescLeft"> </td><td class="mdescRight">Scale the object. <a href="#a3de0c6d8957f3cf318092f3f60656391">More...</a><br /></td></tr>
|
|
<tr class="separator:a3de0c6d8957f3cf318092f3f60656391"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:adecaa6c69b1f27dd5194b067d96bb694"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classsf_1_1Transformable.html#adecaa6c69b1f27dd5194b067d96bb694">scale</a> (const <a class="el" href="classsf_1_1Vector2.html">Vector2f</a> &factor)</td></tr>
|
|
<tr class="memdesc:adecaa6c69b1f27dd5194b067d96bb694"><td class="mdescLeft"> </td><td class="mdescRight">Scale the object. <a href="#adecaa6c69b1f27dd5194b067d96bb694">More...</a><br /></td></tr>
|
|
<tr class="separator:adecaa6c69b1f27dd5194b067d96bb694"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:a7f7c3f0bab3f162b13613904fbdbb9ad"><td class="memItemLeft" align="right" valign="top">const <a class="el" href="classsf_1_1Transform.html">Transform</a> & </td><td class="memItemRight" valign="bottom"><a class="el" href="classsf_1_1Transformable.html#a7f7c3f0bab3f162b13613904fbdbb9ad">getTransform</a> () const</td></tr>
|
|
<tr class="memdesc:a7f7c3f0bab3f162b13613904fbdbb9ad"><td class="mdescLeft"> </td><td class="mdescRight">get the combined transform of the object <a href="#a7f7c3f0bab3f162b13613904fbdbb9ad">More...</a><br /></td></tr>
|
|
<tr class="separator:a7f7c3f0bab3f162b13613904fbdbb9ad"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:ab18b25f51263252ff3811465eb7e9fb1"><td class="memItemLeft" align="right" valign="top">const <a class="el" href="classsf_1_1Transform.html">Transform</a> & </td><td class="memItemRight" valign="bottom"><a class="el" href="classsf_1_1Transformable.html#ab18b25f51263252ff3811465eb7e9fb1">getInverseTransform</a> () const</td></tr>
|
|
<tr class="memdesc:ab18b25f51263252ff3811465eb7e9fb1"><td class="mdescLeft"> </td><td class="mdescRight">get the inverse of the combined transform of the object <a href="#ab18b25f51263252ff3811465eb7e9fb1">More...</a><br /></td></tr>
|
|
<tr class="separator:ab18b25f51263252ff3811465eb7e9fb1"><td class="memSeparator" colspan="2"> </td></tr>
|
|
</table>
|
|
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
|
|
<div class="textblock"><p>Decomposed transform defined by a position, a rotation and a scale. </p>
|
|
<p>This class is provided for convenience, on top of <a class="el" href="classsf_1_1Transform.html" title="Define a 3x3 transform matrix. ">sf::Transform</a>.</p>
|
|
<p><a class="el" href="classsf_1_1Transform.html" title="Define a 3x3 transform matrix. ">sf::Transform</a>, as a low-level class, offers a great level of flexibility but it is not always convenient to manage. Indeed, one can easily combine any kind of operation, such as a translation followed by a rotation followed by a scaling, but once the result transform is built, there's no way to go backward and, let's say, change only the rotation without modifying the translation and scaling. The entire transform must be recomputed, which means that you need to retrieve the initial translation and scale factors as well, and combine them the same way you did before updating the rotation. This is a tedious operation, and it requires to store all the individual components of the final transform.</p>
|
|
<p>That's exactly what <a class="el" href="classsf_1_1Transformable.html" title="Decomposed transform defined by a position, a rotation and a scale. ">sf::Transformable</a> was written for: it hides these variables and the composed transform behind an easy to use interface. You can set or get any of the individual components without worrying about the others. It also provides the composed transform (as a <a class="el" href="classsf_1_1Transform.html" title="Define a 3x3 transform matrix. ">sf::Transform</a>), and keeps it up-to-date.</p>
|
|
<p>In addition to the position, rotation and scale, <a class="el" href="classsf_1_1Transformable.html" title="Decomposed transform defined by a position, a rotation and a scale. ">sf::Transformable</a> provides an "origin" component, which represents the local origin of the three other components. Let's take an example with a 10x10 pixels sprite. By default, the sprite is positioned/rotated/scaled relatively to its top-left corner, because it is the local point (0, 0). But if we change the origin to be (5, 5), the sprite will be positioned/rotated/scaled around its center instead. And if we set the origin to (10, 10), it will be transformed around its bottom-right corner.</p>
|
|
<p>To keep the <a class="el" href="classsf_1_1Transformable.html" title="Decomposed transform defined by a position, a rotation and a scale. ">sf::Transformable</a> class simple, there's only one origin for all the components. You cannot position the sprite relatively to its top-left corner while rotating it around its center, for example. To do such things, use <a class="el" href="classsf_1_1Transform.html" title="Define a 3x3 transform matrix. ">sf::Transform</a> directly.</p>
|
|
<p><a class="el" href="classsf_1_1Transformable.html" title="Decomposed transform defined by a position, a rotation and a scale. ">sf::Transformable</a> can be used as a base class. It is often combined with <a class="el" href="classsf_1_1Drawable.html" title="Abstract base class for objects that can be drawn to a render target. ">sf::Drawable</a> – that's what SFML's sprites, texts and shapes do. </p><div class="fragment"><div class="line"><span class="keyword">class </span>MyEntity : <span class="keyword">public</span> <a class="code" href="classsf_1_1Transformable.html">sf::Transformable</a>, <span class="keyword">public</span> <a class="code" href="classsf_1_1Drawable.html">sf::Drawable</a></div><div class="line">{</div><div class="line"> <span class="keyword">virtual</span> <span class="keywordtype">void</span> draw(<a class="code" href="classsf_1_1RenderTarget.html">sf::RenderTarget</a>& target, <a class="code" href="classsf_1_1RenderStates.html">sf::RenderStates</a> states)<span class="keyword"> const</span></div><div class="line"><span class="keyword"> </span>{</div><div class="line"> states.<a class="code" href="classsf_1_1RenderStates.html#a1f737981a0f2f0d4bb8dac866a8d1149">transform</a> *= <a class="code" href="classsf_1_1Transformable.html#a7f7c3f0bab3f162b13613904fbdbb9ad">getTransform</a>();</div><div class="line"> target.<a class="code" href="classsf_1_1RenderTarget.html#a12417a3bcc245c41d957b29583556f39">draw</a>(..., states);</div><div class="line"> }</div><div class="line">};</div><div class="line"></div><div class="line">MyEntity entity;</div><div class="line">entity.setPosition(10, 20);</div><div class="line">entity.setRotation(45);</div><div class="line">window.draw(entity);</div></div><!-- fragment --><p>It can also be used as a member, if you don't want to use its API directly (because you don't need all its functions, or you have different naming conventions for example). </p><div class="fragment"><div class="line"><span class="keyword">class </span>MyEntity</div><div class="line">{</div><div class="line"><span class="keyword">public</span>:</div><div class="line"> <span class="keywordtype">void</span> SetPosition(<span class="keyword">const</span> MyVector& v)</div><div class="line"> {</div><div class="line"> myTransform.setPosition(v.x(), v.y());</div><div class="line"> }</div><div class="line"></div><div class="line"> <span class="keywordtype">void</span> Draw(<a class="code" href="classsf_1_1RenderTarget.html">sf::RenderTarget</a>& target)<span class="keyword"> const</span></div><div class="line"><span class="keyword"> </span>{</div><div class="line"> target.<a class="code" href="classsf_1_1RenderTarget.html#a12417a3bcc245c41d957b29583556f39">draw</a>(..., myTransform.getTransform());</div><div class="line"> }</div><div class="line"></div><div class="line"><span class="keyword">private</span>:</div><div class="line"> <a class="code" href="classsf_1_1Transformable.html">sf::Transformable</a> myTransform;</div><div class="line">};</div></div><!-- fragment --><p>A note on coordinates and undistorted rendering: <br />
|
|
By default, SFML (or more exactly, OpenGL) may interpolate drawable objects such as sprites or texts when rendering. While this allows transitions like slow movements or rotations to appear smoothly, it can lead to unwanted results in some cases, for example blurred or distorted objects. In order to render a <a class="el" href="classsf_1_1Drawable.html" title="Abstract base class for objects that can be drawn to a render target. ">sf::Drawable</a> object pixel-perfectly, make sure the involved coordinates allow a 1:1 mapping of pixels in the window to texels (pixels in the texture). More specifically, this means:</p><ul>
|
|
<li>The object's position, origin and scale have no fractional part</li>
|
|
<li>The object's and the view's rotation are a multiple of 90 degrees</li>
|
|
<li>The view's center and size have no fractional part</li>
|
|
</ul>
|
|
<dl class="section see"><dt>See also</dt><dd><a class="el" href="classsf_1_1Transform.html" title="Define a 3x3 transform matrix. ">sf::Transform</a> </dd></dl>
|
|
|
|
<p class="definition">Definition at line <a class="el" href="Transformable_8hpp_source.html#l00041">41</a> of file <a class="el" href="Transformable_8hpp_source.html">Transformable.hpp</a>.</p>
|
|
</div><h2 class="groupheader">Constructor & Destructor Documentation</h2>
|
|
<a id="ae71710de0fef423121bab1c684954a2e"></a>
|
|
<h2 class="memtitle"><span class="permalink"><a href="#ae71710de0fef423121bab1c684954a2e">◆ </a></span>Transformable()</h2>
|
|
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">sf::Transformable::Transformable </td>
|
|
<td>(</td>
|
|
<td class="paramname"></td><td>)</td>
|
|
<td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>Default constructor. </p>
|
|
|
|
</div>
|
|
</div>
|
|
<a id="a43253abcb863195a673c2a347a7425cc"></a>
|
|
<h2 class="memtitle"><span class="permalink"><a href="#a43253abcb863195a673c2a347a7425cc">◆ </a></span>~Transformable()</h2>
|
|
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="mlabels">
|
|
<tr>
|
|
<td class="mlabels-left">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">virtual sf::Transformable::~Transformable </td>
|
|
<td>(</td>
|
|
<td class="paramname"></td><td>)</td>
|
|
<td></td>
|
|
</tr>
|
|
</table>
|
|
</td>
|
|
<td class="mlabels-right">
|
|
<span class="mlabels"><span class="mlabel">virtual</span></span> </td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>Virtual destructor. </p>
|
|
|
|
</div>
|
|
</div>
|
|
<h2 class="groupheader">Member Function Documentation</h2>
|
|
<a id="ab18b25f51263252ff3811465eb7e9fb1"></a>
|
|
<h2 class="memtitle"><span class="permalink"><a href="#ab18b25f51263252ff3811465eb7e9fb1">◆ </a></span>getInverseTransform()</h2>
|
|
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">const <a class="el" href="classsf_1_1Transform.html">Transform</a>& sf::Transformable::getInverseTransform </td>
|
|
<td>(</td>
|
|
<td class="paramname"></td><td>)</td>
|
|
<td> const</td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>get the inverse of the combined transform of the object </p>
|
|
<dl class="section return"><dt>Returns</dt><dd>Inverse of the combined transformations applied to the object</dd></dl>
|
|
<dl class="section see"><dt>See also</dt><dd><a class="el" href="classsf_1_1Transformable.html#a7f7c3f0bab3f162b13613904fbdbb9ad" title="get the combined transform of the object ">getTransform</a> </dd></dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a id="a37ea3500afac234814a43ce809ef264e"></a>
|
|
<h2 class="memtitle"><span class="permalink"><a href="#a37ea3500afac234814a43ce809ef264e">◆ </a></span>getOrigin()</h2>
|
|
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">const <a class="el" href="classsf_1_1Vector2.html">Vector2f</a>& sf::Transformable::getOrigin </td>
|
|
<td>(</td>
|
|
<td class="paramname"></td><td>)</td>
|
|
<td> const</td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>get the local origin of the object </p>
|
|
<dl class="section return"><dt>Returns</dt><dd>Current origin</dd></dl>
|
|
<dl class="section see"><dt>See also</dt><dd><a class="el" href="classsf_1_1Transformable.html#a56c67bd80aae8418d13fb96c034d25ec" title="set the local origin of the object ">setOrigin</a> </dd></dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a id="a73f9739bc6e74db2cea154bc8e94ec46"></a>
|
|
<h2 class="memtitle"><span class="permalink"><a href="#a73f9739bc6e74db2cea154bc8e94ec46">◆ </a></span>getPosition()</h2>
|
|
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">const <a class="el" href="classsf_1_1Vector2.html">Vector2f</a>& sf::Transformable::getPosition </td>
|
|
<td>(</td>
|
|
<td class="paramname"></td><td>)</td>
|
|
<td> const</td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>get the position of the object </p>
|
|
<dl class="section return"><dt>Returns</dt><dd>Current position</dd></dl>
|
|
<dl class="section see"><dt>See also</dt><dd><a class="el" href="classsf_1_1Transformable.html#a4dbfb1a7c80688b0b4c477d706550208" title="set the position of the object ">setPosition</a> </dd></dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a id="aa00b5c5d4a06ac24a94dd72c56931d3a"></a>
|
|
<h2 class="memtitle"><span class="permalink"><a href="#aa00b5c5d4a06ac24a94dd72c56931d3a">◆ </a></span>getRotation()</h2>
|
|
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">float sf::Transformable::getRotation </td>
|
|
<td>(</td>
|
|
<td class="paramname"></td><td>)</td>
|
|
<td> const</td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>get the orientation of the object </p>
|
|
<p>The rotation is always in the range [0, 360].</p>
|
|
<dl class="section return"><dt>Returns</dt><dd>Current rotation, in degrees</dd></dl>
|
|
<dl class="section see"><dt>See also</dt><dd><a class="el" href="classsf_1_1Transformable.html#a32baf2bf1a74699b03bf8c95030a38ed" title="set the orientation of the object ">setRotation</a> </dd></dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a id="a73819fdea80ca8a06fad8a0067b4588c"></a>
|
|
<h2 class="memtitle"><span class="permalink"><a href="#a73819fdea80ca8a06fad8a0067b4588c">◆ </a></span>getScale()</h2>
|
|
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">const <a class="el" href="classsf_1_1Vector2.html">Vector2f</a>& sf::Transformable::getScale </td>
|
|
<td>(</td>
|
|
<td class="paramname"></td><td>)</td>
|
|
<td> const</td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>get the current scale of the object </p>
|
|
<dl class="section return"><dt>Returns</dt><dd>Current scale factors</dd></dl>
|
|
<dl class="section see"><dt>See also</dt><dd><a class="el" href="classsf_1_1Transformable.html#aaec50b46b3f41b054763304d1e727471" title="set the scale factors of the object ">setScale</a> </dd></dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a id="a7f7c3f0bab3f162b13613904fbdbb9ad"></a>
|
|
<h2 class="memtitle"><span class="permalink"><a href="#a7f7c3f0bab3f162b13613904fbdbb9ad">◆ </a></span>getTransform()</h2>
|
|
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">const <a class="el" href="classsf_1_1Transform.html">Transform</a>& sf::Transformable::getTransform </td>
|
|
<td>(</td>
|
|
<td class="paramname"></td><td>)</td>
|
|
<td> const</td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>get the combined transform of the object </p>
|
|
<dl class="section return"><dt>Returns</dt><dd><a class="el" href="classsf_1_1Transform.html" title="Define a 3x3 transform matrix. ">Transform</a> combining the position/rotation/scale/origin of the object</dd></dl>
|
|
<dl class="section see"><dt>See also</dt><dd><a class="el" href="classsf_1_1Transformable.html#ab18b25f51263252ff3811465eb7e9fb1" title="get the inverse of the combined transform of the object ">getInverseTransform</a> </dd></dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a id="a86b461d6a941ad390c2ad8b6a4a20391"></a>
|
|
<h2 class="memtitle"><span class="permalink"><a href="#a86b461d6a941ad390c2ad8b6a4a20391">◆ </a></span>move() <span class="overload">[1/2]</span></h2>
|
|
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">void sf::Transformable::move </td>
|
|
<td>(</td>
|
|
<td class="paramtype">float </td>
|
|
<td class="paramname"><em>offsetX</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">float </td>
|
|
<td class="paramname"><em>offsetY</em> </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>)</td>
|
|
<td></td><td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>Move the object by a given offset. </p>
|
|
<p>This function adds to the current position of the object, unlike setPosition which overwrites it. Thus, it is equivalent to the following code: </p><div class="fragment"><div class="line"><a class="code" href="classsf_1_1Vector2.html">sf::Vector2f</a> pos = <span class="keywordtype">object</span>.getPosition();</div><div class="line"><span class="keywordtype">object</span>.setPosition(pos.<a class="code" href="classsf_1_1Vector2.html#a1e6ad77fa155f3753bfb92699bd28141">x</a> + offsetX, pos.<a class="code" href="classsf_1_1Vector2.html#a420f2481b015f4eb929c75f2af564299">y</a> + offsetY);</div></div><!-- fragment --><dl class="params"><dt>Parameters</dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramname">offsetX</td><td>X offset </td></tr>
|
|
<tr><td class="paramname">offsetY</td><td>Y offset</td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="section see"><dt>See also</dt><dd><a class="el" href="classsf_1_1Transformable.html#a4dbfb1a7c80688b0b4c477d706550208" title="set the position of the object ">setPosition</a> </dd></dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a id="ab9ca691522f6ddc1a40406849b87c469"></a>
|
|
<h2 class="memtitle"><span class="permalink"><a href="#ab9ca691522f6ddc1a40406849b87c469">◆ </a></span>move() <span class="overload">[2/2]</span></h2>
|
|
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">void sf::Transformable::move </td>
|
|
<td>(</td>
|
|
<td class="paramtype">const <a class="el" href="classsf_1_1Vector2.html">Vector2f</a> & </td>
|
|
<td class="paramname"><em>offset</em></td><td>)</td>
|
|
<td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>Move the object by a given offset. </p>
|
|
<p>This function adds to the current position of the object, unlike setPosition which overwrites it. Thus, it is equivalent to the following code: </p><div class="fragment"><div class="line"><span class="keywordtype">object</span>.setPosition(<span class="keywordtype">object</span>.<a class="code" href="classsf_1_1Transformable.html#a73f9739bc6e74db2cea154bc8e94ec46">getPosition</a>() + offset);</div></div><!-- fragment --><dl class="params"><dt>Parameters</dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramname">offset</td><td>Offset</td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="section see"><dt>See also</dt><dd><a class="el" href="classsf_1_1Transformable.html#a4dbfb1a7c80688b0b4c477d706550208" title="set the position of the object ">setPosition</a> </dd></dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a id="af8a5ffddc0d93f238fee3bf8efe1ebda"></a>
|
|
<h2 class="memtitle"><span class="permalink"><a href="#af8a5ffddc0d93f238fee3bf8efe1ebda">◆ </a></span>rotate()</h2>
|
|
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">void sf::Transformable::rotate </td>
|
|
<td>(</td>
|
|
<td class="paramtype">float </td>
|
|
<td class="paramname"><em>angle</em></td><td>)</td>
|
|
<td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>Rotate the object. </p>
|
|
<p>This function adds to the current rotation of the object, unlike setRotation which overwrites it. Thus, it is equivalent to the following code: </p><div class="fragment"><div class="line"><span class="keywordtype">object</span>.setRotation(<span class="keywordtype">object</span>.<a class="code" href="classsf_1_1Transformable.html#aa00b5c5d4a06ac24a94dd72c56931d3a">getRotation</a>() + angle);</div></div><!-- fragment --><dl class="params"><dt>Parameters</dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramname">angle</td><td>Angle of rotation, in degrees </td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a id="a3de0c6d8957f3cf318092f3f60656391"></a>
|
|
<h2 class="memtitle"><span class="permalink"><a href="#a3de0c6d8957f3cf318092f3f60656391">◆ </a></span>scale() <span class="overload">[1/2]</span></h2>
|
|
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">void sf::Transformable::scale </td>
|
|
<td>(</td>
|
|
<td class="paramtype">float </td>
|
|
<td class="paramname"><em>factorX</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">float </td>
|
|
<td class="paramname"><em>factorY</em> </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>)</td>
|
|
<td></td><td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>Scale the object. </p>
|
|
<p>This function multiplies the current scale of the object, unlike setScale which overwrites it. Thus, it is equivalent to the following code: </p><div class="fragment"><div class="line"><a class="code" href="classsf_1_1Vector2.html">sf::Vector2f</a> <a class="code" href="classsf_1_1Transformable.html#a3de0c6d8957f3cf318092f3f60656391">scale</a> = <span class="keywordtype">object</span>.getScale();</div><div class="line"><span class="keywordtype">object</span>.setScale(<a class="code" href="classsf_1_1Transformable.html#a3de0c6d8957f3cf318092f3f60656391">scale</a>.x * factorX, <a class="code" href="classsf_1_1Transformable.html#a3de0c6d8957f3cf318092f3f60656391">scale</a>.y * factorY);</div></div><!-- fragment --><dl class="params"><dt>Parameters</dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramname">factorX</td><td>Horizontal scale factor </td></tr>
|
|
<tr><td class="paramname">factorY</td><td>Vertical scale factor</td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="section see"><dt>See also</dt><dd><a class="el" href="classsf_1_1Transformable.html#aaec50b46b3f41b054763304d1e727471" title="set the scale factors of the object ">setScale</a> </dd></dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a id="adecaa6c69b1f27dd5194b067d96bb694"></a>
|
|
<h2 class="memtitle"><span class="permalink"><a href="#adecaa6c69b1f27dd5194b067d96bb694">◆ </a></span>scale() <span class="overload">[2/2]</span></h2>
|
|
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">void sf::Transformable::scale </td>
|
|
<td>(</td>
|
|
<td class="paramtype">const <a class="el" href="classsf_1_1Vector2.html">Vector2f</a> & </td>
|
|
<td class="paramname"><em>factor</em></td><td>)</td>
|
|
<td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>Scale the object. </p>
|
|
<p>This function multiplies the current scale of the object, unlike setScale which overwrites it. Thus, it is equivalent to the following code: </p><div class="fragment"><div class="line"><a class="code" href="classsf_1_1Vector2.html">sf::Vector2f</a> <a class="code" href="classsf_1_1Transformable.html#a3de0c6d8957f3cf318092f3f60656391">scale</a> = <span class="keywordtype">object</span>.getScale();</div><div class="line"><span class="keywordtype">object</span>.setScale(<a class="code" href="classsf_1_1Transformable.html#a3de0c6d8957f3cf318092f3f60656391">scale</a>.x * factor.x, <a class="code" href="classsf_1_1Transformable.html#a3de0c6d8957f3cf318092f3f60656391">scale</a>.y * factor.y);</div></div><!-- fragment --><dl class="params"><dt>Parameters</dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramname">factor</td><td>Scale factors</td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="section see"><dt>See also</dt><dd><a class="el" href="classsf_1_1Transformable.html#aaec50b46b3f41b054763304d1e727471" title="set the scale factors of the object ">setScale</a> </dd></dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a id="a56c67bd80aae8418d13fb96c034d25ec"></a>
|
|
<h2 class="memtitle"><span class="permalink"><a href="#a56c67bd80aae8418d13fb96c034d25ec">◆ </a></span>setOrigin() <span class="overload">[1/2]</span></h2>
|
|
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">void sf::Transformable::setOrigin </td>
|
|
<td>(</td>
|
|
<td class="paramtype">float </td>
|
|
<td class="paramname"><em>x</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">float </td>
|
|
<td class="paramname"><em>y</em> </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>)</td>
|
|
<td></td><td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>set the local origin of the object </p>
|
|
<p>The origin of an object defines the center point for all transformations (position, scale, rotation). The coordinates of this point must be relative to the top-left corner of the object, and ignore all transformations (position, scale, rotation). The default origin of a transformable object is (0, 0).</p>
|
|
<dl class="params"><dt>Parameters</dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramname">x</td><td>X coordinate of the new origin </td></tr>
|
|
<tr><td class="paramname">y</td><td>Y coordinate of the new origin</td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="section see"><dt>See also</dt><dd><a class="el" href="classsf_1_1Transformable.html#a37ea3500afac234814a43ce809ef264e" title="get the local origin of the object ">getOrigin</a> </dd></dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a id="aa93a835ffbf3bee2098dfbbc695a7f05"></a>
|
|
<h2 class="memtitle"><span class="permalink"><a href="#aa93a835ffbf3bee2098dfbbc695a7f05">◆ </a></span>setOrigin() <span class="overload">[2/2]</span></h2>
|
|
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">void sf::Transformable::setOrigin </td>
|
|
<td>(</td>
|
|
<td class="paramtype">const <a class="el" href="classsf_1_1Vector2.html">Vector2f</a> & </td>
|
|
<td class="paramname"><em>origin</em></td><td>)</td>
|
|
<td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>set the local origin of the object </p>
|
|
<p>The origin of an object defines the center point for all transformations (position, scale, rotation). The coordinates of this point must be relative to the top-left corner of the object, and ignore all transformations (position, scale, rotation). The default origin of a transformable object is (0, 0).</p>
|
|
<dl class="params"><dt>Parameters</dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramname">origin</td><td>New origin</td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="section see"><dt>See also</dt><dd><a class="el" href="classsf_1_1Transformable.html#a37ea3500afac234814a43ce809ef264e" title="get the local origin of the object ">getOrigin</a> </dd></dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a id="a4dbfb1a7c80688b0b4c477d706550208"></a>
|
|
<h2 class="memtitle"><span class="permalink"><a href="#a4dbfb1a7c80688b0b4c477d706550208">◆ </a></span>setPosition() <span class="overload">[1/2]</span></h2>
|
|
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">void sf::Transformable::setPosition </td>
|
|
<td>(</td>
|
|
<td class="paramtype">float </td>
|
|
<td class="paramname"><em>x</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">float </td>
|
|
<td class="paramname"><em>y</em> </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>)</td>
|
|
<td></td><td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>set the position of the object </p>
|
|
<p>This function completely overwrites the previous position. See the move function to apply an offset based on the previous position instead. The default position of a transformable object is (0, 0).</p>
|
|
<dl class="params"><dt>Parameters</dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramname">x</td><td>X coordinate of the new position </td></tr>
|
|
<tr><td class="paramname">y</td><td>Y coordinate of the new position</td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="section see"><dt>See also</dt><dd><a class="el" href="classsf_1_1Transformable.html#a86b461d6a941ad390c2ad8b6a4a20391" title="Move the object by a given offset. ">move</a>, <a class="el" href="classsf_1_1Transformable.html#a73f9739bc6e74db2cea154bc8e94ec46" title="get the position of the object ">getPosition</a> </dd></dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a id="af1a42209ce2b5d3f07b00f917bcd8015"></a>
|
|
<h2 class="memtitle"><span class="permalink"><a href="#af1a42209ce2b5d3f07b00f917bcd8015">◆ </a></span>setPosition() <span class="overload">[2/2]</span></h2>
|
|
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">void sf::Transformable::setPosition </td>
|
|
<td>(</td>
|
|
<td class="paramtype">const <a class="el" href="classsf_1_1Vector2.html">Vector2f</a> & </td>
|
|
<td class="paramname"><em>position</em></td><td>)</td>
|
|
<td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>set the position of the object </p>
|
|
<p>This function completely overwrites the previous position. See the move function to apply an offset based on the previous position instead. The default position of a transformable object is (0, 0).</p>
|
|
<dl class="params"><dt>Parameters</dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramname">position</td><td>New position</td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="section see"><dt>See also</dt><dd><a class="el" href="classsf_1_1Transformable.html#a86b461d6a941ad390c2ad8b6a4a20391" title="Move the object by a given offset. ">move</a>, <a class="el" href="classsf_1_1Transformable.html#a73f9739bc6e74db2cea154bc8e94ec46" title="get the position of the object ">getPosition</a> </dd></dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a id="a32baf2bf1a74699b03bf8c95030a38ed"></a>
|
|
<h2 class="memtitle"><span class="permalink"><a href="#a32baf2bf1a74699b03bf8c95030a38ed">◆ </a></span>setRotation()</h2>
|
|
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">void sf::Transformable::setRotation </td>
|
|
<td>(</td>
|
|
<td class="paramtype">float </td>
|
|
<td class="paramname"><em>angle</em></td><td>)</td>
|
|
<td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>set the orientation of the object </p>
|
|
<p>This function completely overwrites the previous rotation. See the rotate function to add an angle based on the previous rotation instead. The default rotation of a transformable object is 0.</p>
|
|
<dl class="params"><dt>Parameters</dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramname">angle</td><td>New rotation, in degrees</td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="section see"><dt>See also</dt><dd><a class="el" href="classsf_1_1Transformable.html#af8a5ffddc0d93f238fee3bf8efe1ebda" title="Rotate the object. ">rotate</a>, <a class="el" href="classsf_1_1Transformable.html#aa00b5c5d4a06ac24a94dd72c56931d3a" title="get the orientation of the object ">getRotation</a> </dd></dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a id="aaec50b46b3f41b054763304d1e727471"></a>
|
|
<h2 class="memtitle"><span class="permalink"><a href="#aaec50b46b3f41b054763304d1e727471">◆ </a></span>setScale() <span class="overload">[1/2]</span></h2>
|
|
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">void sf::Transformable::setScale </td>
|
|
<td>(</td>
|
|
<td class="paramtype">float </td>
|
|
<td class="paramname"><em>factorX</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">float </td>
|
|
<td class="paramname"><em>factorY</em> </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>)</td>
|
|
<td></td><td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>set the scale factors of the object </p>
|
|
<p>This function completely overwrites the previous scale. See the scale function to add a factor based on the previous scale instead. The default scale of a transformable object is (1, 1).</p>
|
|
<dl class="params"><dt>Parameters</dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramname">factorX</td><td>New horizontal scale factor </td></tr>
|
|
<tr><td class="paramname">factorY</td><td>New vertical scale factor</td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="section see"><dt>See also</dt><dd><a class="el" href="classsf_1_1Transformable.html#a3de0c6d8957f3cf318092f3f60656391" title="Scale the object. ">scale</a>, <a class="el" href="classsf_1_1Transformable.html#a73819fdea80ca8a06fad8a0067b4588c" title="get the current scale of the object ">getScale</a> </dd></dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a id="a4c48a87f1626047e448f9c1a68ff167e"></a>
|
|
<h2 class="memtitle"><span class="permalink"><a href="#a4c48a87f1626047e448f9c1a68ff167e">◆ </a></span>setScale() <span class="overload">[2/2]</span></h2>
|
|
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">void sf::Transformable::setScale </td>
|
|
<td>(</td>
|
|
<td class="paramtype">const <a class="el" href="classsf_1_1Vector2.html">Vector2f</a> & </td>
|
|
<td class="paramname"><em>factors</em></td><td>)</td>
|
|
<td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>set the scale factors of the object </p>
|
|
<p>This function completely overwrites the previous scale. See the scale function to add a factor based on the previous scale instead. The default scale of a transformable object is (1, 1).</p>
|
|
<dl class="params"><dt>Parameters</dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramname">factors</td><td>New scale factors</td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="section see"><dt>See also</dt><dd><a class="el" href="classsf_1_1Transformable.html#a3de0c6d8957f3cf318092f3f60656391" title="Scale the object. ">scale</a>, <a class="el" href="classsf_1_1Transformable.html#a73819fdea80ca8a06fad8a0067b4588c" title="get the current scale of the object ">getScale</a> </dd></dl>
|
|
|
|
</div>
|
|
</div>
|
|
<hr/>The documentation for this class was generated from the following file:<ul>
|
|
<li><a class="el" href="Transformable_8hpp_source.html">Transformable.hpp</a></li>
|
|
</ul>
|
|
</div><!-- contents -->
|
|
</div>
|
|
<div id="footer-container">
|
|
<div id="footer">
|
|
SFML is licensed under the terms and conditions of the <a href="https://www.sfml-dev.org/license.php">zlib/png license</a>.<br>
|
|
Copyright © Laurent Gomila ::
|
|
Documentation generated by <a href="http://www.doxygen.org/" title="doxygen website">doxygen</a> ::
|
|
</div>
|
|
</div>
|
|
</body>
|
|
</html>
|