1<!DOCTYPE html> 2<html lang="en" class="no-js"> 3 <head> 4 <meta charset="utf-8" /> 5 <meta name="viewport" content="width=device-width,initial-scale=1" /> 6 <meta name="description" content="Simple and Fast Multimedia Library" /> 7 <link rel="canonical" href="https://www.sfml-dev.org/documentation/3.1.0/" /> 8 <link rel="icon" href="../../images/favicon.ico" /> 9 <meta name="generator" content="mkdocs-1.6.0, mkdocs-material-9.5.50"> 10 <title>Documentation for SFML 3.1.0 - Simple and Fast Multimedia Library</title> 11 <link rel="stylesheet" href="../../styles/bundle.css" /> 12 <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin /> 13 <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Ubuntu:300,300i,400,400i,700,700i%7CRoboto+Mono:400,400i,700,700i&display=fallback" /> 14 <style> 15 :root { 16 --md-text-font: "Ubuntu"; 17 --md-code-font: "Roboto Mono"; 18 } 19 </style> 20 <link rel="stylesheet" href="../../styles/extra.css" /> 21
21<script> 22 (__md_scope = new URL("../..", location)), 23 (__md_hash = (e) => [...e].reduce((e, _) => (e << 5) - e + _.charCodeAt(0), 0)), 24 (__md_get = (e, _ = localStorage, t = __md_scope) => JSON.parse(_.getItem(t.pathname + "." + e))), 25 (__md_set = (e, _, t = localStorage, a = __md_scope) => { 26 try { 27 t.setItem(a.pathname + "." + e, JSON.stringify(_)); 28 } catch (e) {} 29 }); 30 </script>
30 31 <!-- Doxygen Overrides --> 32 <link rel="stylesheet" type="text/css" href="doxystyle.css" title="default" media="screen,print" /> 33
33<script type="text/javascript" src="jquery.js"></script>
33 34
34<script type="text/javascript" src="dynsections.js"></script>
34 35
35<script type="text/javascript" src="clipboard.js"></script>
35 36
36<script type="text/javascript" src="cookie.js"></script>
36 37
37<script type="text/javascript" src="resize.js"></script>
37 38 <link rel="stylesheet" type="text/css" href="search/search.css" /> 39 <link rel="stylesheet" type="text/css" href="searchOverrides.css" /> 40
40<script type="text/javascript" src="search/searchdata.js"></script>
40 41
41<script type="text/javascript" src="search/search.js"></script>
41 42
42<script type="text/javascript"> 43 /* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */ 44 $(document).ready(function () { 45 init_search(); 46 }); 47 /* @license-end */ 48 </script>
48 49 <!-- Doxygen Overrides --> 50 </head> 51 <body dir="ltr" data-md-color-scheme="default" data-md-color-primary="light-green" data-md-color-accent="indigo"> 52 <input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="__drawer" autocomplete="off" /> 53 <input class="md-toggle" data-md-toggle="search" type="checkbox" id="__search" autocomplete="off" /> 54 <label class="md-overlay" for="__drawer"></label> 55 <div data-md-component="announce"></div> 56 <header class="md-header md-header--shadow md-header--lifted" data-md-component="header"> 57 <nav class="md-header__inner md-grid" aria-label="Header"> 58 <a href="../.." title="Simple and Fast Multimedia Library" class="md-header__button md-logo" aria-label="Simple and Fast Multimedia Library" data-md-component="logo"> 59 <img src="../../images/logo.png" alt="logo" /> 60 </a> 61 <label class="md-header__button md-icon" for="__drawer"> 62 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3 6h18v2H3zm0 5h18v2H3zm0 5h18v2H3z" /></svg> 63 </label> 64 <div class="md-header__title" data-md-component="header-title"> 65 <div class="md-header__ellipsis"> 66 <div class="md-header__topic"> 67 <span class="md-ellipsis"> Simple and Fast Multimedia Library </span> 68 </div> 69 <div class="md-header__topic" data-md-component="header-topic"> 70 <span class="md-ellipsis"> Documentation for SFML 3.0.2 </span> 71 </div> 72 </div> 73 </div> 74 <label class="md-header__button md-icon" for="__search"> 75 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> 76 <path d="M9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.52 6.52 0 0 1 9.5 16 6.5 6.5 0 0 1 3 9.5 6.5 6.5 0 0 1 9.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5" /> 77 </svg> 78 </label> 79 <div class="md-search" data-md-component="search" role="dialog"> 80 <label class="md-search__overlay" for="__search"></label> 81 <div class="md-search__inner" role="search"> 82 <form class="md-search__form" name="search"> 83 <input type="text" class="md-search__input" name="query" aria-label="Search" placeholder="Search" autocapitalize="off" autocorrect="off" autocomplete="off" spellcheck="false" data-md-component="search-query" required /> 84 <label class="md-search__icon md-icon" for="__search"> 85 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> 86 <path 87 d="M9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.52 6.52 0 0 1 9.5 16 6.5 6.5 0 0 1 3 9.5 6.5 6.5 0 0 1 9.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5" 88 /> 89 </svg> 90 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11z" /></svg> 91 </label> 92 <nav class="md-search__options" aria-label="Search"> 93 <button type="reset" class="md-search__icon md-icon" title="Clear" aria-label="Clear" tabindex="-1"> 94 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z" /></svg> 95 </button> 96 </nav> 97 <div class="md-search__suggest" data-md-component="search-suggest"></div> 98 </form> 99 <div class="md-search__output"> 100 <div class="md-search__scrollwrap" tabindex="0" data-md-scrollfix> 101 <div class="md-search-result" data-md-component="search-result"> 102 <div class="md-search-result__meta">Initializing search</div> 103 <ol class="md-search-result__list" role="presentation"></ol> 104 </div> 105 </div> 106 </div> 107 </div> 108 </div> 109 <div class="md-header__source"> 110 <a href="https://github.com/SFML/SFML" title="Go to repository" class="md-source" data-md-component="source"> 111 <div class="md-source__icon md-icon"> 112 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 496 512"> 113 <!--! Font Awesome Free 6.6.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2024 Fonticons, Inc.--> 114 <path 115 d="M165.9 397.4c0 2-2.3 3.6-5.2 3.6-3.3.3-5.6-1.3-5.6-3.6 0-2 2.3-3.6 5.2-3.6 3-.3 5.6 1.3 5.6 3.6m
115-31.1-4.5c-.7 2 1.3 4.3 4.3 4.9 2.6 1 5.6 0 6.2-2s-1.3-4.3-4.3-5.2c-2.6-.7-5.5.3-6.2 2.3m44.2-1.7c-2.9.7-4.9 2.6-4.6 4.9.3 2 2.9 3.3 5.9 2.6 2.9-.7 4.9-2.6 4.6-4.6-.3-1.9-3-3.2-5.9-2.9M244.8 8C106.1 8 0 113.3 0 252c0 110.9 69.8 205.8 169.5 239.2 12.8 2.3 17.3-5.6 17.3-12.1 0-6.2-.3-40.4-.3-61.4 0 0-70 15-84.7-29.8 0 0-11.4-29.1-27.8-36.6 0 0-22.9-15.7 1.6-15.4 0 0 24.9 2 38.6 25.8 21.9 38.6 58.6 27.5 72.9 20.9 2.3-16 8.8-27.1 16-33.7-55.9-6.2-112.3-14.3-112.3-110.5 0-27.5 7.6-41.3 23.6-58.9-2.6-6.5-11.1-33.3 2.6-67.9 20.9-6.5 69 27 69 27 20-5.6 41.5-8.5 62.8-8.5s42.8 2.9 62.8 8.5c0 0 48.1-33.6 69-27 13.7 34.7 5.2 61.4 2.6 67.9 16 17.7 25.8 31.5 25.8 58.9 0 96.5-58.9 104.2-114.8 110.5 9.2 7.9 17 22.9 17 46.4 0 33.7-.3 75.4-.3 83.6 0 6.5 4.6 14.4 17.3 12.1C428.2 457.8 496 362.9 496 252 496 113.3 383.5 8 244.8 8M97.2 352.9c-1.3 1-1 3.3.7 5.2 1.6 1.6 3.9 2.3 5.2 1 1.3-1 1-3.3-.7-5.2-1.6-1.6-3.9-2.3-5.2-1m-10.8-8.1c-.7 1.3.3 2.9 2.3 3.9 1.6 1 3.6.7 4.3-.7.7-1.3-.3-2.9-2.3-3.9-2-.6-3.6-.3-4.3.7m32.4 35.6c-1.6 1.3-1 4.3 1.3 6.2 2.3 2.3 5.2 2.6 6.5 1 1.3-1.3.7-4.3-1.3-6.2-2.2-2.3-5.2-2.6-6.5-1m-11.4-14.7c-1.6 1-1.6 3.6 0 5.9s4.3 3.3 5.6 2.3c1.6-1.3 1.6-3.9 0-6.2-1.4-2.3-4-3.3-5.6-2" 116 /> 117 </svg> 118 </div> 119 <div class="md-source__repository">SFML</div> 120 </a> 121 </div> 122 </nav> 123 <nav class="md-tabs" aria-label="Tabs" data-md-component="tabs"> 124 <div class="md-grid"> 125 <ul class="md-tabs__list"> 126 <li class="md-tabs__item"> 127 <a href="/" class="md-tabs__link"> Home </a> 128 </li> 129 <li class="md-tabs__item"> 130 <a href="/learn/" class="md-tabs__link"> Learn </a> 131 </li> 132 <li class="md-tabs__item"> 133 <a href="/tutorials/3.1/" class="md-tabs__link"> Tutorials </a> 134 </li> 135 <li class="md-tabs__item md-tabs__item--active"> 136 <a href="/documentation/3.1.0/" class="md-tabs__link"> Documentation </a> 137 </li> 138 <li class="md-tabs__item"> 139 <a href="/download/" class="md-tabs__link"> Download </a> 140 </li> 141 <li class="md-tabs__item"> 142 <a href="/community/" class="md-tabs__link"> Community </a> 143 </li> 144 <li class="md-tabs__item"> 145 <a href="/development/" class="md-tabs__link"> Development </a> 146 </li> 147 <li class="md-tabs__item"> 148 <a href="/donate/" class="md-tabs__link"> Donate </a> 149 </li> 150 </ul> 151 </div> 152 </nav> 153 </header> 154 <div class="md-container" data-md-component="container"> 155 <main class="md-main" data-md-component="main"> 156 <div class="md-main__inner md-grid"> 157 <div class="md-sidebar md-sidebar--primary" data-md-component="sidebar" data-md-type="navigation"> 158 <div class="md-sidebar__scrollwrap" style="height: 832px"> 159 <div class="md-sidebar__inner"> 160 <nav class="md-nav md-nav--primary md-nav--lifted" aria-label="Navigation" data-md-level="0"> 161 <label class="md-nav__title" for="__drawer"> 162 <a href="../.." title="Simple and Fast Multimedia Library" class="md-nav__button md-logo" aria-label="Simple and Fast Multimedia Library" data-md-component="logo"> 163 <img src="../../images/logo.png" alt="logo" /> 164 </a> 165 Simple and Fast Multimedia Library 166 </label> 167 <div class="md-nav__source"> 168 <a href="https://github.com/SFML/SFML" title="Go to repository" class="md-source" data-md-component="source"> 169 <div class="md-source__icon md-icon"> 170 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 496 512"> 171 <!--! Font Awesome Free 6.6.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2024 Fonticons, Inc.--> 172 <path 173 d="M165.9 397.4c0 2-2.3 3.6-5.2 3.6-3.3.3-5.6-1.3-5.6-3.6 0-2 2.3-3.6 5.2-3.6 3-.3 5.6 1.3 5.6 3.6m
173-31.1-4.5c-.7 2 1.3 4.3 4.3 4.9 2.6 1 5.6 0 6.2-2s-1.3-4.3-4.3-5.2c-2.6-.7-5.5.3-6.2 2.3m44.2-1.7c-2.9.7-4.9 2.6-4.6 4.9.3 2 2.9 3.3 5.9 2.6 2.9-.7 4.9-2.6 4.6-4.6-.3-1.9-3-3.2-5.9-2.9M244.8 8C106.1 8 0 113.3 0 252c0 110.9 69.8 205.8 169.5 239.2 12.8 2.3 17.3-5.6 17.3-12.1 0-6.2-.3-40.4-.3-61.4 0 0-70 15-84.7-29.8 0 0-11.4-29.1-27.8-36.6 0 0-22.9-15.7 1.6-15.4 0 0 24.9 2 38.6 25.8 21.9 38.6 58.6 27.5 72.9 20.9 2.3-16 8.8-27.1 16-33.7-55.9-6.2-112.3-14.3-112.3-110.5 0-27.5 7.6-41.3 23.6-58.9-2.6-6.5-11.1-33.3 2.6-67.9 20.9-6.5 69 27 69 27 20-5.6 41.5-8.5 62.8-8.5s42.8 2.9 62.8 8.5c0 0 48.1-33.6 69-27 13.7 34.7 5.2 61.4 2.6 67.9 16 17.7 25.8 31.5 25.8 58.9 0 96.5-58.9 104.2-114.8 110.5 9.2 7.9 17 22.9 17 46.4 0 33.7-.3 75.4-.3 83.6 0 6.5 4.6 14.4 17.3 12.1C428.2 457.8 496 362.9 496 252 496 113.3 383.5 8 244.8 8M97.2 352.9c-1.3 1-1 3.3.7 5.2 1.6 1.6 3.9 2.3 5.2 1 1.3-1 1-3.3-.7-5.2-1.6-1.6-3.9-2.3-5.2-1m-10.8-8.1c-.7 1.3.3 2.9 2.3 3.9 1.6 1 3.6.7 4.3-.7.7-1.3-.3-2.9-2.3-3.9-2-.6-3.6-.3-4.3.7m32.4 35.6c-1.6 1.3-1 4.3 1.3 6.2 2.3 2.3 5.2 2.6 6.5 1 1.3-1.3.7-4.3-1.3-6.2-2.2-2.3-5.2-2.6-6.5-1m-11.4-14.7c-1.6 1-1.6 3.6 0 5.9s4.3 3.3 5.6 2.3c1.6-1.3 1.6-3.9 0-6.2-1.4-2.3-4-3.3-5.6-2" 174 ></path> 175 </svg> 176 </div> 177 <div class="md-source__repository md-source__repository--active"> 178 </div> 179 </a> 180 </div> 181 <ul class="md-nav__list"> 182 <li class="md-nav__item"> 183 <a href="/" class="md-nav__link"> 184 <span class="md-ellipsis"> Home </span> 185 </a> 186 </li> 187 <li class="md-nav__item"> 188 <a href="/learn/" class="md-nav__link"> 189 <span class="md-ellipsis"> Learn </span> 190 </a> 191 </li> 192 <li class="md-nav__item md-nav__item--pruned md-nav__item--nested"> 193 <a href="/tutorials/3.1/" class="md-nav__link"> 194 <span class="md-ellipsis"> Tutorials </span> 195 <span class="md-nav__icon md-icon"></span> 196 </a> 197 </li> 198 <li class="md-nav__item md-nav__item--active md-nav__item--section md-nav__item--nested"> 199 <input class="md-nav__toggle md-toggle" type="checkbox" id="__nav_4" checked="" /> 200 <div class="md-nav__link md-nav__container"> 201 <a href="/documentation/3.1.0/" class="md-nav__link md-nav__link--active"> 202 <span class="md-ellipsis"> Documentation </span> 203 </a> 204 <label class="md-nav__link md-nav__link--active" for="__nav_4" id="__nav_4_label" tabindex=""> 205 <span class="md-nav__icon md-icon"></span> 206 </label> 207 </div> 208 <nav class="md-nav" data-md-level="1" aria-labelledby="__nav_4_label" aria-expanded="true"> 209 <label class="md-nav__title" for="__nav_4"> 210 <span class="md-nav__icon md-icon"></span> 211 Documentation 212 </label> 213 <ul class="md-nav__list"> 214 <li class="md-nav__item"> 215 <a href="/documentation/3.1.0/" class="md-nav__link md-nav__link--active">
216 <span class="md-ellipsis"> SFML 3.1.0 </span> 217 </a> 218 </li> 219 <li class="md-nav__item"> 220 <a href="/documentation/3.0.2/" class="md-nav__link"> 221 <span class="md-ellipsis"> SFML 3.0.2 </span> 222 </a> 223 </li> 224 <li class="md-nav__item"> 225 <a href="/documentation/3.0.1/" class="md-nav__link"> 226 <span class="md-ellipsis"> SFML 3.0.1 </span> 227 </a> 228 </li> 229 <li class="md-nav__item"> 230 <a href="/documentation/3.0.0/" class="md-nav__link"> 231 <span class="md-ellipsis"> SFML 3.0.0 </span> 232 </a> 233 </li> 234 <li class="md-nav__item"> 235 <a href="https://www.sfml-dev.org/documentation/2.6.2/" class="md-nav__link"> 236 <span class="md-ellipsis"> SFML 2.6.2 </span> 237 </a> 238 </li> 239 <li class="md-nav__item"> 240 <a href="https://www.sfml-dev.org/documentation/2.6.1/" class="md-nav__link"> 241 <span class="md-ellipsis"> SFML 2.6.1 </span> 242 </a> 243 </li> 244 <li class="md-nav__item"> 245 <a href="https://www.sfml-dev.org/documentation/2.6.0/" class="md-nav__link"> 246 <span class="md-ellipsis"> SFML 2.6.0 </span> 247 </a> 248 </li> 249 <li class="md-nav__item"> 250 <a href="https://www.sfml-dev.org/documentation/2.5.1/" class="md-nav__link"> 251 <span class="md-ellipsis"> SFML 2.5.1 </span> 252 </a> 253 </li> 254 <li class="md-nav__item"> 255 <a href="https://www.sfml-dev.org/documentation/2.5.0/" class="md-nav__link"> 256 <span class="md-ellipsis"> SFML 2.5.0 </span> 257 </a> 258 </li> 259 <li class="md-nav__item"> 260 <a href="https://www.sfml-dev.org/documentation/2.4.2/" class="md-nav__link"> 261 <span class="md-ellipsis"> SFML 2.4.2 </span> 262 </a> 263 </li> 264 <li class="md-nav__item"> 265 <a href="https://www.sfml-dev.org/documentation/2.4.1/" class="md-nav__link">
266 <span class="md-ellipsis"> SFML 2.4.1 </span> 267 </a> 268 </li> 269 <li class="md-nav__item"> 270 <a href="https://www.sfml-dev.org/documentation/2.4.0/" class="md-nav__link"> 271 <span class="md-ellipsis"> SFML 2.4.0 </span> 272 </a> 273 </li> 274 <li class="md-nav__item"> 275 <a href="https://www.sfml-dev.org/documentation/2.3.2/" class="md-nav__link"> 276 <span class="md-ellipsis"> SFML 2.3.2 </span> 277 </a> 278 </li> 279 <li class="md-nav__item"> 280 <a href="https://www.sfml-dev.org/documentation/2.3.1/" class="md-nav__link"> 281 <span class="md-ellipsis"> SFML 2.3.1 </span> 282 </a> 283 </li> 284 <li class="md-nav__item"> 285 <a href="https://www.sfml-dev.org/documentation/2.3/" class="md-nav__link"> 286 <span class="md-ellipsis"> SFML 2.3 </span> 287 </a> 288 </li> 289 <li class="md-nav__item"> 290 <a href="https://www.sfml-dev.org/documentation/2.2/" class="md-nav__link"> 291 <span class="md-ellipsis"> SFML 2.2 </span> 292 </a> 293 </li> 294 <li class="md-nav__item"> 295 <a href="https://www.sfml-dev.org/documentation/2.1/" class="md-nav__link"> 296 <span class="md-ellipsis"> SFML 2.1 </span> 297 </a> 298 </li> 299 <li class="md-nav__item"> 300 <a href="https://www.sfml-dev.org/documentation/2.0/" class="md-nav__link"> 301 <span class="md-ellipsis"> SFML 2.0 </span> 302 </a> 303 </li> 304 <li class="md-nav__item"> 305 <a href="https://www.sfml-dev.org/documentation/1.6/" class="md-nav__link"> 306 <span class="md-ellipsis"> SFML 1.6 </span> 307 </a> 308 </li> 309 </ul> 310 </nav> 311 </li> 312 <li class="md-nav__item"> 313 <a href="/download/" class="md-nav__link"> 314 <span class="md-ellipsis"> Download </span> 315 </a> 316 </li> 317 <li class="md-nav__item"> 318 <a href="/community/" class="md-nav__link">
319 <span class="md-ellipsis"> Community </span> 320 </a> 321 </li> 322 <li class="md-nav__item"> 323 <a href="/development/" class="md-nav__link"> 324 <span class="md-ellipsis"> Development </span> 325 </a> 326 </li> 327 </ul> 328 </nav> 329 </div> 330 </div> 331 </div> 332 <div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" style="top: 158px"> 333 <div class="md-sidebar__scrollwrap" style="height: 832px"> 334 <div class="md-sidebar__inner"> 335 <nav class="md-nav md-nav--secondary" aria-label="Table of contents"></nav> 336 </div> 337 </div> 338 </div> 339 <div class="md-content contents"> 340 <div><!-- top --> 341<!-- Generated by Doxygen 1.16.1 -->
342<script type="text/javascript"> 343var searchBox = new SearchBox("searchBox", "search/",'.html'); 344</script>
vendor: 1 bytes, line 344
344
345<script type="text/javascript"> 346$(function() { codefold.init(); }); 347</script>
347 348<div id="main-nav"> 349 <div id="navrow1" class="tabs"> 350 <ul class="tablist"> 351 <li class="current"><a href="index.html"><span>Main Page</span></a></li> 352 <li><a href="pages.html"><span>Related Pages</span></a></li> 353 <li><a href="topics.html"><span>Topics</span></a></li> 354 <li><a href="namespaces.html"><span>Namespaces</span></a></li> 355 <li><a href="annotated.html"><span>Classes</span></a></li> 356 <li><a href="files.html"><span>Files</span></a></li> 357 <li> 358 <div id="MSearchBox" class="MSearchBoxInactive"> 359 <span class="left"> 360 <span id="MSearchSelect" class="search-icon" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()"><span class="search-icon-dropdown"></span></span> 361 <input type="text" id="MSearchField" value="" placeholder="Search" accesskey="S" 362 onfocus="searchBox.OnSearchFieldFocus(true)" 363 onblur="searchBox.OnSearchFieldFocus(false)" 364 onkeyup="searchBox.OnSearchFieldChange(event)"/> 365 </span><span class="right"> 366 <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><div id="MSearchCloseImg" class="close-icon"></div></a> 367 </span> 368 </div> 369 </li> 370 </ul> 371 </div> 372</div><!-- main-nav --> 373</div><!-- top --> 374<div id="doc-content"> 375<!-- window showing the filter options --> 376<div id="MSearchSelectWindow" 377 onmouseover="return searchBox.OnSearchSelectShow()" 378 onmouseout="return searchBox.OnSearchSelectHide()" 379 onkeydown="return searchBox.OnSearchSelectKey(event)"> 380</div> 381 382<!-- iframe showing the search results (closed by default) --> 383<div id="MSearchResultsWindow"> 384<div id="MSearchResults"> 385<div class="SRPage"> 386<div id="SRIndex"> 387<div id="SRResults"></div> 388<div class="SRStatus" id="Loading">Loading...</div> 389<div class="SRStatus" id="Searching">Searching...</div> 390<div class="SRStatus" id="NoMatches">No Matches</div> 391</div> 392</div> 393</div> 394</div> 395 396<div><div class="header"> 397 <div class="headertitle"><div class="title">SFML Documentation </div></div> 398</div><!--header--> 399<div class="contents"> 400<div class="textblock"><h1 class="doxsection"><a class="anchor" id="welcome"></a> 401Welcome</h1> 402<p>Welcome to the official SFML documentation. Here you will find a detailed view of all the SFML classes and functions. <br /> 403 If you are looking for tutorials, you can visit the official website at <a href="https://www.sfml-dev.org/">www.sfml-dev.org</a>.</p> 404<h1 class="doxsection"><a class="anchor" id="example"></a> 405Short example</h1> 406<p>Here is a short example, to show you how simple it is to use SFML:</p> 407<div class="fragment"><div class="line"><span class="preprocessor">#include <<a class="code" href="Audio_8hpp.html">SFML/Audio.hpp</a>></span></div> 408<div class="line"><span class="preprocessor">#include <<a class="code" href="Graphics_8hpp.html">SFML/Graphics.hpp</a>></span></div> 409<div class="line"> </div> 410<div class="line"><span class="keywordtype">int</span> main()</div> 411<div class="line">{</div> 412<div class="line"> <span class="comment">// Create the main window</span></div> 413<div class="line"> <a class="code hl_class" href="classsf_1_1RenderWindow.html">sf::RenderWindow</a> window(<a class="code hl_class" href="classsf_1_1VideoMode.html">sf::VideoMode</a>({800, 600}), <span class="stringliteral">"SFML window"</span>);</div> 414<div class="line"> </div> 415<div class="line"> <span class="comment">// Load a sprite to display</span></div> 416<div class="line"> <span class="keyword">const</span> <a class="code hl_class" href="classsf_1_1Texture.html">sf::Texture</a> texture(<span class="stringliteral">"cute_image.jpg"</span>);</div> 417<div class="line"> <a class="code hl_class" href="classsf_1_1Sprite.html">sf::Sprite</a> sprite(texture);</div> 418<div class="line"> </div> 419<div class="line"> <span class="comment">// Create a graphical text to display</span></div> 420<div class="line"> <span class="keyword">const</span> <a class="code hl_class" href="classsf_1_1Font.html">sf::Font</a> font(<span class="stringliteral">"arial.ttf"</span>);</div> 421<div class="line"> <a class="code hl_class" href="classsf_1_1Text.html">sf::Text</a> text(font, <span class="stringliteral">"Hello SFML"</span>, 50);</div> 422<div class="line"> </div> 423<div class="line"> <span class="comment">// Load a music to play</span></div> 424<div class="line"> <a class="code hl_class" href="classsf_1_1Music.html">sf::Music</a> music(<span class="stringliteral">"nice_music.ogg"</span>);</div> 425<div class="line"> </div> 426<div class="line"> <span class="comment">// Play the music</span></div> 427<div class="line"> music.play();</div> 428<div class="line"> </div> 429<div class="line"> <span class="comment">// Start the game loop</span></div> 430<div class="line"> <span class="keywordflow">while</span> (window.<a class="code hl_function" href="classsf_1_1WindowBase.html#aa43559822564ef958dc664a90c57cba0">isOpen</a>())</div> 431<div class="line"> {</div> 432<div class="line">
432 <span class="comment">// Process events</span></div> 433<div class="line"> <span class="keywordflow">while</span> (<span class="keyword">const</span> std::optional event = window.<a class="code hl_function" href="classsf_1_1WindowBase.html#a6090926b477e9d0a83854b94b9e1fd35">pollEvent</a>())</div> 434<div class="line"> {</div> 435<div class="line"> <span class="comment">// Close window: exit</span></div> 436<div class="line"> <span class="keywordflow">if</span> (event->is<<a class="code hl_struct" href="structsf_1_1Event_1_1Closed.html">sf::Event::Closed</a>>())</div> 437<div class="line"> window.<a class="code hl_function" href="classsf_1_1Window.html#ab1d808a3682db8d113d67354bcbd717d">close</a>();</div> 438<div class="line"> }</div> 439<div class="line"> </div> 440<div class="line"> <span class="comment">// Clear screen</span></div> 441<div class="line"> window.<a class="code hl_function" href="classsf_1_1RenderTarget.html#aee353fc2cd35edf0747e710301af3e4c">clear</a>();</div> 442<div class="line"> </div> 443<div class="line"> <span class="comment">// Draw the sprite</span></div> 444<div class="line"> window.<a class="code hl_function" href="classsf_1_1RenderTarget.html#a12417a3bcc245c41d957b29583556f39">draw</a>(sprite);</div> 445<div class="line"> </div> 446<div class="line"> <span class="comment">// Draw the string</span></div> 447<div class="line"> window.<a class="code hl_function" href="classsf_1_1RenderTarget.html#a12417a3bcc245c41d957b29583556f39">draw</a>(text);</div> 448<div class="line"> </div> 449<div class="line"> <span class="comment">// Update the window</span></div> 450<div class="line"> window.<a class="code hl_function" href="classsf_1_1Window.html#adabf839cb103ac96cfc82f781638772a">display</a>();</div> 451<div class="line"> }</div> 452<div class="line">}</div> 453<div class="ttc" id="aAudio_8hpp_html"><div class="ttname"><a href="Audio_8hpp.html">Audio.hpp</a></div></div> 454<div class="ttc" id="aGraphics_8hpp_html"><div class="ttname"><a href="Graphics_8hpp.html">Graphics.hpp</a></div></div> 455<div class="ttc" id="aclasssf_1_1Font_html"><div class="ttname"><a href="classsf_1_1Font.html">sf::Font</a></div><div class="ttdoc">Class for loading and manipulating character fonts.</div><div class="ttdef"><b>
455Definition</b> <a href="Font_8hpp_source.html#l00057">Font.hpp:58</a></div></div> 456<div class="ttc" id="aclasssf_1_1Music_html"><div class="ttname"><a href="classsf_1_1Music.html">sf::Music</a></div><div class="ttdoc">Streamed music played from an audio file.</div><div class="ttdef"><b>Definition</b> <a href="Music_8hpp_source.html#l00052">Music.hpp:53</a></div></div> 457<div class="ttc" id="aclasssf_1_1RenderTarget_html_a12417a3bcc245c41d957b29583556f39"><div class="ttname"><a href="classsf_1_1RenderTarget.html#a12417a3bcc245c41d957b29583556f39">sf::RenderTarget::draw</a></div><div class="ttdeci">void draw(const Drawable &drawable, const RenderStates &states=RenderStates::Default)</div><div class="ttdoc">Draw a drawable object to the render target.</div></div> 458<div class="ttc" id="aclasssf_1_1RenderTarget_html_aee353fc2cd35edf0747e710301af3e4c"><div class="ttname"><a href="classsf_1_1RenderTarget.html#aee353fc2cd35edf0747e710301af3e4c">sf::RenderTarget::clear</a></div><div class="ttdeci">void clear(Color color=Color::Black)</div><div class="ttdoc">Clear the entire target with a single color.</div></div> 459<div class="ttc" id="aclasssf_1_1RenderWindow_html"><div class="ttname"><a href="classsf_1_1RenderWindow.html">sf::RenderWindow</a></div><div class="ttdoc">Window that can serve as a target for 2D drawing.</div><div class="ttdef"><b>
459Definition</b> <a href="RenderWindow_8hpp_source.html#l00054">RenderWindow.hpp:55</a></div></div> 460<div class="ttc" id="aclasssf_1_1Sprite_html"><div class="ttname"><a href="classsf_1_1Sprite.html">sf::Sprite</a></div><div class="ttdoc">Drawable representation of a texture, with its own transformations, color, etc.</div><div class="ttdef"><b>Definition</b> <a href="Sprite_8hpp_source.html#l00050">Sprite.hpp:51</a></div></div> 461<div class="ttc" id="aclasssf_1_1Text_html"><div class="ttname"><a href="classsf_1_1Text.html">sf::Text</a></div><div class="ttdoc">Graphical text that can be drawn to a render target.</div><div class="ttdef"><b>Definition</b> <a href="Text_8hpp_source.html#l00060">Text.hpp:61</a></div></div> 462<div class="ttc" id="aclasssf_1_1Texture_html"><div class="ttname"><a href="classsf_1_1Texture.html">sf::Texture</a></div><div class="ttdoc">Image living on the graphics card that can be used for drawing.</div><div class="ttdef"><b>Definition</b> <a href="Texture_8hpp_source.html#l00055">Texture.hpp:56</a></div></div> 463<div class="ttc" id="aclasssf_1_1VideoMode_html"><div class="ttname"><a href="classsf_1_1VideoMode.html">sf::VideoMode</a></div><div class="ttdoc">VideoMode defines a video mode (size, bpp).</div><div class="ttdef"><b>
463Definition</b> <a href="VideoMode_8hpp_source.html#l00043">VideoMode.hpp:44</a></div></div> 464<div class="ttc" id="aclasssf_1_1WindowBase_html_a6090926b477e9d0a83854b94b9e1fd35"><div class="ttname"><a href="classsf_1_1WindowBase.html#a6090926b477e9d0a83854b94b9e1fd35">sf::WindowBase::pollEvent</a></div><div class="ttdeci">std::optional< Event > pollEvent()</div><div class="ttdoc">Pop the next event from the front of the FIFO event queue, if any, and return it.</div></div> 465<div class="ttc" id="aclasssf_1_1WindowBase_html_aa43559822564ef958dc664a90c57cba0"><div class="ttname"><a href="classsf_1_1WindowBase.html#aa43559822564ef958dc664a90c57cba0">sf::WindowBase::isOpen</a></div><div class="ttdeci">bool isOpen() const</div><div class="ttdoc">Tell whether or not the window is open.</div></div> 466<div class="ttc" id="aclasssf_1_1Window_html_ab1d808a3682db8d113d67354bcbd717d"><div class="ttname"><a href="classsf_1_1Window.html#ab1d808a3682db8d113d67354bcbd717d">sf::Window::close</a></div><div class="ttdeci">void close() override</div><div class="ttdoc">Close the window and destroy all the attached resources.</div></div> 467<div class="ttc" id="aclasssf_1_1Window_html_adabf839cb103ac96cfc82f781638772a"><div class="ttname"><a href="classsf_1_1Window.html#adabf839cb103ac96cfc82f781638772a">sf::Window::display</a></div><div class="ttdeci">void display()</div><div class="ttdoc">Display on screen what has been rendered to the window so far.</div></div> 468<div class="ttc" id="astructsf_1_1Event_1_1Closed_html"><div class="ttname"><a href="structsf_1_1Event_1_1Closed.html">sf::Event::Closed</a></div><div class="ttdoc">Closed event subtype.</div><div class="ttdef"><b>
468Definition</b> <a href="Event_8hpp_source.html#l00054">Event.hpp:55</a></div></div> 469</div><!-- fragment --> </div></div><!-- PageDoc --> 470<a href="doxygen_crawl.html"></a> 471</div><!-- contents --> 472 473 </div> 474 </div> 475 </div> 476 <button type="button" class="md-top md-icon" data-md-component="top" hidden> 477 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M13 20h-2V8l-5.5 5.5-1.42-1.42L12 4.16l7.92 7.92-1.42 1.42L13 8z" /></svg> 478 Back to top 479 </button> 480 </main> 481 <footer class="md-footer"> 482 <div class="md-footer-meta md-typeset"> 483 <div class="md-footer-meta__inner md-grid"> 484 <div class="md-copyright"> 485 <div class="md-copyright__highlight">Copyright © <a href="mailto:[email protected]">Laurent Gomila</a></div> 486 </div> 487 <div class="md-social"> 488 <a href="https://fosstodon.org/@sfml" target="_blank" rel="noopener me" title="SFML on Fosstodon" class="md-social__link"> 489 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"> 490 <!--! Font Awesome Free 6.6.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2024 Fonticons, Inc.--> 491 <path 492 d="M433 179.11c0-97.2-63.71-125.7-63.71-125.7-62.52-28.7-228.56-28.4-290.48 0 0 0-63.72 28.5-63.72 125.7 0 115.7-6.6 259.4 105.63 289.1 40.51 10.7 75.32 13 103.33 11.4 50.81-2.8 79.32-18.1 79.32-18.1l-1.7-36.9s-36.31 11.4-77.12 10.1c-40.41-1.4-83-4.4-89.63-54a102.5 102.5 0 0 1-.9-13.9c85.63 20.9 158.65 9.1 178.75 6.7 56.12-6.7 105-41.3 111.23-72.9 9.8-49.8 9-121.5 9-121.5m-75.12 125.2h-46.63v-114.2c0-49.7-64-51.6-64 6.9v62.5h-46.33V197c0-58.5-64-56.6-64-6.9v114.2H90.19c0-122.1-5.2-147.9 18.41-175 25.9-28.9 79.82-30.8 103.83 6.1l11.6 19.5 11.6-19.5c24.11-37.1 78.12-34.8 103.83-6.1 23.71 27.3 18.4 53 18.4 175z" 493 /> 494 </svg> 495 </a> 496 <a href="https://twitter.com/sfmldev" target="_blank" rel="noopener" title="SFML on Twitter" class="md-social__link"> 497 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"> 498 <!--! Font Awesome Free 6.6.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2024 Fonticons, Inc.--> 499 <path 500 d="M459.37 151.716c.325 4.548.325 9.097.325 13.645 0 138.72-105.583 298.558-298.558 298.558-59.452 0-114.68-17.219-161.137-47.106 8.447.974 16.568 1.299 25.34 1.299 49.055 0 94.213-16.568 130.274-44.832-46.132-.975-84.792-31.188-98.112-72.772 6.498.974 12.995 1.624 19.818 1.624 9.421 0 18.843-1.3 27.614-3.573-48.081-9.747-84.143-51.98-84.143-102.985v-1.299c13.969 7.797 30.214 12.67 47.431 13.319-28.264-18.843-46.781-51.005-46.781-87.391 0-19.492 5.197-37.36 14.294-52.954 51.655 63.675 129.3 105.258 216.365 109.807-1.624-7.797-2.599-15.918-2.599-24.04 0-57.828 46.782-104.934 104.934-104.934 30.213 0 57.502 12.67 76.67 33.137 23.715-4.548 46.456-13.32 66.599-25.34-7.798 24.366-24.366 44.833-46.132 57.827 21.117-2.273 41.584-8.122 60.426-16.243-14.292 20.791-32.161 39.308-52.628 54.253" 501 /> 502 </svg> 503 </a> 504 <a href="https://bsky.app/profile/sfml.bsky.social" target="_blank" rel="noopener" title="SFML on Bluesky" class="md-social__link"> 505 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"> 506 <!--! Font Awesome Free 6.6.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2024 Fonticons, Inc.--> 507 <path 508 d="M407.8 294.7c-3.3-.4-6.7-.8-10-1.3 3.4.4 6.7.9 10 1.3M288 227.1c-26.1-50.7-97.1-145.2-163.1-191.8C61.6-9.4 37.5-1.7 21.6 5.5 3.3 13.8 0 41.9 0 58.4S9.1 194 15 213.9c19.5 65.7 89.1 87.9 153.2 80.7 3.3-.5 6.6-.9 10-1.4-3.3.5-6.6 1-10 1.4-93.9 14-177.3 48.2-67.9 169.9C220.6 589.1 265.1 437.8 288 361.1c22.9 76.7 49.2 222.5 185.6 103.4 102.4-103.4 28.1-156-65.8-169.9-3.3-.4-6.7-.8-10-1.3 3.4.4 6.7.9 10 1.3 64.1 7.1 133.6-15.1 153.2-80.7C566.9 194 5
50876 75 576 58.4s-3.3-44.7-21.6-52.9c-15.8-7.1-40-14.9-103.2 29.8C385.1 81.9 314.1 176.4 288 227.1" 509 ></path> 510 </svg> 511 </a> 512 <a href="https://discord.gg/nr4X7Fh" target="_blank" rel="noopener" title="SFML's Discord Server" class="md-social__link"> 513 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512"> 514 <!--! Font Awesome Free 6.6.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2024 Fonticons, Inc.--> 515 <path 516 d="M524.531 69.836a1.5 1.5 0 0 0-.764-.7A485 485 0 0 0 404.081 32.03a1.82 1.82 0 0 0-1.923.91 338 338 0 0 0-14.9 30.6 447.9 447.9 0 0 0-134.426 0 310 310 0 0 0-15.135-30.6 1.89 1.89 0 0 0-1.924-.91 483.7 483.7 0 0 0-119.688 37.107 1.7 1.7 0 0 0-.788.676C39.068 183.651 18.186 294.69 28.43 404.354a2.02 2.02 0 0 0 .765 1.375 487.7 487.7 0 0 0 146.825 74.189 1.9 1.9 0 0 0 2.063-.676A348 348 0 0 0 208.12 430.4a1.86 1.86 0 0 0-1.019-2.588 321 321 0 0 1-45.868-21.853 1.885 1.885 0 0 1-.185-3.126 251 251 0 0 0 9.109-7.137 1.82 1.82 0 0 1 1.9-.256c96.229 43.917 200.41 43.917 295.5 0a1.81 1.81 0 0 1 1.924.233 235 235 0 0 0 9.132 7.16 1.884 1.884 0 0 1-.162 3.126 301.4 301.4 0 0 1-45.89 21.83 1.875 1.875 0 0 0-1 2.611 391 391 0 0 0 30.014 48.815 1.86 1.86 0 0 0 2.063.7A486 486 0 0 0 610.7 405.729a1.88 1.88 0 0 0 .765-1.352c12.264-126.783-20.532-236.912-86.934-334.541M222.491 337.58c-28.972 0-52.844-26.587-52.844-59.239s23.409-59.241 52.844-59.241c29.665 0 53.306 26.82 52.843 59.239 0 32.654-23.41 59.241-52.843 59.241m195.38 0c-28.971 0-52.843-26.587-52.843-59.239s23.409-59.241 52.843-59.241c29.667 0 53.307 26.82 52.844 59.239 0 32.654-23.177 59.241-52.844 59.241" 517 /> 518 </svg> 519 </a> 520 </div> 521 </div> 522 </div> 523 </footer> 524 </div> 525 <div class="md-dialog" data-md-component="dialog"> 526 <div class="md-dialog__inner md-typeset"></div> 527 </div> 528
528<script id="__config" type="application/json"> 529 { 530 "base": "../..", 531 "features": ["content.code.copy", "navigation.tracking", "navigation.tabs", "navigation.tabs.sticky", "navigation.prune", "navigation.path", "navigation.indexes", "navigation.top", "navigation.footer", "toc.follow", "search.suggest"], 532 "search": "../../../assets/javascripts/workers/search.2c215733.min.js", 533 "translations": { 534 "clipboard.copied": "Copied to clipboard", 535 "clipboard.copy": "Copy to clipboard", 536 "search.result.more.one": "1 more on this page", 537 "search.result.more.other": "# more on this page", 538 "search.result.none": "No matching documents", 539 "search.result.one": "1 matching document", 540 "search.result.other": "# matching documents", 541 "search.result.placeholder": "Type to start searching", 542 "search.result.term.missing": "Missing", 543 "select.version": "Select version" 544 } 545 } 546 </script>
546 547
547<script src="../../javascripts/bundle.js"></script>
547 548 </body> 549</html>
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.