Apprendre
Télécharger
Communauté
Développement
Accueil
»
Apprendre
»
Documentation 2.4.0
»
Window.hpp Source File
English
Faire un don
Documentation de SFML 2.4.0
Attention:
cette page se réfère à une ancienne version de SFML. Cliquez ici pour passer à la dernière version.
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
SFML
include
SFML
Window
Window/Window.hpp
1
//
3
// SFML - Simple and Fast Multimedia Library
4
// Copyright (C) 2007-2016 Laurent Gomila (laurent@sfml-dev.org)
5
//
6
// This software is provided 'as-is', without any express or implied warranty.
7
// In no event will the authors be held liable for any damages arising from the use of this software.
8
//
9
// Permission is granted to anyone to use this software for any purpose,
10
// including commercial applications, and to alter it and redistribute it freely,
11
// subject to the following restrictions:
12
//
13
// 1. The origin of this software must not be misrepresented;
14
// you must not claim that you wrote the original software.
15
// If you use this software in a product, an acknowledgment
16
// in the product documentation would be appreciated but is not required.
17
//
18
// 2. Altered source versions must be plainly marked as such,
19
// and must not be misrepresented as being the original software.
20
//
21
// 3. This notice may not be removed or altered from any source distribution.
22
//
24
25
#ifndef SFML_WINDOW_HPP
26
#define SFML_WINDOW_HPP
27
29
// Headers
31
#include <SFML/Window/Export.hpp>
32
#include <SFML/Window/ContextSettings.hpp>
33
#include <SFML/Window/VideoMode.hpp>
34
#include <SFML/Window/WindowHandle.hpp>
35
#include <SFML/Window/WindowStyle.hpp>
36
#include <SFML/Window/GlResource.hpp>
37
#include <SFML/System/Clock.hpp>
38
#include <SFML/System/Vector2.hpp>
39
#include <SFML/System/NonCopyable.hpp>
40
#include <SFML/System/String.hpp>
41
42
43
namespace
sf
44
{
45
namespace
priv
46
{
47
class
GlContext;
48
class
WindowImpl;
49
}
50
51
class
Event;
52
57
class
SFML_WINDOW_API
Window
:
GlResource
,
NonCopyable
58
{
59
public
:
60
68
Window
();
69
89
Window
(
VideoMode
mode,
const
String
& title, Uint32 style =
Style::Default
,
const
ContextSettings
& settings =
ContextSettings
());
90
105
explicit
Window
(WindowHandle handle,
const
ContextSettings
& settings =
ContextSettings
());
106
113
virtual
~
Window
();
114
132
void
create(
VideoMode
mode,
const
String
& title, Uint32 style =
Style::Default
,
const
ContextSettings
& settings =
ContextSettings
());
133
149
void
create(WindowHandle handle,
const
ContextSettings
& settings =
ContextSettings
());
150
161
void
close();
162
173
bool
isOpen()
const
;
174
186
const
ContextSettings
& getSettings()
const
;
187
211
bool
pollEvent(
Event
& event);
212
238
bool
waitEvent(
Event
& event);
239
248
Vector2i
getPosition()
const
;
249
262
void
setPosition(
const
Vector2i
& position);
263
275
Vector2u
getSize()
const
;
276
285
void
setSize(
const
Vector2u
& size);
286
295
void
setTitle(
const
String
& title);
296
314
void
setIcon(
unsigned
int
width,
unsigned
int
height,
const
Uint8* pixels);
315
324
void
setVisible(
bool
visible);
325
339
void
setVerticalSyncEnabled(
bool
enabled);
340
349
void
setMouseCursorVisible(
bool
visible);
350
364
void
setMouseCursorGrabbed(
bool
grabbed);
365
378
void
setKeyRepeatEnabled(
bool
enabled);
379
395
void
setFramerateLimit(
unsigned
int
limit);
396
408
void
setJoystickThreshold(
float
threshold);
409
426
bool
setActive(
bool
active =
true
)
const
;
427
442
void
requestFocus();
443
455
bool
hasFocus()
const
;
456
465
void
display();
466
479
WindowHandle getSystemHandle()
const
;
480
481
protected
:
482
491
virtual
void
onCreate();
492
500
virtual
void
onResize();
501
502
private
:
503
516
bool
filterEvent(
const
Event
& event);
517
522
void
initialize();
523
525
// Member data
527
priv::WindowImpl* m_impl;
528
priv::GlContext* m_context;
529
Clock
m_clock;
530
Time
m_frameTimeLimit;
531
Vector2u
m_size;
532
};
533
534
}
// namespace sf
535
536
537
#endif // SFML_WINDOW_HPP
538
539
sf::String
Utility string class that automatically handles conversions between types and encodings.
Definition:
String.hpp:45
sf
Definition:
AlResource.hpp:34
sf::Time
Represents a time value.
Definition:
Time.hpp:40
sf::GlResource
Base class for classes that require an OpenGL context.
Definition:
GlResource.hpp:40
sf::Event
Defines a system event and its parameters.
Definition:
Event.hpp:44
sf::Style::Default
Default window style.
Definition:
WindowStyle.hpp:46
sf::Window
Window that serves as a target for OpenGL rendering.
Definition:
Window/Window.hpp:57
sf::NonCopyable
Utility class that makes any derived class non-copyable.
Definition:
NonCopyable.hpp:41
sf::ContextSettings
Structure defining the settings of the OpenGL context attached to a window.
Definition:
ContextSettings.hpp:36
sf::VideoMode
VideoMode defines a video mode (width, height, bpp)
Definition:
VideoMode.hpp:41
sf::Clock
Utility class that measures the elapsed time.
Definition:
Clock.hpp:41
sf::Vector2
Utility template class for manipulating 2-dimensional vectors.
Definition:
Vector2.hpp:37