<ahref="#pub-methods">Public Member Functions</a>|
<ahref="#pro-methods">Protected Member Functions</a>|
<ahref="classsf_1_1RenderWindow-members.html">List of all members</a></div>
<divclass="headertitle">
<divclass="title">sf::RenderWindow Class Reference<divclass="ingroups"><aclass="el"href="group__graphics.html">Graphics module</a></div></div></div>
</div><!--header-->
<divclass="contents">
<p><aclass="el"href="classsf_1_1Window.html"title="Window that serves as a target for OpenGL rendering. ">Window</a> that can serve as a target for 2D drawing.
<areahref="classsf_1_1Window.html"title="Window that serves as a target for OpenGL rendering. "alt="sf::Window"shape="rect"coords="61,56,174,80"/>
<areahref="classsf_1_1RenderTarget.html"title="Base class for all render targets (window, texture, ...) "alt="sf::RenderTarget"shape="rect"coords="246,56,359,80"/>
<areahref="classsf_1_1GlResource.html"title="Base class for classes that require an OpenGL context. "alt="sf::GlResource"shape="rect"coords="0,0,113,24"/>
<areahref="classsf_1_1NonCopyable.html"title="Utility class that makes any derived class non-copyable. "alt="sf::NonCopyable"shape="rect"coords="123,0,236,24"/>
<areahref="classsf_1_1NonCopyable.html"title="Utility class that makes any derived class non-copyable. "alt="sf::NonCopyable"shape="rect"coords="246,0,359,24"/>
<trclass="memdesc:aebef983e01f677bf5a66cefc4d547647"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Construct a new window. <ahref="#aebef983e01f677bf5a66cefc4d547647">More...</a><br/></td></tr>
<trclass="memdesc:a25c0af7d515e710b6eebc9c6be952aa5"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Construct the window from an existing control. <ahref="#a25c0af7d515e710b6eebc9c6be952aa5">More...</a><br/></td></tr>
<trclass="memdesc:ae3eacf93661c8068fca7a78d57dc7e14"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Get the size of the rendering region of the window. <ahref="#ae3eacf93661c8068fca7a78d57dc7e14">More...</a><br/></td></tr>
<trclass="memdesc:aee6c53eced675e885931eb3e91f11155"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Activate or deactivate the window as the current target for OpenGL rendering. <ahref="#aee6c53eced675e885931eb3e91f11155">More...</a><br/></td></tr>
<trclass="memdesc:a5a784b8a09bf4a8bc97ef9e0a8957c35"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Copy the current contents of the window to an image. <ahref="#a5a784b8a09bf4a8bc97ef9e0a8957c35">More...</a><br/></td></tr>
<trclass="memdesc:acf67483dc21f08d65c8835b3889b41b2"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Create (or recreate) the window from an existing control. <ahref="#acf67483dc21f08d65c8835b3889b41b2">More...</a><br/></td></tr>
<trclass="memdesc:a99d1e030387b0c26f5995670504fe7b5"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Close the window and destroy all the attached resources. <ahref="#a99d1e030387b0c26f5995670504fe7b5">More...</a><br/></td></tr>
<trclass="memdesc:ae873503db7d48157bb9cbf6129562bce"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Tell whether or not the window is open. <ahref="#ae873503db7d48157bb9cbf6129562bce">More...</a><br/></td></tr>
<trclass="memdesc:ae5b8065e92bbd0408e1fd8328e80d7d1"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Get the settings of the OpenGL context of the window. <ahref="#ae5b8065e92bbd0408e1fd8328e80d7d1">More...</a><br/></td></tr>
<trclass="memdesc:a338e996585faf82e93069858e3b531b7"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Pop the event on top of the event queue, if any, and return it. <ahref="#a338e996585faf82e93069858e3b531b7">More...</a><br/></td></tr>
<trclass="memdesc:aaf02ab64fbc1d374eef3696df54137bc"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Wait for an event and return it. <ahref="#aaf02ab64fbc1d374eef3696df54137bc">More...</a><br/></td></tr>
<trclass="memdesc:a420028b8e4d9baedcaaba7b2047b8cb3"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Get the position of the window. <ahref="#a420028b8e4d9baedcaaba7b2047b8cb3">More...</a><br/></td></tr>
<trclass="memdesc:a6c4078bfbf61c29bfc4b4732ce764f17"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Change the position of the window on screen. <ahref="#a6c4078bfbf61c29bfc4b4732ce764f17">More...</a><br/></td></tr>
<trclass="memdesc:ab94ea32f22d15c0df11588e319de2546"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Change the size of the rendering region of the window. <ahref="#ab94ea32f22d15c0df11588e319de2546">More...</a><br/></td></tr>
<trclass="memdesc:a3b3f3513bb6be90f5cd456c20b5fd5fa"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Change the title of the window. <ahref="#a3b3f3513bb6be90f5cd456c20b5fd5fa">More...</a><br/></td></tr>
<trclass="memitem:a63af61e026fba08e3153fd013620bcc0"><tdclass="memItemLeft"align="right"valign="top">void </td><tdclass="memItemRight"valign="bottom"><aclass="el"href="classsf_1_1Window.html#a63af61e026fba08e3153fd013620bcc0">setIcon</a> (unsigned int width, unsigned int height, const Uint8 *pixels)</td></tr>
<trclass="memdesc:a63af61e026fba08e3153fd013620bcc0"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Change the window's icon. <ahref="#a63af61e026fba08e3153fd013620bcc0">More...</a><br/></td></tr>
<trclass="memdesc:a160f7f11a207603d7e99ce606e749703"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Show or hide the window. <ahref="#a160f7f11a207603d7e99ce606e749703">More...</a><br/></td></tr>
<trclass="memdesc:aad3991c25e0a83afbb4d62febf9b7b14"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Show or hide the mouse cursor. <ahref="#aad3991c25e0a83afbb4d62febf9b7b14">More...</a><br/></td></tr>
<trclass="memdesc:a5b4ef8ede77531e17b7a0287fa6ff9ce"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Grab or release the mouse cursor. <ahref="#a5b4ef8ede77531e17b7a0287fa6ff9ce">More...</a><br/></td></tr>
<trclass="memdesc:aab7a05baece72b08ad120063b143d19b"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Set the displayed cursor to a native system cursor. <ahref="#aab7a05baece72b08ad120063b143d19b">More...</a><br/></td></tr>
<trclass="memitem:af4322d315baf93405bf0d5087ad5e784"><tdclass="memItemLeft"align="right"valign="top">void </td><tdclass="memItemRight"valign="bottom"><aclass="el"href="classsf_1_1Window.html#af4322d315baf93405bf0d5087ad5e784">setFramerateLimit</a> (unsigned int limit)</td></tr>
<trclass="memdesc:af4322d315baf93405bf0d5087ad5e784"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Limit the framerate to a maximum fixed frequency. <ahref="#af4322d315baf93405bf0d5087ad5e784">More...</a><br/></td></tr>
<trclass="memdesc:aa45b8f54e29a6f59f1fc7ee66b2fab68"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Change the joystick threshold. <ahref="#aa45b8f54e29a6f59f1fc7ee66b2fab68">More...</a><br/></td></tr>
<trclass="memdesc:aaab549da64cedf74fa6f1ae7a3cc79e0"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Activate or deactivate the window as the current target for OpenGL rendering. <ahref="#aaab549da64cedf74fa6f1ae7a3cc79e0">More...</a><br/></td></tr>
<trclass="memdesc:a58cf7fa1775e8e7542032e3ecfa83b49"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Request the current window to be made the active foreground window. <ahref="#a58cf7fa1775e8e7542032e3ecfa83b49">More...</a><br/></td></tr>
<trclass="memdesc:ad8db2e6500d13ca9396281296404ba31"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Check whether the window has the input focus. <ahref="#ad8db2e6500d13ca9396281296404ba31">More...</a><br/></td></tr>
<trclass="memdesc:adabf839cb103ac96cfc82f781638772a"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Display on screen what has been rendered to the window so far. <ahref="#adabf839cb103ac96cfc82f781638772a">More...</a><br/></td></tr>
<trclass="memdesc:ad2fa6be5104ec0bfe79af7a5f524ea90"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Get the OS-specific handle of the window. <ahref="#ad2fa6be5104ec0bfe79af7a5f524ea90">More...</a><br/></td></tr>
<trclass="memdesc:a6bb6f0ba348f2b1e2f46114aeaf60f26"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Clear the entire target with a single color. <ahref="#a6bb6f0ba348f2b1e2f46114aeaf60f26">More...</a><br/></td></tr>
<trclass="memdesc:a063db6dd0a14913504af30e50cb6d946"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Change the current active view. <ahref="#a063db6dd0a14913504af30e50cb6d946">More...</a><br/></td></tr>
<trclass="memdesc:a2c179503b4dcdf5282ef6426d317602c"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Get the view currently in use in the render target. <ahref="#a2c179503b4dcdf5282ef6426d317602c">More...</a><br/></td></tr>
<trclass="memdesc:ad3b533c3f899d7044d981ed607aef9be"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Get the default view of the render target. <ahref="#ad3b533c3f899d7044d981ed607aef9be">More...</a><br/></td></tr>
<trclass="memdesc:a865d462915dc2a1fae2ebfb3300382ac"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Get the viewport of a view, applied to this render target. <ahref="#a865d462915dc2a1fae2ebfb3300382ac">More...</a><br/></td></tr>
<trclass="memdesc:a0103ebebafa43a97e6e6414f8560d5e3"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Convert a point from target coordinates to world coordinates, using the current view. <ahref="#a0103ebebafa43a97e6e6414f8560d5e3">More...</a><br/></td></tr>
<trclass="memdesc:a2d3e9d7c4a1f5ea7e52b06f53e3011f9"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Convert a point from target coordinates to world coordinates. <ahref="#a2d3e9d7c4a1f5ea7e52b06f53e3011f9">More...</a><br/></td></tr>
<trclass="memdesc:ad92a9f0283aa5f3f67e473c1105b68cf"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Convert a point from world coordinates to target coordinates, using the current view. <ahref="#ad92a9f0283aa5f3f67e473c1105b68cf">More...</a><br/></td></tr>
<trclass="memdesc:a848eee44b72ac3f16fa9182df26e83bc"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Convert a point from world coordinates to target coordinates. <ahref="#a848eee44b72ac3f16fa9182df26e83bc">More...</a><br/></td></tr>
<trclass="memdesc:a12417a3bcc245c41d957b29583556f39"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Draw a drawable object to the render target. <ahref="#a12417a3bcc245c41d957b29583556f39">More...</a><br/></td></tr>
<trclass="memdesc:a976bc94057799eb9f8a18ac5fdfd9b73"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Draw primitives defined by an array of vertices. <ahref="#a976bc94057799eb9f8a18ac5fdfd9b73">More...</a><br/></td></tr>
<trclass="memdesc:a3dc4d06f081d36ca1e8f1a1298d49abc"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Draw primitives defined by a vertex buffer. <ahref="#a3dc4d06f081d36ca1e8f1a1298d49abc">More...</a><br/></td></tr>
<trclass="memdesc:a07cb25d4557a30146b24b25b242310ea"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Draw primitives defined by a vertex buffer. <ahref="#a07cb25d4557a30146b24b25b242310ea">More...</a><br/></td></tr>
<trclass="memdesc:a8d1998464ccc54e789aaf990242b47f7"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Save the current OpenGL render states and matrices. <ahref="#a8d1998464ccc54e789aaf990242b47f7">More...</a><br/></td></tr>
<trclass="memdesc:ad5a98401113df931ddcd54c080f7aa8e"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Restore the previously saved OpenGL render states and matrices. <ahref="#ad5a98401113df931ddcd54c080f7aa8e">More...</a><br/></td></tr>
<trclass="memdesc:aac7504990d27dada4bfe3c7866920765"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Reset the internal OpenGL states so that the target is ready for drawing. <ahref="#aac7504990d27dada4bfe3c7866920765">More...</a><br/></td></tr>
<trclass="memdesc:a5bef0040b0fa87bed9fbd459c980d53a"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Function called after the window has been created. <ahref="#a5bef0040b0fa87bed9fbd459c980d53a">More...</a><br/></td></tr>
<trclass="memdesc:a5c85fe482313562d33ffd24a194b6fef"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Function called after the window has been resized. <ahref="#a5c85fe482313562d33ffd24a194b6fef">More...</a><br/></td></tr>
<trclass="memdesc:af530274b34159d644e509b4b4dc43eb7"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Performs the common initialization step after creation. <ahref="#af530274b34159d644e509b4b4dc43eb7">More...</a><br/></td></tr>
<divclass="textblock"><p><aclass="el"href="classsf_1_1Window.html"title="Window that serves as a target for OpenGL rendering. ">Window</a> that can serve as a target for 2D drawing. </p>
<p><aclass="el"href="classsf_1_1RenderWindow.html"title="Window that can serve as a target for 2D drawing. ">sf::RenderWindow</a> is the main class of the Graphics module.</p>
<p>It defines an OS window that can be painted using the other classes of the graphics module.</p>
<p><aclass="el"href="classsf_1_1RenderWindow.html"title="Window that can serve as a target for 2D drawing. ">sf::RenderWindow</a> is derived from <aclass="el"href="classsf_1_1Window.html"title="Window that serves as a target for OpenGL rendering. ">sf::Window</a>, thus it inherits all its features: events, window management, OpenGL rendering, etc. See the documentation of <aclass="el"href="classsf_1_1Window.html"title="Window that serves as a target for OpenGL rendering. ">sf::Window</a> for a more complete description of all these features, as well as code examples.</p>
<p>On top of that, <aclass="el"href="classsf_1_1RenderWindow.html"title="Window that can serve as a target for 2D drawing. ">sf::RenderWindow</a> adds more features related to 2D drawing with the graphics module (see its base class <aclass="el"href="classsf_1_1RenderTarget.html"title="Base class for all render targets (window, texture, ...) ">sf::RenderTarget</a> for more details). Here is a typical rendering and event loop with a <aclass="el"href="classsf_1_1RenderWindow.html"title="Window that can serve as a target for 2D drawing. ">sf::RenderWindow</a>:</p>
<divclass="fragment"><divclass="line"><spanclass="comment">// Declare and create a new render-window</span></div><divclass="line"><aclass="code"href="classsf_1_1RenderWindow.html">sf::RenderWindow</a> window(<aclass="code"href="classsf_1_1VideoMode.html">sf::VideoMode</a>(800, 600), <spanclass="stringliteral">"SFML window"</span>);</div><divclass="line"></div><divclass="line"><spanclass="comment">// Limit the framerate to 60 frames per second (this step is optional)</span></div><divclass="line">window.<aclass="code"href="classsf_1_1Window.html#af4322d315baf93405bf0d5087ad5e784">setFramerateLimit</a>(60);</div><divclass="line"></div><divclass="line"><spanclass="comment">// The main loop - ends as soon as the window is closed</span></div><divclass="line"><spanclass="keywordflow">while</span> (window.<aclass="code"href="classsf_1_1Window.html#ae873503db7d48157bb9cbf6129562bce">isOpen</a>())</div><divclass="line">{</div><divclass="line"><spanclass="comment">// Event processing</span></div><divclass="line"><aclass="code"href="classsf_1_1Event.html">sf::Event</a> event;</div><divclass="line"><spanclass="keywordflow">while</span> (window.<aclass="code"href="classsf_1_1Window.html#a338e996585faf82e93069858e3b531b7">pollEvent</a>(event))</div><divclass="line"> {</div><divclass="line"><spanclass="comment">// Request for closing the window</span></div><divclass="line"><spanclass="keywordflow">if</span> (event.<aclass="code"href="classsf_1_1Event.html#adf2f8044f713fd9d6019077b0d1ffe0a">type</a> == <aclass="code"href="classsf_1_1Event.html#af41fa9ed45c02449030699f671331d4aa316e4212e083f1dce79efd8d9e9c0a95">sf::Event::Closed</a>)</div><divclass="line"> window.<aclass="code"href="classsf_1_1Window.html#a99d1e030387b0c26f5995670504fe7b5">close</a>();</div><divclass="line"> }</div><divclass="line"></div><divclass="line"><spanclass="comment">// Clear the whole window before rendering a new frame</span></div><divclass="line"> window.clear();</div><divclass="line"></div><divclass="line"><spanclass="comment">// Draw some graphical entities</span></div><divclass="line"> window.draw(sprite);</div><divclass="line"> window.draw(circle);</div><divclass="line"> window.draw(text);</div><divclass="line"></div><divclass="line"><spanclass="comment">// End the current frame and display its contents on screen</span></div><divclass="line"> window.<aclass="code"href="classsf_1_1Window.html#adabf839cb103ac96cfc82f781638772a">display</a>();</div><divclass="line">}</div></div><!-- fragment --><p>Like <aclass="el"href="classsf_1_1Window.html"title="Window that serves as a target for OpenGL rendering. ">sf::Window</a>, <aclass="el"href="classsf_1_1RenderWindow.html"title="Window that can serve as a target for 2D drawing. ">sf::RenderWindow</a> is still able to render direct OpenGL stuff. It is even possible to mix together OpenGL calls and regular SFML drawing commands.</p>
<divclass="fragment"><divclass="line"><spanclass="comment">// Create the render window</span></div><divclass="line"><aclass="code"href="classsf_1_1RenderWindow.html">sf::RenderWindow</a> window(<aclass="code"href="classsf_1_1VideoMode.html">sf::VideoMode</a>(800, 600), <spanclass="stringliteral">"SFML OpenGL"</span>);</div><divclass="line"></div><divclass="line"><spanclass="comment">// Create a sprite and a text to display</span></div><divclass="line"><aclass="code"href="classsf_1_1Sprite.html">sf::Sprite</a> sprite;</div><divclass="line"><aclass="code"href="classsf_1_1Text.html">sf::Text</a> text;</div><divclass="line">...</div><divclass="line"></div><divclass="line"><spanclass="comment">// Perform OpenGL initializations</span></div><divclass="line">glMatrixMode(GL_PROJECTION);</div><divclass="line">...</div><divclass="line"></div><divclass="line"><spanclass="comment">// Start the rendering loop</span></div><divclass="line">while (window.<aclass="code"href="classsf_1_1Window.html#ae873503db7d48157bb9cbf6129562bce">isOpen</a>())</div><divclass="line">{</div><divclass="line"><spanclass="comment">// Process events</span></div><divclass="line"> ...</div><divclass="line"></div><divclass="line"><spanclass="comment">// Draw a background sprite</span></div><divclass="line"> window.pushGLStates();</div><divclass="line"> window.draw(sprite);</div><divclass="line"> window.popGLStates();</div><divclass="line"></div><divclass="line"><spanclass="comment">// Draw a 3D object using OpenGL</span></div><divclass="line"> glBegin(GL_QUADS);</div><divclass="line"> glVertex3f(...);</div><divclass="line"> ...</div><divclass="line"> glEnd();</div><divclass="line"></div><divclass="line"><spanclass="comment">// Draw text on top of the 3D object</span></div><divclass="line"> window.pushGLStates();</div><divclass="line"> window.draw(text);</div><divclass="line"> window.popGLStates();</div><divclass="line"></div><divclass="line"><spanclass="comment">// Finally, display the rendered frame on screen</span></div><divclass="line"> window.<aclass="code"href="classsf_1_1Window.html#adabf839cb103ac96cfc82f781638772a">display</a>();</div><divclass="line">}</div></div><!-- fragment --><dlclass="section see"><dt>See also</dt><dd><aclass="el"href="classsf_1_1Window.html"title="Window that serves as a target for OpenGL rendering. ">sf::Window</a>, <aclass="el"href="classsf_1_1RenderTarget.html"title="Base class for all render targets (window, texture, ...) ">sf::RenderTarget</a>, <aclass="el"href="classsf_1_1RenderTexture.html"title="Target for off-screen 2D rendering into a texture. ">sf::RenderTexture</a>, <aclass="el"href="classsf_1_1View.html"title="2D camera that defines what region is shown on screen ">sf::View</a></dd></dl>
<pclass="definition">Definition at line <aclass="el"href="RenderWindow_8hpp_source.html#l00044">44</a> of file <aclass="el"href="RenderWindow_8hpp_source.html">RenderWindow.hpp</a>.</p>
</div><h2class="groupheader">Constructor & Destructor Documentation</h2>
<p>This constructor doesn't actually create the window, use the other constructors or call <aclass="el"href="classsf_1_1Window.html#a30e6edf2162f8dbff61023b9de5d961d"title="Create (or recreate) the window. ">create()</a> to do so. </p>
<p>This constructor creates the window with the size and pixel depth defined in <em>mode</em>. An optional style can be passed to customize the look and behavior of the window (borders, title bar, resizable, closable, ...).</p>
<p>The fourth parameter is an optional structure specifying advanced OpenGL context settings such as antialiasing, depth-buffer bits, etc. You shouldn't care about these parameters for a regular usage of the graphics module.</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">mode</td><td>Video mode to use (defines the width, height and depth of the rendering area of the window) </td></tr>
<tr><tdclass="paramname">title</td><td>Title of the window </td></tr>
<tr><tdclass="paramname">style</td><td>Window style, a bitwise OR combination of sf::Style enumerators </td></tr>
<tr><tdclass="paramname">settings</td><td>Additional settings for the underlying OpenGL context </td></tr>
<p>Construct the window from an existing control. </p>
<p>Use this constructor if you want to create an SFML rendering area into an already existing control.</p>
<p>The second parameter is an optional structure specifying advanced OpenGL context settings such as antialiasing, depth-buffer bits, etc. You shouldn't care about these parameters for a regular usage of the graphics module.</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">handle</td><td>Platform-specific handle of the control (<em>HWND</em> on Windows, <em>Window</em> on Linux/FreeBSD, <em>NSWindow</em> on OS X) </td></tr>
<tr><tdclass="paramname">settings</td><td>Additional settings for the underlying OpenGL context </td></tr>
<dlclass="deprecated"><dt><b><aclass="el"href="deprecated.html#_deprecated000005">Deprecated:</a></b></dt><dd>Use a <aclass="el"href="classsf_1_1Texture.html"title="Image living on the graphics card that can be used for drawing. ">sf::Texture</a> and its <aclass="el"href="classsf_1_1Texture.html#ad3cceef238f7d5d2108a98dd38c17fc5"title="ServerUpdate the texture from the contents of a window. ">sf::Texture::update(const Window&)</a> function and copy its contents into an <aclass="el"href="classsf_1_1Image.html"title="Class for loading, manipulating and saving images. ">sf::Image</a> instead. </dd></dl>
<divclass="fragment"><divclass="line"><aclass="code"href="classsf_1_1Vector2.html">sf::Vector2u</a> windowSize = window.<aclass="code"href="classsf_1_1Window.html#a3969926741cbe83d7f9eeaf5333d4e71">getSize</a>();</div><divclass="line"><aclass="code"href="classsf_1_1Texture.html">sf::Texture</a> texture;</div><divclass="line">texture.<aclass="code"href="classsf_1_1Texture.html#a89b4c7d204acf1033c3a1b6e0a3ad0a3">create</a>(windowSize.<aclass="code"href="classsf_1_1Vector2.html#a1e6ad77fa155f3753bfb92699bd28141">x</a>, windowSize.<aclass="code"href="classsf_1_1Vector2.html#a420f2481b015f4eb929c75f2af564299">y</a>);</div><divclass="line">texture.<aclass="code"href="classsf_1_1Texture.html#ae4eab5c6781316840b0c50ad08370963">update</a>(window);</div><divclass="line"><aclass="code"href="classsf_1_1Image.html">sf::Image</a> screenshot = texture.<aclass="code"href="classsf_1_1Texture.html#a77e18a70de2e525ac5e4a7cd95f614b9">copyToImage</a>();</div></div><!-- fragment --><p>This is a slow operation, whose main purpose is to make screenshots of the application. If you want to update an image with the contents of the window and then use it for drawing, you should rather use a <aclass="el"href="classsf_1_1Texture.html"title="Image living on the graphics card that can be used for drawing. ">sf::Texture</a> and its update(Window&) function. You can also draw things directly to a texture with the <aclass="el"href="classsf_1_1RenderTexture.html"title="Target for off-screen 2D rendering into a texture. ">sf::RenderTexture</a> class.</p>
<dlclass="section return"><dt>Returns</dt><dd><aclass="el"href="classsf_1_1Image.html"title="Class for loading, manipulating and saving images. ">Image</a> containing the captured contents </dd></dl>
<p>Close the window and destroy all the attached resources. </p>
<p>After calling this function, the <aclass="el"href="classsf_1_1Window.html"title="Window that serves as a target for OpenGL rendering. ">sf::Window</a> instance remains valid and you can call <aclass="el"href="classsf_1_1Window.html#a30e6edf2162f8dbff61023b9de5d961d"title="Create (or recreate) the window. ">create()</a> to recreate the window. All other functions such as <aclass="el"href="classsf_1_1Window.html#a338e996585faf82e93069858e3b531b7"title="Pop the event on top of the event queue, if any, and return it. ">pollEvent()</a> or <aclass="el"href="classsf_1_1Window.html#adabf839cb103ac96cfc82f781638772a"title="Display on screen what has been rendered to the window so far. ">display()</a> will still work (i.e. you don't have to test <aclass="el"href="classsf_1_1Window.html#ae873503db7d48157bb9cbf6129562bce"title="Tell whether or not the window is open. ">isOpen()</a> every time), and will have no effect on closed windows. </p>
<p>If the window was already created, it closes it first. If <em>style</em> contains Style::Fullscreen, then <em>mode</em> must be a valid video mode.</p>
<p>The fourth parameter is an optional structure specifying advanced OpenGL context settings such as antialiasing, depth-buffer bits, etc.</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">mode</td><td>Video mode to use (defines the width, height and depth of the rendering area of the window) </td></tr>
<tr><tdclass="paramname">title</td><td>Title of the window </td></tr>
<tr><tdclass="paramname">style</td><td>Window style, a bitwise OR combination of sf::Style enumerators </td></tr>
<tr><tdclass="paramname">settings</td><td>Additional settings for the underlying OpenGL context </td></tr>
<p>Create (or recreate) the window from an existing control. </p>
<p>Use this function if you want to create an OpenGL rendering area into an already existing control. If the window was already created, it closes it first.</p>
<p>The second parameter is an optional structure specifying advanced OpenGL context settings such as antialiasing, depth-buffer bits, etc.</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">handle</td><td>Platform-specific handle of the control </td></tr>
<tr><tdclass="paramname">settings</td><td>Additional settings for the underlying OpenGL context </td></tr>
<p>Draw primitives defined by a vertex buffer. </p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">vertexBuffer</td><td><aclass="el"href="classsf_1_1Vertex.html"title="Define a point with color and texture coordinates. ">Vertex</a> buffer </td></tr>
<tr><tdclass="paramname">states</td><td>Render states to use for drawing </td></tr>
<p>Draw primitives defined by a vertex buffer. </p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">vertexBuffer</td><td><aclass="el"href="classsf_1_1Vertex.html"title="Define a point with color and texture coordinates. ">Vertex</a> buffer </td></tr>
<tr><tdclass="paramname">firstVertex</td><td>Index of the first vertex to render </td></tr>
<tr><tdclass="paramname">vertexCount</td><td>Number of vertices to render </td></tr>
<tr><tdclass="paramname">states</td><td>Render states to use for drawing </td></tr>
<p>Get the default view of the render target. </p>
<p>The default view has the initial size of the render target, and never changes after the target has been created.</p>
<dlclass="section return"><dt>Returns</dt><dd>The default view of the render target</dd></dl>
<dlclass="section see"><dt>See also</dt><dd><aclass="el"href="classsf_1_1RenderTarget.html#a063db6dd0a14913504af30e50cb6d946"title="Change the current active view. ">setView</a>, <aclass="el"href="classsf_1_1RenderTarget.html#a2c179503b4dcdf5282ef6426d317602c"title="Get the view currently in use in the render target. ">getView</a></dd></dl>
<dlclass="section return"><dt>Returns</dt><dd>Position of the window, in pixels</dd></dl>
<dlclass="section see"><dt>See also</dt><dd><aclass="el"href="classsf_1_1Window.html#a6c4078bfbf61c29bfc4b4732ce764f17"title="Change the position of the window on screen. ">setPosition</a></dd></dl>
<p>Get the settings of the OpenGL context of the window. </p>
<p>Note that these settings may be different from what was passed to the constructor or the <aclass="el"href="classsf_1_1Window.html#a30e6edf2162f8dbff61023b9de5d961d"title="Create (or recreate) the window. ">create()</a> function, if one or more settings were not supported. In this case, SFML chose the closest match.</p>
<dlclass="section return"><dt>Returns</dt><dd>Structure containing the OpenGL context settings </dd></dl>
<p>The type of the returned handle is sf::WindowHandle, which is a typedef to the handle type defined by the OS. You shouldn't need to use this function, unless you have very specific stuff to implement that SFML doesn't support, or implement a temporary workaround until a bug is fixed.</p>
<dlclass="section return"><dt>Returns</dt><dd>System handle of the window </dd></dl>
<p>Get the view currently in use in the render target. </p>
<dlclass="section return"><dt>Returns</dt><dd>The view object that is currently used</dd></dl>
<dlclass="section see"><dt>See also</dt><dd><aclass="el"href="classsf_1_1RenderTarget.html#a063db6dd0a14913504af30e50cb6d946"title="Change the current active view. ">setView</a>, <aclass="el"href="classsf_1_1RenderTarget.html#ad3b533c3f899d7044d981ed607aef9be"title="Get the default view of the render target. ">getDefaultView</a></dd></dl>
<p>Get the viewport of a view, applied to this render target. </p>
<p>The viewport is defined in the view as a ratio, this function simply applies this ratio to the current dimensions of the render target to calculate the pixels rectangle that the viewport actually covers in the target.</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">view</td><td>The view for which we want to compute the viewport</td></tr>
</table>
</dd>
</dl>
<dlclass="section return"><dt>Returns</dt><dd>Viewport rectangle, expressed in pixels </dd></dl>
<p>Check whether the window has the input focus. </p>
<p>At any given time, only one window may have the input focus to receive input events such as keystrokes or most mouse events.</p>
<dlclass="section return"><dt>Returns</dt><dd>True if window has focus, false otherwise </dd></dl>
<dlclass="section see"><dt>See also</dt><dd><aclass="el"href="classsf_1_1Window.html#a58cf7fa1775e8e7542032e3ecfa83b49"title="Request the current window to be made the active foreground window. ">requestFocus</a></dd></dl>
<p>This function returns whether or not the window exists. Note that a hidden window (setVisible(false)) is open (therefore this function would return true).</p>
<dlclass="section return"><dt>Returns</dt><dd>True if the window is open, false if it has been closed </dd></dl>
<p>Convert a point from world coordinates to target coordinates, using the current view. </p>
<p>This function is an overload of the mapCoordsToPixel function that implicitly uses the current view. It is equivalent to: </p><divclass="fragment"><divclass="line">target.<aclass="code"href="classsf_1_1RenderTarget.html#ad92a9f0283aa5f3f67e473c1105b68cf">mapCoordsToPixel</a>(point, target.<aclass="code"href="classsf_1_1RenderTarget.html#a2c179503b4dcdf5282ef6426d317602c">getView</a>());</div></div><!-- fragment --><dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">point</td><td>Point to convert</td></tr>
</table>
</dd>
</dl>
<dlclass="section return"><dt>Returns</dt><dd>The converted point, in target coordinates (pixels)</dd></dl>
<dlclass="section see"><dt>See also</dt><dd><aclass="el"href="classsf_1_1RenderTarget.html#a0103ebebafa43a97e6e6414f8560d5e3"title="Convert a point from target coordinates to world coordinates, using the current view. ">mapPixelToCoords</a></dd></dl>
<p>Convert a point from world coordinates to target coordinates. </p>
<p>This function finds the pixel of the render target that matches the given 2D point. In other words, it goes through the same process as the graphics card, to compute the final position of a rendered point.</p>
<p>Initially, both coordinate systems (world units and target pixels) match perfectly. But if you define a custom view or resize your render target, this assertion is not true anymore, i.e. a point located at (150, 75) in your 2D world may map to the pixel (10, 50) of your render target – if the view is translated by (140, 25).</p>
<p>This version uses a custom view for calculations, see the other overload of the function if you want to use the current view of the render target.</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">point</td><td>Point to convert </td></tr>
<tr><tdclass="paramname">view</td><td>The view to use for converting the point</td></tr>
</table>
</dd>
</dl>
<dlclass="section return"><dt>Returns</dt><dd>The converted point, in target coordinates (pixels)</dd></dl>
<dlclass="section see"><dt>See also</dt><dd><aclass="el"href="classsf_1_1RenderTarget.html#a0103ebebafa43a97e6e6414f8560d5e3"title="Convert a point from target coordinates to world coordinates, using the current view. ">mapPixelToCoords</a></dd></dl>
<p>Convert a point from target coordinates to world coordinates, using the current view. </p>
<p>This function is an overload of the mapPixelToCoords function that implicitly uses the current view. It is equivalent to: </p><divclass="fragment"><divclass="line">target.<aclass="code"href="classsf_1_1RenderTarget.html#a0103ebebafa43a97e6e6414f8560d5e3">mapPixelToCoords</a>(point, target.<aclass="code"href="classsf_1_1RenderTarget.html#a2c179503b4dcdf5282ef6426d317602c">getView</a>());</div></div><!-- fragment --><dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">point</td><td>Pixel to convert</td></tr>
</table>
</dd>
</dl>
<dlclass="section return"><dt>Returns</dt><dd>The converted point, in "world" coordinates</dd></dl>
<dlclass="section see"><dt>See also</dt><dd><aclass="el"href="classsf_1_1RenderTarget.html#ad92a9f0283aa5f3f67e473c1105b68cf"title="Convert a point from world coordinates to target coordinates, using the current view. ">mapCoordsToPixel</a></dd></dl>
<p>Convert a point from target coordinates to world coordinates. </p>
<p>This function finds the 2D position that matches the given pixel of the render target. In other words, it does the inverse of what the graphics card does, to find the initial position of a rendered pixel.</p>
<p>Initially, both coordinate systems (world units and target pixels) match perfectly. But if you define a custom view or resize your render target, this assertion is not true anymore, i.e. a point located at (10, 50) in your render target may map to the point (150, 75) in your 2D world – if the view is translated by (140, 25).</p>
<p>For render-windows, this function is typically used to find which point (or object) is located below the mouse cursor.</p>
<p>This version uses a custom view for calculations, see the other overload of the function if you want to use the current view of the render target.</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">point</td><td>Pixel to convert </td></tr>
<tr><tdclass="paramname">view</td><td>The view to use for converting the point</td></tr>
</table>
</dd>
</dl>
<dlclass="section return"><dt>Returns</dt><dd>The converted point, in "world" units</dd></dl>
<dlclass="section see"><dt>See also</dt><dd><aclass="el"href="classsf_1_1RenderTarget.html#ad92a9f0283aa5f3f67e473c1105b68cf"title="Convert a point from world coordinates to target coordinates, using the current view. ">mapCoordsToPixel</a></dd></dl>
<p>Pop the event on top of the event queue, if any, and return it. </p>
<p>This function is not blocking: if there's no pending event then it will return false and leave <em>event</em> unmodified. Note that more than one event may be present in the event queue, thus you should always call this function in a loop to make sure that you process every pending event. </p><divclass="fragment"><divclass="line"><aclass="code"href="classsf_1_1Event.html">sf::Event</a> event;</div><divclass="line"><spanclass="keywordflow">while</span> (window.<aclass="code"href="classsf_1_1Window.html#a338e996585faf82e93069858e3b531b7">pollEvent</a>(event))</div><divclass="line">{</div><divclass="line"><spanclass="comment">// process event...</span></div><divclass="line">}</div></div><!-- fragment --><dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">event</td><td><aclass="el"href="classsf_1_1Event.html"title="Defines a system event and its parameters. ">Event</a> to be returned</td></tr>
</table>
</dd>
</dl>
<dlclass="section return"><dt>Returns</dt><dd>True if an event was returned, or false if the event queue was empty</dd></dl>
<dlclass="section see"><dt>See also</dt><dd><aclass="el"href="classsf_1_1Window.html#aaf02ab64fbc1d374eef3696df54137bc"title="Wait for an event and return it. ">waitEvent</a></dd></dl>
<p>Restore the previously saved OpenGL render states and matrices. </p>
<p>See the description of pushGLStates to get a detailed description of these functions.</p>
<dlclass="section see"><dt>See also</dt><dd><aclass="el"href="classsf_1_1RenderTarget.html#a8d1998464ccc54e789aaf990242b47f7"title="Save the current OpenGL render states and matrices. ">pushGLStates</a></dd></dl>
<p>Save the current OpenGL render states and matrices. </p>
<p>This function can be used when you mix SFML drawing and direct OpenGL rendering. Combined with popGLStates, it ensures that: </p><ul>
<li>SFML's internal states are not messed up by your OpenGL code </li>
<li>your OpenGL states are not modified by a call to a SFML function</li>
</ul>
<p>More specifically, it must be used around code that calls Draw functions. Example: </p><divclass="fragment"><divclass="line"><spanclass="comment">// OpenGL code here...</span></div><divclass="line">window.pushGLStates();</div><divclass="line">window.draw(...);</div><divclass="line">window.draw(...);</div><divclass="line">window.popGLStates();</div><divclass="line"><spanclass="comment">// OpenGL code here...</span></div></div><!-- fragment --><p>Note that this function is quite expensive: it saves all the possible OpenGL states and matrices, even the ones you don't care about. Therefore it should be used wisely. It is provided for convenience, but the best results will be achieved if you handle OpenGL states yourself (because you know which states have really changed, and need to be saved and restored). Take a look at the resetGLStates function if you do so.</p>
<dlclass="section see"><dt>See also</dt><dd><aclass="el"href="classsf_1_1RenderTarget.html#ad5a98401113df931ddcd54c080f7aa8e"title="Restore the previously saved OpenGL render states and matrices. ">popGLStates</a></dd></dl>
<p>Request the current window to be made the active foreground window. </p>
<p>At any given time, only one window may have the input focus to receive input events such as keystrokes or mouse events. If a window requests focus, it only hints to the operating system, that it would like to be focused. The operating system is free to deny the request. This is not to be confused with <aclass="el"href="classsf_1_1RenderWindow.html#aee6c53eced675e885931eb3e91f11155"title="Activate or deactivate the window as the current target for OpenGL rendering. ">setActive()</a>.</p>
<dlclass="section see"><dt>See also</dt><dd><aclass="el"href="classsf_1_1Window.html#ad8db2e6500d13ca9396281296404ba31"title="Check whether the window has the input focus. ">hasFocus</a></dd></dl>
<p>Reset the internal OpenGL states so that the target is ready for drawing. </p>
<p>This function can be used when you mix SFML drawing and direct OpenGL rendering, if you choose not to use pushGLStates/popGLStates. It makes sure that all OpenGL states needed by SFML are set, so that subsequent <aclass="el"href="classsf_1_1RenderTarget.html#a12417a3bcc245c41d957b29583556f39"title="Draw a drawable object to the render target. ">draw()</a> calls will work as expected.</p>
<p>Example: </p><divclass="fragment"><divclass="line"><spanclass="comment">// OpenGL code here...</span></div><divclass="line">glPushAttrib(...);</div><divclass="line">window.resetGLStates();</div><divclass="line">window.draw(...);</div><divclass="line">window.draw(...);</div><divclass="line">glPopAttrib(...);</div><divclass="line"><spanclass="comment">// OpenGL code here...</span></div></div><!-- fragment -->
<p>Activate or deactivate the window as the current target for OpenGL rendering. </p>
<p>A window is active only on the current thread, if you want to make it active on another thread you have to deactivate it on the previous thread first if it was active. Only one window can be active on a thread at a time, thus the window previously active (if any) automatically gets deactivated. This is not to be confused with <aclass="el"href="classsf_1_1Window.html#a58cf7fa1775e8e7542032e3ecfa83b49"title="Request the current window to be made the active foreground window. ">requestFocus()</a>.</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">active</td><td>True to activate, false to deactivate</td></tr>
</table>
</dd>
</dl>
<dlclass="section return"><dt>Returns</dt><dd>True if operation was successful, false otherwise </dd></dl>
<p>Reimplemented from <aclass="el"href="classsf_1_1RenderTarget.html#adc225ead22a70843ffa9b7eebefa0ce1">sf::RenderTarget</a>.</p>
<p>Activate or deactivate the window as the current target for OpenGL rendering. </p>
<p>A window is active only on the current thread, if you want to make it active on another thread you have to deactivate it on the previous thread first if it was active. Only one window can be active on a thread at a time, thus the window previously active (if any) automatically gets deactivated. This is not to be confused with <aclass="el"href="classsf_1_1Window.html#a58cf7fa1775e8e7542032e3ecfa83b49"title="Request the current window to be made the active foreground window. ">requestFocus()</a>.</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">active</td><td>True to activate, false to deactivate</td></tr>
</table>
</dd>
</dl>
<dlclass="section return"><dt>Returns</dt><dd>True if operation was successful, false otherwise </dd></dl>
<p>Limit the framerate to a maximum fixed frequency. </p>
<p>If a limit is set, the window will use a small delay after each call to <aclass="el"href="classsf_1_1Window.html#adabf839cb103ac96cfc82f781638772a"title="Display on screen what has been rendered to the window so far. ">display()</a> to ensure that the current frame lasted long enough to match the framerate limit. SFML will try to match the given limit as much as it can, but since it internally uses sf::sleep, whose precision depends on the underlying OS, the results may be a little unprecise as well (for example, you can get 65 FPS when requesting 60).</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">limit</td><td>Framerate limit, in frames per seconds (use 0 to disable limit) </td></tr>
<p><em>pixels</em> must be an array of <em>width</em> x <em>height</em> pixels in 32-bits RGBA format.</p>
<p>The OS default icon is used by default.</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">width</td><td>Icon's width, in pixels </td></tr>
<tr><tdclass="paramname">height</td><td>Icon's height, in pixels </td></tr>
<tr><tdclass="paramname">pixels</td><td>Pointer to the array of pixels in memory. The pixels are copied, so you need not keep the source alive after calling this function.</td></tr>
</table>
</dd>
</dl>
<dlclass="section see"><dt>See also</dt><dd><aclass="el"href="classsf_1_1Window.html#a3b3f3513bb6be90f5cd456c20b5fd5fa"title="Change the title of the window. ">setTitle</a></dd></dl>
<p>If key repeat is enabled, you will receive repeated KeyPressed events while keeping a key pressed. If it is disabled, you will only get a single event when the key is pressed.</p>
<p>Key repeat is enabled by default.</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">enabled</td><td>True to enable, false to disable </td></tr>
<p>Set the displayed cursor to a native system cursor. </p>
<p>Upon window creation, the arrow cursor is used by default.</p>
<dlclass="section warning"><dt>Warning</dt><dd>The cursor must not be destroyed while in use by the window.</dd>
<dd>
Features related to <aclass="el"href="classsf_1_1Cursor.html"title="Cursor defines the appearance of a system cursor. ">Cursor</a> are not supported on iOS and Android.</dd></dl>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">cursor</td><td>Native system cursor type to display</td></tr>
</table>
</dd>
</dl>
<dlclass="section see"><dt>See also</dt><dd><aclass="el"href="classsf_1_1Cursor.html#ad41999c8633c2fbaa2364e379c1ab25b"title="Create a native system cursor. ">sf::Cursor::loadFromSystem</a></dd>
<dd>
<aclass="el"href="classsf_1_1Cursor.html#ac24ecf82ac7d9ba6703389397f948b3a"title="Create a cursor with the provided image. ">sf::Cursor::loadFromPixels</a></dd></dl>
<p>If set, grabs the mouse cursor inside this window's client area so it may no longer be moved outside its bounds. Note that grabbing is only active while the window has focus.</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">grabbed</td><td>True to enable, false to disable </td></tr>
<p>Change the position of the window on screen. </p>
<p>This function only works for top-level windows (i.e. it will be ignored for windows created from the handle of a child window/control).</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">position</td><td>New position, in pixels</td></tr>
</table>
</dd>
</dl>
<dlclass="section see"><dt>See also</dt><dd><aclass="el"href="classsf_1_1Window.html#a420028b8e4d9baedcaaba7b2047b8cb3"title="Get the position of the window. ">getPosition</a></dd></dl>
<p>Change the size of the rendering region of the window. </p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">size</td><td>New size, in pixels</td></tr>
</table>
</dd>
</dl>
<dlclass="section see"><dt>See also</dt><dd><aclass="el"href="classsf_1_1RenderWindow.html#ae3eacf93661c8068fca7a78d57dc7e14"title="Get the size of the rendering region of the window. ">getSize</a></dd></dl>
<p>Enable or disable vertical synchronization. </p>
<p>Activating vertical synchronization will limit the number of frames displayed to the refresh rate of the monitor. This can avoid some visual artifacts, and limit the framerate to a good value (but not constant across different computers).</p>
<p>Vertical synchronization is disabled by default.</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">enabled</td><td>True to enable v-sync, false to deactivate it </td></tr>
<p>The view is like a 2D camera, it controls which part of the 2D scene is visible, and how it is viewed in the render target. The new view will affect everything that is drawn, until another view is set. The render target keeps its own copy of the view object, so it is not necessary to keep the original one alive after calling this function. To restore the original view of the target, you can pass the result of <aclass="el"href="classsf_1_1RenderTarget.html#ad3b533c3f899d7044d981ed607aef9be"title="Get the default view of the render target. ">getDefaultView()</a> to this function.</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">view</td><td>New view to use</td></tr>
</table>
</dd>
</dl>
<dlclass="section see"><dt>See also</dt><dd><aclass="el"href="classsf_1_1RenderTarget.html#a2c179503b4dcdf5282ef6426d317602c"title="Get the view currently in use in the render target. ">getView</a>, <aclass="el"href="classsf_1_1RenderTarget.html#ad3b533c3f899d7044d981ed607aef9be"title="Get the default view of the render target. ">getDefaultView</a></dd></dl>
<p>This function is blocking: if there's no pending event then it will wait until an event is received. After this function returns (and no error occurred), the <em>event</em> object is always valid and filled properly. This function is typically used when you have a thread that is dedicated to events handling: you want to make this thread sleep as long as no new event is received. </p><divclass="fragment"><divclass="line"><aclass="code"href="classsf_1_1Event.html">sf::Event</a> event;</div><divclass="line"><spanclass="keywordflow">if</span> (window.<aclass="code"href="classsf_1_1Window.html#aaf02ab64fbc1d374eef3696df54137bc">waitEvent</a>(event))</div><divclass="line">{</div><divclass="line"><spanclass="comment">// process event...</span></div><divclass="line">}</div></div><!-- fragment --><dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">event</td><td><aclass="el"href="classsf_1_1Event.html"title="Defines a system event and its parameters. ">Event</a> to be returned</td></tr>
</table>
</dd>
</dl>
<dlclass="section return"><dt>Returns</dt><dd>False if any error occurred</dd></dl>
<dlclass="section see"><dt>See also</dt><dd><aclass="el"href="classsf_1_1Window.html#a338e996585faf82e93069858e3b531b7"title="Pop the event on top of the event queue, if any, and return it. ">pollEvent</a></dd></dl>
</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>