00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00024
00025 #ifndef SFML_WINDOW_HPP
00026 #define SFML_WINDOW_HPP
00027
00029
00031 #include <SFML/Window/ContextSettings.hpp>
00032 #include <SFML/Window/VideoMode.hpp>
00033 #include <SFML/Window/WindowHandle.hpp>
00034 #include <SFML/Window/WindowStyle.hpp>
00035 #include <SFML/Window/GlResource.hpp>
00036 #include <SFML/System/Clock.hpp>
00037 #include <SFML/System/Vector2.hpp>
00038 #include <SFML/System/NonCopyable.hpp>
00039 #include <string>
00040
00041
00042 namespace sf
00043 {
00044 namespace priv
00045 {
00046 class GlContext;
00047 class WindowImpl;
00048 }
00049
00050 class Event;
00051
00056 class SFML_API Window : GlResource, NonCopyable
00057 {
00058 public :
00059
00067 Window();
00068
00088 Window(VideoMode mode, const std::string& title, unsigned long style = Style::Default, const ContextSettings& settings = ContextSettings());
00089
00104 explicit Window(WindowHandle handle, const ContextSettings& settings = ContextSettings());
00105
00112 virtual ~Window();
00113
00127 void Create(VideoMode mode, const std::string& title, unsigned long style = Style::Default, const ContextSettings& settings = ContextSettings());
00128
00140 void Create(WindowHandle handle, const ContextSettings& settings = ContextSettings());
00141
00152 void Close();
00153
00163 bool IsOpened() const;
00164
00176 unsigned int GetWidth() const;
00177
00189 unsigned int GetHeight() const;
00190
00202 const ContextSettings& GetSettings() const;
00203
00227 bool PollEvent(Event& event);
00228
00254 bool WaitEvent(Event& event);
00255
00269 void EnableVerticalSync(bool enabled);
00270
00279 void ShowMouseCursor(bool show);
00280
00292 void SetPosition(int x, int y);
00293
00301 void SetSize(unsigned int width, unsigned int height);
00302
00309 void SetTitle(const std::string& title);
00310
00319 void Show(bool show);
00320
00333 void EnableKeyRepeat(bool enabled);
00334
00348 void SetIcon(unsigned int width, unsigned int height, const Uint8* pixels);
00349
00365 bool SetActive(bool active = true) const;
00366
00376 void Display();
00377
00388 void SetFramerateLimit(unsigned int limit);
00389
00401 Uint32 GetFrameTime() const;
00402
00414 void SetJoystickThreshold(float threshold);
00415
00428 WindowHandle GetSystemHandle() const;
00429
00430 private :
00431
00440 virtual void OnCreate();
00441
00449 virtual void OnResize();
00450
00463 bool FilterEvent(const Event& event);
00464
00469 void Initialize();
00470
00472
00474 priv::WindowImpl* myWindow;
00475 priv::GlContext* myContext;
00476 Clock myClock;
00477 Uint32 myLastFrameTime;
00478 unsigned int myFramerateLimit;
00479 };
00480
00481 }
00482
00483
00484 #endif // SFML_WINDOW_HPP
00485
00486