vectozavr-shooter/SFML-VS32/doc/html/classsf_1_1Drawable.html

192 lines
13 KiB
HTML
Raw Normal View History

2021-10-09 13:41:12 +03:00
<!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&#160;Page</span></a></li>
<li><a href="pages.html"><span>Related&#160;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&#160;List</span></a></li>
<li><a href="classes.html"><span>Class&#160;Index</span></a></li>
<li><a href="hierarchy.html"><span>Class&#160;Hierarchy</span></a></li>
<li><a href="functions.html"><span>Class&#160;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_1Drawable.html">Drawable</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="#pro-methods">Protected Member Functions</a> &#124;
<a href="#friends">Friends</a> &#124;
<a href="classsf_1_1Drawable-members.html">List of all members</a> </div>
<div class="headertitle">
<div class="title">sf::Drawable Class Reference<span class="mlabels"><span class="mlabel">abstract</span></span><div class="ingroups"><a class="el" href="group__graphics.html">Graphics module</a></div></div> </div>
</div><!--header-->
<div class="contents">
<p>Abstract base class for objects that can be drawn to a render target.
<a href="classsf_1_1Drawable.html#details">More...</a></p>
<p><code>#include &lt;<a class="el" href="Drawable_8hpp_source.html">Drawable.hpp</a>&gt;</code></p>
<div class="dynheader">
Inheritance diagram for sf::Drawable:</div>
<div class="dyncontent">
<div class="center">
<img src="classsf_1_1Drawable.png" usemap="#sf::Drawable_map" alt=""/>
<map id="sf::Drawable_map" name="sf::Drawable_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_1VertexArray.html" title="Define a set of one or more 2D primitives. " alt="sf::VertexArray" shape="rect" coords="520,56,640,80"/>
<area href="classsf_1_1VertexBuffer.html" title="Vertex buffer storage for one or more 2D primitives. " alt="sf::VertexBuffer" shape="rect" coords="650,56,770,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:a906002f2df7beb5edbddf5bbef96f120"><td class="memItemLeft" align="right" valign="top">virtual&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classsf_1_1Drawable.html#a906002f2df7beb5edbddf5bbef96f120">~Drawable</a> ()</td></tr>
<tr class="memdesc:a906002f2df7beb5edbddf5bbef96f120"><td class="mdescLeft">&#160;</td><td class="mdescRight">Virtual destructor. <a href="#a906002f2df7beb5edbddf5bbef96f120">More...</a><br /></td></tr>
<tr class="separator:a906002f2df7beb5edbddf5bbef96f120"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pro-methods"></a>
Protected Member Functions</h2></td></tr>
<tr class="memitem:a90d2c88bba9b035a0844eccb380ef631"><td class="memItemLeft" align="right" valign="top">virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classsf_1_1Drawable.html#a90d2c88bba9b035a0844eccb380ef631">draw</a> (<a class="el" href="classsf_1_1RenderTarget.html">RenderTarget</a> &amp;target, <a class="el" href="classsf_1_1RenderStates.html">RenderStates</a> states) const =0</td></tr>
<tr class="memdesc:a90d2c88bba9b035a0844eccb380ef631"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draw the object to a render target. <a href="#a90d2c88bba9b035a0844eccb380ef631">More...</a><br /></td></tr>
<tr class="separator:a90d2c88bba9b035a0844eccb380ef631"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="friends"></a>
Friends</h2></td></tr>
<tr class="memitem:aa5afc6f82b7b587ed5ada4d227ce32aa"><td class="memItemLeft" align="right" valign="top"><a id="aa5afc6f82b7b587ed5ada4d227ce32aa"></a>
class&#160;</td><td class="memItemRight" valign="bottom"><b>RenderTarget</b></td></tr>
<tr class="separator:aa5afc6f82b7b587ed5ada4d227ce32aa"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Abstract base class for objects that can be drawn to a render target. </p>
<p><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> is a very simple base class that allows objects of derived classes to be drawn to a <a class="el" href="classsf_1_1RenderTarget.html" title="Base class for all render targets (window, texture, ...) ">sf::RenderTarget</a>.</p>
<p>All you have to do in your derived class is to override the draw virtual function.</p>
<p>Note that inheriting from <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> is not mandatory, but it allows this nice syntax "window.draw(object)" rather than "object.draw(window)", which is more consistent with other SFML classes.</p>
<p>Example: </p><div class="fragment"><div class="line"><span class="keyword">class </span>MyDrawable : <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">public</span>:</div><div class="line"></div><div class="line"> ...</div><div class="line"></div><div class="line">private:</div><div class="line"></div><div class="line"> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classsf_1_1Drawable.html#a90d2c88bba9b035a0844eccb380ef631">draw</a>(<a class="code" href="classsf_1_1RenderTarget.html">sf::RenderTarget</a>&amp; 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"> <span class="comment">// You can draw other high-level objects</span></div><div class="line"> target.<a class="code" href="classsf_1_1RenderTarget.html#a12417a3bcc245c41d957b29583556f39">draw</a>(m_sprite, states);</div><div class="line"></div><div class="line"> <span class="comment">// ... or use the low-level API</span></div><div class="line"> states.<a class="code" href="classsf_1_1RenderStates.html#a457fc5a41731889de9cf39cf9b3436c3">texture</a> = &amp;m_texture;</div><div class="line"> target.<a class="code" href="classsf_1_1RenderTarget.html#a12417a3bcc245c41d957b29583556f39">draw</a>(m_vertices, states);</div><div class="line"></div><div class="line"> <span class="comment">// ... or draw with OpenGL directly</span></div><div class="line"> glBegin(GL_QUADS);</div><div class="line"> ...</div><div class="line"> glEnd();</div><div class="line"> }</div><div class="line"></div><div class="line"> <a class="code" href="classsf_1_1Sprite.html">sf::Sprite</a> m_sprite;</div><div class="line"> <a class="code" href="classsf_1_1Texture.html">sf::Texture</a> m_texture;</div><div class="line"> <a class="code" href="classsf_1_1VertexArray.html">sf::VertexArray</a> m_vertices;</div><div class="line">};</div></div><!-- fragment --><dl class="section see"><dt>See also</dt><dd><a class="el" href="classsf_1_1RenderTarget.html" title="Base class for all render targets (window, texture, ...) ">sf::RenderTarget</a> </dd></dl>
<p class="definition">Definition at line <a class="el" href="Drawable_8hpp_source.html#l00044">44</a> of file <a class="el" href="Drawable_8hpp_source.html">Drawable.hpp</a>.</p>
</div><h2 class="groupheader">Constructor &amp; Destructor Documentation</h2>
<a id="a906002f2df7beb5edbddf5bbef96f120"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a906002f2df7beb5edbddf5bbef96f120">&#9670;&nbsp;</a></span>~Drawable()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">virtual sf::Drawable::~Drawable </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">virtual</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Virtual destructor. </p>
<p class="definition">Definition at line <a class="el" href="Drawable_8hpp_source.html#l00052">52</a> of file <a class="el" href="Drawable_8hpp_source.html">Drawable.hpp</a>.</p>
</div>
</div>
<h2 class="groupheader">Member Function Documentation</h2>
<a id="a90d2c88bba9b035a0844eccb380ef631"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a90d2c88bba9b035a0844eccb380ef631">&#9670;&nbsp;</a></span>draw()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">virtual void sf::Drawable::draw </td>
<td>(</td>
<td class="paramtype"><a class="el" href="classsf_1_1RenderTarget.html">RenderTarget</a> &amp;&#160;</td>
<td class="paramname"><em>target</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="classsf_1_1RenderStates.html">RenderStates</a>&#160;</td>
<td class="paramname"><em>states</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td> const</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">protected</span><span class="mlabel">pure virtual</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Draw the object to a render target. </p>
<p>This is a pure virtual function that has to be implemented by the derived class to define how the drawable should be drawn.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">target</td><td>Render target to draw to </td></tr>
<tr><td class="paramname">states</td><td>Current render states </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li><a class="el" href="Drawable_8hpp_source.html">Drawable.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 &copy; Laurent Gomila &nbsp;::&nbsp;
Documentation generated by <a href="http://www.doxygen.org/" title="doxygen website">doxygen</a> &nbsp;::&nbsp;
</div>
</div>
</body>
</html>