SFML logo
  • Main Page
  • Namespaces
  • Classes
  • Files
  • File List

Window.hpp

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/Input.hpp>
00032 #include <SFML/Window/VideoMode.hpp>
00033 #include <SFML/Window/WindowHandle.hpp>
00034 #include <SFML/Window/ContextSettings.hpp>
00035 #include <SFML/Window/WindowStyle.hpp>
00036 #include <SFML/System/Clock.hpp>
00037 #include <SFML/System/NonCopyable.hpp>
00038 #include <string>
00039 
00040 
00041 namespace sf
00042 {
00043 namespace priv
00044 {
00045     class WindowImpl;
00046     class ContextGL;
00047 }
00048 
00049 class Event;
00050 
00055 class SFML_API Window : NonCopyable
00056 {
00057 public :
00058 
00066     Window();
00067 
00088     Window(VideoMode mode, const std::string& title, unsigned long style = Style::Default, const ContextSettings& settings = ContextSettings());
00089 
00105     explicit Window(WindowHandle handle, const ContextSettings& settings = ContextSettings());
00106 
00113     virtual ~Window();
00114 
00128     void Create(VideoMode mode, const std::string& title, unsigned long style = Style::Default, const ContextSettings& settings = ContextSettings());
00129 
00141     void Create(WindowHandle handle, const ContextSettings& settings = ContextSettings());
00142 
00153     void Close();
00154 
00164     bool IsOpened() const;
00165 
00177     unsigned int GetWidth() const;
00178 
00190     unsigned int GetHeight() const;
00191 
00203     const ContextSettings& GetSettings() const;
00204 
00228     bool GetEvent(Event& event);
00229 
00255     bool WaitEvent(Event& event);
00256 
00270     void UseVerticalSync(bool enabled);
00271 
00280     void ShowMouseCursor(bool show);
00281 
00289     void SetCursorPosition(unsigned int left, unsigned int top);
00290 
00302     void SetPosition(int left, int top);
00303 
00311     void SetSize(unsigned int width, unsigned int height);
00312 
00321     void Show(bool show);
00322 
00335     void EnableKeyRepeat(bool enabled);
00336 
00350     void SetIcon(unsigned int width, unsigned int height, const Uint8* pixels);
00351 
00367     bool SetActive(bool active = true) const;
00368 
00378     void Display();
00379 
00389     const Input& GetInput() const;
00390 
00401     void SetFramerateLimit(unsigned int limit);
00402 
00413     float GetFrameTime() const;
00414 
00426     void SetJoystickThreshold(float threshold);
00427 
00428 private :
00429 
00438     virtual void OnCreate();
00439 
00447     virtual void OnResize();
00448 
00461     bool FilterEvent(const Event& event);
00462 
00467     void Initialize();
00468 
00470     // Member data
00472     priv::WindowImpl* myWindow;         
00473     priv::ContextGL*  myContext;        
00474     Input             myInput;          
00475     Clock             myClock;          
00476     float             myLastFrameTime;  
00477     bool              myIsExternal;     
00478     unsigned int      myFramerateLimit; 
00479     int               mySetCursorPosX;  
00480     int               mySetCursorPosY;  
00481 };
00482 
00483 } // namespace sf
00484 
00485 
00486 #endif // SFML_WINDOW_HPP
00487 
00488 

 ::  Copyright © 2007-2008 Laurent Gomila, all rights reserved  ::  Documentation generated by doxygen 1.5.2  ::