Documentation de SFML 1.6

Attention: cette page se réfère à une ancienne version de SFML. Cliquez ici pour passer à la dernière version.
Window/Window.hpp
1 
2 //
3 // SFML - Simple and Fast Multimedia Library
4 // Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)
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/Event.hpp>
32 #include <SFML/Window/Input.hpp>
33 #include <SFML/Window/VideoMode.hpp>
34 #include <SFML/Window/WindowHandle.hpp>
35 #include <SFML/Window/WindowListener.hpp>
36 #include <SFML/Window/WindowSettings.hpp>
37 #include <SFML/Window/WindowStyle.hpp>
38 #include <SFML/System/Clock.hpp>
39 #include <SFML/System/NonCopyable.hpp>
40 #include <queue>
41 #include <string>
42 
43 
44 namespace sf
45 {
46 namespace priv
47 {
48  class WindowImpl;
49 }
50 
55 class SFML_API Window : public WindowListener, NonCopyable
56 {
57 public :
58 
63  Window();
64 
74  Window(VideoMode Mode, const std::string& Title, unsigned long WindowStyle = Style::Resize | Style::Close, const WindowSettings& Params = WindowSettings());
75 
83  Window(WindowHandle Handle, const WindowSettings& Params = WindowSettings());
84 
89  virtual ~Window();
90 
100  void Create(VideoMode Mode, const std::string& Title, unsigned long WindowStyle = Style::Resize | Style::Close, const WindowSettings& Params = WindowSettings());
101 
109  void Create(WindowHandle Handle, const WindowSettings& Params = WindowSettings());
110 
117  void Close();
118 
127  bool IsOpened() const;
128 
135  unsigned int GetWidth() const;
136 
143  unsigned int GetHeight() const;
144 
151  const WindowSettings& GetSettings() const;
152 
161  bool GetEvent(Event& EventReceived);
162 
169  void UseVerticalSync(bool Enabled);
170 
177  void ShowMouseCursor(bool Show);
178 
186  void SetCursorPosition(unsigned int Left, unsigned int Top);
187 
196  void SetPosition(int Left, int Top);
197 
205  void SetSize(unsigned int Width, unsigned int Height);
206 
213  void Show(bool State);
214 
222  void EnableKeyRepeat(bool Enabled);
223 
232  void SetIcon(unsigned int Width, unsigned int Height, const Uint8* Pixels);
233 
243  bool SetActive(bool Active = true) const;
244 
249  void Display();
250 
257  const Input& GetInput() const;
258 
265  void SetFramerateLimit(unsigned int Limit);
266 
273  float GetFrameTime() const;
274 
282  void SetJoystickThreshold(float Threshold);
283 
284 private :
285 
290  virtual void OnCreate();
291 
298  virtual void OnEvent(const Event& EventReceived);
299 
306  void Initialize(priv::WindowImpl* Impl);
307 
309  // Member data
311  priv::WindowImpl* myWindow;
312  std::queue<Event> myEvents;
313  Input myInput;
314  Clock myClock;
315  WindowSettings mySettings;
316  float myLastFrameTime;
317  bool myIsExternal;
318  unsigned int myFramerateLimit;
319  int mySetCursorPosX;
320  int mySetCursorPosY;
321 };
322 
323 } // namespace sf
324 
325 
326 #endif // SFML_WINDOW_HPP