00001 00002 // 00003 // SFML - Simple and Fast Multimedia Library 00004 // Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com) 00005 // 00006 // This software is provided 'as-is', without any express or implied warranty. 00007 // In no event will the authors be held liable for any damages arising from the use of this software. 00008 // 00009 // Permission is granted to anyone to use this software for any purpose, 00010 // including commercial applications, and to alter it and redistribute it freely, 00011 // subject to the following restrictions: 00012 // 00013 // 1. The origin of this software must not be misrepresented; 00014 // you must not claim that you wrote the original software. 00015 // If you use this software in a product, an acknowledgment 00016 // in the product documentation would be appreciated but is not required. 00017 // 00018 // 2. Altered source versions must be plainly marked as such, 00019 // and must not be misrepresented as being the original software. 00020 // 00021 // 3. This notice may not be removed or altered from any source distribution. 00022 // 00024 00025 #ifndef SFML_WINDOW_HPP 00026 #define SFML_WINDOW_HPP 00027 00029 // Headers 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 // Member data 00474 priv::WindowImpl* myWindow; 00475 priv::GlContext* myContext; 00476 Clock myClock; 00477 Uint32 myLastFrameTime; 00478 unsigned int myFramerateLimit; 00479 }; 00480 00481 } // namespace sf 00482 00483 00484 #endif // SFML_WINDOW_HPP 00485 00486
:: Copyright © 2007-2008 Laurent Gomila, all rights reserved :: Documentation generated by doxygen 1.5.2 ::