mirror of
https://github.com/SFML/SFML.git
synced 2024-11-25 04:41:05 +08:00
Updated documentation
git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/branches/sfml2@1239 4e206d99-4929-0410-ac5d-dfc041789085
This commit is contained in:
parent
49ebb40c4d
commit
1f3d7b6d0c
@ -53,7 +53,7 @@ public :
|
|||||||
/// Construct the music with a buffer size
|
/// Construct the music with a buffer size
|
||||||
///
|
///
|
||||||
/// \param bufferSize : Size of the internal buffer, expressed in number of samples
|
/// \param bufferSize : Size of the internal buffer, expressed in number of samples
|
||||||
/// (ie. size taken by the music in memory) (44100 by default)
|
/// (ie. size taken by the music in memory)
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
Music(std::size_t bufferSize = 44100);
|
Music(std::size_t bufferSize = 44100);
|
||||||
|
@ -65,11 +65,11 @@ public :
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Construct the sound from its parameters
|
/// Construct the sound from its parameters
|
||||||
///
|
///
|
||||||
/// \param buffer : Sound buffer to play (NULL by default)
|
/// \param buffer : Sound buffer to play
|
||||||
/// \param loop : Loop flag (false by default)
|
/// \param loop : Loop flag
|
||||||
/// \param pitch : Value of the pitch (1 by default)
|
/// \param pitch : Value of the pitch
|
||||||
/// \param volume : Volume (100 by default)
|
/// \param volume : Volume
|
||||||
/// \param position : Position (0, 0, 0 by default)
|
/// \param position : Position
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
Sound(const SoundBuffer& buffer, bool loop = false, float pitch = 1.f, float volume = 100.f, const Vector3f& position = Vector3f(0, 0, 0));
|
Sound(const SoundBuffer& buffer, bool loop = false, float pitch = 1.f, float volume = 100.f, const Vector3f& position = Vector3f(0, 0, 0));
|
||||||
|
@ -53,7 +53,7 @@ public :
|
|||||||
/// \param red : Red component (0 .. 255)
|
/// \param red : Red component (0 .. 255)
|
||||||
/// \param green : Green component (0 .. 255)
|
/// \param green : Green component (0 .. 255)
|
||||||
/// \param blue : Blue component (0 .. 255)
|
/// \param blue : Blue component (0 .. 255)
|
||||||
/// \param alpha : Alpha (opacity) component (0 .. 255) (255 by default)
|
/// \param alpha : Alpha (opacity) component (0 .. 255)
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
Color(Uint8 red, Uint8 green, Uint8 blue, Uint8 alpha = 255);
|
Color(Uint8 red, Uint8 green, Uint8 blue, Uint8 alpha = 255);
|
||||||
|
@ -63,10 +63,10 @@ public :
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Default constructor
|
/// Default constructor
|
||||||
///
|
///
|
||||||
/// \param position : Position of the object ((0, 0) by default)
|
/// \param position : Position of the object
|
||||||
/// \param scale : Scale factor ((1, 1) by default)
|
/// \param scale : Scale factor
|
||||||
/// \param rotation : Orientation, in degrees (0 by default)
|
/// \param rotation : Orientation, in degrees
|
||||||
/// \param color : Color of the object (white by default)
|
/// \param color : Color of the object
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
Drawable(const Vector2f& position = Vector2f(0, 0), const Vector2f& scale = Vector2f(1, 1), float rotation = 0.f, const Color& color = Color(255, 255, 255));
|
Drawable(const Vector2f& position = Vector2f(0, 0), const Vector2f& scale = Vector2f(1, 1), float rotation = 0.f, const Color& color = Color(255, 255, 255));
|
||||||
|
@ -65,7 +65,7 @@ public :
|
|||||||
/// Load the font from a file
|
/// Load the font from a file
|
||||||
///
|
///
|
||||||
/// \param filename : Font file to load
|
/// \param filename : Font file to load
|
||||||
/// \param charSize : Size of characters in bitmap - the bigger, the higher quality (30 by default)
|
/// \param charSize : Size of characters in bitmap - the bigger, the higher quality
|
||||||
/// \param charset : Characters set to generate (by default, contains the ISO-8859-1 printable characters)
|
/// \param charset : Characters set to generate (by default, contains the ISO-8859-1 printable characters)
|
||||||
///
|
///
|
||||||
/// \return True if loading was successful
|
/// \return True if loading was successful
|
||||||
@ -78,7 +78,7 @@ public :
|
|||||||
///
|
///
|
||||||
/// \param data : Pointer to the data to load
|
/// \param data : Pointer to the data to load
|
||||||
/// \param sizeInBytes : Size of the data, in bytes
|
/// \param sizeInBytes : Size of the data, in bytes
|
||||||
/// \param charSize : Size of characters in bitmap - the bigger, the higher quality (30 by default)
|
/// \param charSize : Size of characters in bitmap - the bigger, the higher quality
|
||||||
/// \param charset : Characters set to generate (by default, contains the ISO-8859-1 printable characters)
|
/// \param charset : Characters set to generate (by default, contains the ISO-8859-1 printable characters)
|
||||||
///
|
///
|
||||||
/// \return True if loading was successful
|
/// \return True if loading was successful
|
||||||
|
@ -67,7 +67,7 @@ public :
|
|||||||
///
|
///
|
||||||
/// \param width : Image width
|
/// \param width : Image width
|
||||||
/// \param height : Image height
|
/// \param height : Image height
|
||||||
/// \param color : Image color (black by default)
|
/// \param color : Image color
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
Image(unsigned int width, unsigned int height, const Color& color = Color(0, 0, 0));
|
Image(unsigned int width, unsigned int height, const Color& color = Color(0, 0, 0));
|
||||||
@ -136,7 +136,7 @@ public :
|
|||||||
///
|
///
|
||||||
/// \param width : Image width
|
/// \param width : Image width
|
||||||
/// \param height : Image height
|
/// \param height : Image height
|
||||||
/// \param color : Image color (black by default)
|
/// \param color : Image color
|
||||||
///
|
///
|
||||||
/// \return True if creation was successful
|
/// \return True if creation was successful
|
||||||
///
|
///
|
||||||
@ -147,7 +147,7 @@ public :
|
|||||||
/// Create transparency mask from a specified colorkey
|
/// Create transparency mask from a specified colorkey
|
||||||
///
|
///
|
||||||
/// \param transparentColor : Color to become transparent
|
/// \param transparentColor : Color to become transparent
|
||||||
/// \param alpha : Alpha value to assign to transparent pixels (0 by default)
|
/// \param alpha : Alpha value to assign to transparent pixels
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void CreateMaskFromColor(const Color& transparentColor, Uint8 alpha = 0);
|
void CreateMaskFromColor(const Color& transparentColor, Uint8 alpha = 0);
|
||||||
@ -160,8 +160,8 @@ public :
|
|||||||
/// \param source : Source image to copy
|
/// \param source : Source image to copy
|
||||||
/// \param destX : X coordinate of the destination position
|
/// \param destX : X coordinate of the destination position
|
||||||
/// \param destY : Y coordinate of the destination position
|
/// \param destY : Y coordinate of the destination position
|
||||||
/// \param sourceRect : Sub-rectangle of the source image to copy (empty by default - entire image)
|
/// \param sourceRect : Sub-rectangle of the source image to copy
|
||||||
/// \param applyAlpha : Should the copy take in account the source transparency? (false by default)
|
/// \param applyAlpha : Should the copy take in account the source transparency?
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void Copy(const Image& source, unsigned int destX, unsigned int destY, const IntRect& sourceRect = IntRect(0, 0, 0, 0), bool applyAlpha = false);
|
void Copy(const Image& source, unsigned int destX, unsigned int destY, const IntRect& sourceRect = IntRect(0, 0, 0, 0), bool applyAlpha = false);
|
||||||
|
@ -76,7 +76,7 @@ public :
|
|||||||
/// Activate of deactivate the render-image as the current target
|
/// Activate of deactivate the render-image as the current target
|
||||||
/// for rendering
|
/// for rendering
|
||||||
///
|
///
|
||||||
/// \param active : True to activate, false to deactivate (true by default)
|
/// \param active : True to activate, false to deactivate
|
||||||
///
|
///
|
||||||
/// \return True if operation was successful, false otherwise
|
/// \return True if operation was successful, false otherwise
|
||||||
///
|
///
|
||||||
|
@ -57,8 +57,8 @@ public :
|
|||||||
///
|
///
|
||||||
/// \param mode : Video mode to use
|
/// \param mode : Video mode to use
|
||||||
/// \param title : Title of the window
|
/// \param title : Title of the window
|
||||||
/// \param style : Window style (Resize | Close by default)
|
/// \param style : Window style
|
||||||
/// \param settings : Additional settings for the underlying OpenGL context (see default constructor for default values)
|
/// \param settings : Additional settings for the underlying OpenGL context
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
RenderWindow(VideoMode mode, const std::string& title, unsigned long style = Style::Resize | Style::Close, const ContextSettings& settings = ContextSettings());
|
RenderWindow(VideoMode mode, const std::string& title, unsigned long style = Style::Resize | Style::Close, const ContextSettings& settings = ContextSettings());
|
||||||
|
@ -54,8 +54,8 @@ public :
|
|||||||
/// Add a point to the shape
|
/// Add a point to the shape
|
||||||
///
|
///
|
||||||
/// \param x, y : Position of the point
|
/// \param x, y : Position of the point
|
||||||
/// \param color : Color of the point (white by default)
|
/// \param color : Color of the point
|
||||||
/// \param outlineColor : Outline color of the point (black by default)
|
/// \param outlineColor : Outline color of the point
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void AddPoint(float x, float y, const Color& color = Color(255, 255, 255), const Color& outlineColor = Color(0, 0, 0));
|
void AddPoint(float x, float y, const Color& color = Color(255, 255, 255), const Color& outlineColor = Color(0, 0, 0));
|
||||||
@ -64,8 +64,8 @@ public :
|
|||||||
/// Add a point to the shape
|
/// Add a point to the shape
|
||||||
///
|
///
|
||||||
/// \param position : Position of the point
|
/// \param position : Position of the point
|
||||||
/// \param color : Color of the point (white by default)
|
/// \param color : Color of the point
|
||||||
/// \param outlineColor : Outline color of the point (black by default)
|
/// \param outlineColor : Outline color of the point
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void AddPoint(const Vector2f& position, const Color& color = Color(255, 255, 255), const Color& outlineColor = Color(0, 0, 0));
|
void AddPoint(const Vector2f& position, const Color& color = Color(255, 255, 255), const Color& outlineColor = Color(0, 0, 0));
|
||||||
@ -186,8 +186,8 @@ public :
|
|||||||
/// \param p2x, p2y : Position second point
|
/// \param p2x, p2y : Position second point
|
||||||
/// \param thickness : Line thickness
|
/// \param thickness : Line thickness
|
||||||
/// \param color : Color used to draw the line
|
/// \param color : Color used to draw the line
|
||||||
/// \param outline : Outline width (0 by default)
|
/// \param outline : Outline width
|
||||||
/// \param outlineColor : Color used to draw the outline (black by default)
|
/// \param outlineColor : Color used to draw the outline
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
static Shape Line(float p1x, float p1y, float p2x, float p2y, float thickness, const Color& color, float outline = 0.f, const Color& outlineColor = sf::Color(0, 0, 0));
|
static Shape Line(float p1x, float p1y, float p2x, float p2y, float thickness, const Color& color, float outline = 0.f, const Color& outlineColor = sf::Color(0, 0, 0));
|
||||||
@ -199,8 +199,8 @@ public :
|
|||||||
/// \param p2 : Position second point
|
/// \param p2 : Position second point
|
||||||
/// \param thickness : Line thickness
|
/// \param thickness : Line thickness
|
||||||
/// \param color : Color used to draw the line
|
/// \param color : Color used to draw the line
|
||||||
/// \param outline : Outline width (0 by default)
|
/// \param outline : Outline width
|
||||||
/// \param outlineColor : Color used to draw the outline (black by default)
|
/// \param outlineColor : Color used to draw the outline
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
static Shape Line(const Vector2f& p1, const Vector2f& p2, float thickness, const Color& color, float outline = 0.f, const Color& outlineColor = sf::Color(0, 0, 0));
|
static Shape Line(const Vector2f& p1, const Vector2f& p2, float thickness, const Color& color, float outline = 0.f, const Color& outlineColor = sf::Color(0, 0, 0));
|
||||||
@ -211,8 +211,8 @@ public :
|
|||||||
/// \param p1x, p1y : Position of the first point
|
/// \param p1x, p1y : Position of the first point
|
||||||
/// \param p2x, p2y : Position second point
|
/// \param p2x, p2y : Position second point
|
||||||
/// \param color : Color used to fill the rectangle
|
/// \param color : Color used to fill the rectangle
|
||||||
/// \param outline : Outline width (0 by default)
|
/// \param outline : Outline width
|
||||||
/// \param outlineColor : Color used to draw the outline (black by default)
|
/// \param outlineColor : Color used to draw the outline
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
static Shape Rectangle(float p1x, float p1y, float p2x, float p2y, const Color& color, float outline = 0.f, const Color& outlineColor = sf::Color(0, 0, 0));
|
static Shape Rectangle(float p1x, float p1y, float p2x, float p2y, const Color& color, float outline = 0.f, const Color& outlineColor = sf::Color(0, 0, 0));
|
||||||
@ -223,8 +223,8 @@ public :
|
|||||||
/// \param p1 : Position of the first point
|
/// \param p1 : Position of the first point
|
||||||
/// \param p2 : Position second point
|
/// \param p2 : Position second point
|
||||||
/// \param color : Color used to fill the rectangle
|
/// \param color : Color used to fill the rectangle
|
||||||
/// \param outline : Outline width (0 by default)
|
/// \param outline : Outline width
|
||||||
/// \param outlineColor : Color used to draw the outline (black by default)
|
/// \param outlineColor : Color used to draw the outline
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
static Shape Rectangle(const Vector2f& p1, const Vector2f& p2, const Color& color, float outline = 0.f, const Color& outlineColor = sf::Color(0, 0, 0));
|
static Shape Rectangle(const Vector2f& p1, const Vector2f& p2, const Color& color, float outline = 0.f, const Color& outlineColor = sf::Color(0, 0, 0));
|
||||||
@ -235,8 +235,8 @@ public :
|
|||||||
/// \param x, y : Position of the center
|
/// \param x, y : Position of the center
|
||||||
/// \param radius : Radius
|
/// \param radius : Radius
|
||||||
/// \param color : Color used to fill the circle
|
/// \param color : Color used to fill the circle
|
||||||
/// \param outline : Outline width (0 by default)
|
/// \param outline : Outline width
|
||||||
/// \param outlineColor : Color used to draw the outline (black by default)
|
/// \param outlineColor : Color used to draw the outline
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
static Shape Circle(float x, float y, float radius, const Color& color, float outline = 0.f, const Color& outlineColor = sf::Color(0, 0, 0));
|
static Shape Circle(float x, float y, float radius, const Color& color, float outline = 0.f, const Color& outlineColor = sf::Color(0, 0, 0));
|
||||||
@ -247,8 +247,8 @@ public :
|
|||||||
/// \param center : Position of the center
|
/// \param center : Position of the center
|
||||||
/// \param radius : Radius
|
/// \param radius : Radius
|
||||||
/// \param color : Color used to fill the circle
|
/// \param color : Color used to fill the circle
|
||||||
/// \param outline : Outline width (0 by default)
|
/// \param outline : Outline width
|
||||||
/// \param outlineColor : Color used to draw the outline (black by default)
|
/// \param outlineColor : Color used to draw the outline
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
static Shape Circle(const Vector2f& center, float radius, const Color& color, float outline = 0.f, const Color& outlineColor = sf::Color(0, 0, 0));
|
static Shape Circle(const Vector2f& center, float radius, const Color& color, float outline = 0.f, const Color& outlineColor = sf::Color(0, 0, 0));
|
||||||
|
@ -55,10 +55,10 @@ public :
|
|||||||
/// Construct the sprite from a source image
|
/// Construct the sprite from a source image
|
||||||
///
|
///
|
||||||
/// \param image : Image of the sprite
|
/// \param image : Image of the sprite
|
||||||
/// \param position : Position of the sprite (0, 0 by default)
|
/// \param position : Position of the sprite
|
||||||
/// \param scale : Scale factor (1, 1 by default)
|
/// \param scale : Scale factor
|
||||||
/// \param rotation : Orientation, in degrees (0 by default)
|
/// \param rotation : Orientation, in degrees
|
||||||
/// \param color : Color of the sprite (white by default)
|
/// \param color : Color of the sprite
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
Sprite(const Image& image, const Vector2f& position = Vector2f(0, 0), const Vector2f& scale = Vector2f(1, 1), float rotation = 0.f, const Color& color = Color(255, 255, 255, 255));
|
Sprite(const Image& image, const Vector2f& position = Vector2f(0, 0), const Vector2f& scale = Vector2f(1, 1), float rotation = 0.f, const Color& color = Color(255, 255, 255, 255));
|
||||||
@ -67,7 +67,7 @@ public :
|
|||||||
/// Change the image of the sprite
|
/// Change the image of the sprite
|
||||||
///
|
///
|
||||||
/// \param image : New image
|
/// \param image : New image
|
||||||
/// \param adjustToNewSize : If true, the SubRect of the sprite will be adjusted to the size of the new image (false by default)
|
/// \param adjustToNewSize : If true, the SubRect of the sprite will be adjusted to the size of the new image
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void SetImage(const Image& image, bool adjustToNewSize = false);
|
void SetImage(const Image& image, bool adjustToNewSize = false);
|
||||||
|
@ -66,8 +66,8 @@ public :
|
|||||||
/// Construct the string from any kind of text
|
/// Construct the string from any kind of text
|
||||||
///
|
///
|
||||||
/// \param text : Text assigned to the string
|
/// \param text : Text assigned to the string
|
||||||
/// \param font : Font used to draw the string (SFML built-in font by default)
|
/// \param font : Font used to draw the string
|
||||||
/// \param size : Characters size (30 by default)
|
/// \param size : Characters size
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
explicit String(const Unicode::Text& text, const Font& font = Font::GetDefaultFont(), float size = 30.f);
|
explicit String(const Unicode::Text& text, const Font& font = Font::GetDefaultFont(), float size = 30.f);
|
||||||
|
@ -136,8 +136,8 @@ public :
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Default constructor
|
/// Default constructor
|
||||||
///
|
///
|
||||||
/// \param code : Response status code (InvalidResponse by default)
|
/// \param code : Response status code
|
||||||
/// \param message : Response message (empty by default)
|
/// \param message : Response message
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
Response(Status code = InvalidResponse, const std::string& message = "");
|
Response(Status code = InvalidResponse, const std::string& message = "");
|
||||||
@ -387,7 +387,7 @@ public :
|
|||||||
///
|
///
|
||||||
/// \param distantFile : Path of the distant file to download
|
/// \param distantFile : Path of the distant file to download
|
||||||
/// \param destPath : Where to put to file on the local computer
|
/// \param destPath : Where to put to file on the local computer
|
||||||
/// \param mode : Transfer mode (binary by default)
|
/// \param mode : Transfer mode
|
||||||
///
|
///
|
||||||
/// \return Server response to the request
|
/// \return Server response to the request
|
||||||
///
|
///
|
||||||
@ -399,7 +399,7 @@ public :
|
|||||||
///
|
///
|
||||||
/// \param localFile : Path of the local file to upload
|
/// \param localFile : Path of the local file to upload
|
||||||
/// \param destPath : Where to put to file on the server
|
/// \param destPath : Where to put to file on the server
|
||||||
/// \param mode : Transfer mode (binary by default)
|
/// \param mode : Transfer mode
|
||||||
///
|
///
|
||||||
/// \return Server response to the request
|
/// \return Server response to the request
|
||||||
///
|
///
|
||||||
@ -412,7 +412,7 @@ private :
|
|||||||
/// Send a command to the FTP server
|
/// Send a command to the FTP server
|
||||||
///
|
///
|
||||||
/// \param command : Command to send
|
/// \param command : Command to send
|
||||||
/// \param parameter : Command parameter ("" by default)
|
/// \param parameter : Command parameter
|
||||||
///
|
///
|
||||||
/// \return Server response to the request
|
/// \return Server response to the request
|
||||||
///
|
///
|
||||||
|
@ -68,9 +68,9 @@ public :
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Default constructor
|
/// Default constructor
|
||||||
///
|
///
|
||||||
/// \param method : Method to use for the request (Get by default)
|
/// \param method : Method to use for the request
|
||||||
/// \param URI : Target URI ("/" by default -- index page)
|
/// \param URI : Target URI
|
||||||
/// \param body : Content of the request's body (empty by default)
|
/// \param body : Content of the request's body
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
Request(Method method = Get, const std::string& URI = "/", const std::string& body = "");
|
Request(Method method = Get, const std::string& URI = "/", const std::string& body = "");
|
||||||
|
@ -88,7 +88,7 @@ public :
|
|||||||
/// This function will block if the socket is blocking
|
/// This function will block if the socket is blocking
|
||||||
///
|
///
|
||||||
/// \param connected : Socket containing the connection with the connected client
|
/// \param connected : Socket containing the connection with the connected client
|
||||||
/// \param address : Pointer to an address to fill with client infos (NULL by default)
|
/// \param address : Pointer to an address to fill with client infos
|
||||||
///
|
///
|
||||||
/// \return Status code
|
/// \return Status code
|
||||||
///
|
///
|
||||||
|
@ -53,7 +53,7 @@ public :
|
|||||||
/// \brief Construct the thread from a function pointer
|
/// \brief Construct the thread from a function pointer
|
||||||
///
|
///
|
||||||
/// \param function Entry point of the thread
|
/// \param function Entry point of the thread
|
||||||
/// \param userData Data to pass to the thread function (NULL by default)
|
/// \param userData Data to pass to the thread function
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
Thread(FuncType function, void* userData = NULL);
|
Thread(FuncType function, void* userData = NULL);
|
||||||
|
@ -51,7 +51,7 @@ public :
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Default constructor
|
/// \brief Default constructor
|
||||||
///
|
///
|
||||||
/// \param value Optional value to initalize the variable (NULL by default)
|
/// \param value Optional value to initalize the variable
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
ThreadLocal(void* value = NULL);
|
ThreadLocal(void* value = NULL);
|
||||||
|
@ -45,7 +45,7 @@ public :
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Default constructor
|
/// \brief Default constructor
|
||||||
///
|
///
|
||||||
/// \param value Optional value to initalize the variable (NULL by default)
|
/// \param value Optional value to initalize the variable
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
ThreadLocalPtr(T* value = NULL);
|
ThreadLocalPtr(T* value = NULL);
|
||||||
|
@ -115,7 +115,7 @@ public :
|
|||||||
/// \param end : Iterator pointing to the end of the input sequence
|
/// \param end : Iterator pointing to the end of the input sequence
|
||||||
/// \param output : Iterator pointing to the beginning of the output sequence
|
/// \param output : Iterator pointing to the beginning of the output sequence
|
||||||
/// \param replacement : Replacement character for characters not convertible to output encoding ('?' by default -- use 0 to use no replacement character)
|
/// \param replacement : Replacement character for characters not convertible to output encoding ('?' by default -- use 0 to use no replacement character)
|
||||||
/// \param locale : Locale to use for conversion (uses the current one by default)
|
/// \param locale : Locale to use for conversion
|
||||||
///
|
///
|
||||||
/// \return Iterator to the end of the output sequence which has been written
|
/// \return Iterator to the end of the output sequence which has been written
|
||||||
///
|
///
|
||||||
@ -130,7 +130,7 @@ public :
|
|||||||
/// \param begin : Iterator pointing to the beginning of the input sequence
|
/// \param begin : Iterator pointing to the beginning of the input sequence
|
||||||
/// \param end : Iterator pointing to the end of the input sequence
|
/// \param end : Iterator pointing to the end of the input sequence
|
||||||
/// \param output : Iterator pointing to the beginning of the output sequence
|
/// \param output : Iterator pointing to the beginning of the output sequence
|
||||||
/// \param locale : Locale to use for conversion (uses the current one by default)
|
/// \param locale : Locale to use for conversion
|
||||||
///
|
///
|
||||||
/// \return Iterator to the end of the output sequence which has been written
|
/// \return Iterator to the end of the output sequence which has been written
|
||||||
///
|
///
|
||||||
|
@ -40,56 +40,33 @@ namespace priv
|
|||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Class holding a valid drawing context
|
/// \brief Class holding a valid drawing context
|
||||||
///
|
///
|
||||||
/// If you need to make OpenGL / graphics calls without
|
|
||||||
/// having an active window (like in a thread), you can use
|
|
||||||
/// an instance of this class to get a valid context.
|
|
||||||
///
|
|
||||||
/// Having a valid context is necessary for *every* OpenGL call,
|
|
||||||
/// and for most of the classes from the Graphics package.
|
|
||||||
///
|
|
||||||
/// Note that a context is only active in its current thread,
|
|
||||||
/// if you create a new thread it will have no valid context
|
|
||||||
/// by default.
|
|
||||||
///
|
|
||||||
/// \code
|
|
||||||
/// void ThreadFunction(void*)
|
|
||||||
/// {
|
|
||||||
/// sf::Context context;
|
|
||||||
/// // from now on, you have a valid context
|
|
||||||
///
|
|
||||||
/// // you can make OpenGL calls
|
|
||||||
/// glClear(GL_DEPTH_BUFFER_BIT);
|
|
||||||
///
|
|
||||||
/// // as well as using objects from the graphics package
|
|
||||||
/// sf::Image Img;
|
|
||||||
/// Img.LoadFromFile("image.png");
|
|
||||||
/// }
|
|
||||||
/// // the context is automatically deactivated and destroyed
|
|
||||||
/// // by the sf::Context destructor
|
|
||||||
/// \endcode
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
class SFML_API Context : NonCopyable
|
class SFML_API Context : NonCopyable
|
||||||
{
|
{
|
||||||
public :
|
public :
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Default constructor -- creates and activates the context
|
/// \brief Default constructor
|
||||||
|
///
|
||||||
|
/// The constructor creates and activates the context
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
Context();
|
Context();
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Destructor -- deactivates and destroys the context
|
/// \brief Destructor
|
||||||
|
///
|
||||||
|
/// The desctructor deactivates and destroys the context
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
~Context();
|
~Context();
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Activate or deactivate explicitely the context
|
/// \brief Activate or deactivate explicitely the context
|
||||||
///
|
///
|
||||||
/// \param active : True to activate, false to deactivate
|
/// \param active True to activate, false to deactivate
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void SetActive(bool active);
|
void SetActive(bool active);
|
||||||
@ -106,3 +83,43 @@ private :
|
|||||||
|
|
||||||
|
|
||||||
#endif // SFML_CONTEXT_HPP
|
#endif // SFML_CONTEXT_HPP
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \class sf::Context
|
||||||
|
///
|
||||||
|
/// If you need to make OpenGL / graphics calls without
|
||||||
|
/// having an active window (like in a thread), you can use
|
||||||
|
/// an instance of this class to get a valid context.
|
||||||
|
///
|
||||||
|
/// Having a valid context is necessary for *every* OpenGL call,
|
||||||
|
/// and for most of the classes from the Graphics package.
|
||||||
|
///
|
||||||
|
/// Note that a context is only active in its current thread,
|
||||||
|
/// if you create a new thread it will have no valid context
|
||||||
|
/// by default.
|
||||||
|
///
|
||||||
|
/// To use a sf::Context instance, just construct it and let it
|
||||||
|
/// live as long as you need a valid context. No explicit activation
|
||||||
|
/// is needed, all it has to do is to exist. Its destructor
|
||||||
|
/// will take care of deactivating and freeing all the attached
|
||||||
|
/// resources.
|
||||||
|
///
|
||||||
|
/// Usage example:
|
||||||
|
/// \code
|
||||||
|
/// void ThreadFunction(void*)
|
||||||
|
/// {
|
||||||
|
/// sf::Context context;
|
||||||
|
/// // from now on, you have a valid context
|
||||||
|
///
|
||||||
|
/// // you can make OpenGL calls
|
||||||
|
/// glClear(GL_DEPTH_BUFFER_BIT);
|
||||||
|
///
|
||||||
|
/// // as well as using objects from the graphics package
|
||||||
|
/// sf::Image image;
|
||||||
|
/// image.LoadFromFile("image.png");
|
||||||
|
/// }
|
||||||
|
/// // the context is automatically deactivated and destroyed
|
||||||
|
/// // by the sf::Context destructor
|
||||||
|
/// \endcode
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
@ -29,17 +29,17 @@
|
|||||||
namespace sf
|
namespace sf
|
||||||
{
|
{
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Structure defining the settings of the OpenGL
|
/// \brief Structure defining the settings of the OpenGL
|
||||||
/// context attached to a window
|
/// context attached to a window
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
struct ContextSettings
|
struct ContextSettings
|
||||||
{
|
{
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Default constructor
|
/// \brief Default constructor
|
||||||
///
|
///
|
||||||
/// \param depth : Depth buffer bits (24 by default)
|
/// \param depth Depth buffer bits
|
||||||
/// \param stencil : Stencil buffer bits (8 by default)
|
/// \param stencil Stencil buffer bits
|
||||||
/// \param antialiasing : Antialiasing level (0 by default)
|
/// \param antialiasing Antialiasing level
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
explicit ContextSettings(unsigned int depth = 24, unsigned int stencil = 8, unsigned int antialiasing = 0) :
|
explicit ContextSettings(unsigned int depth = 24, unsigned int stencil = 8, unsigned int antialiasing = 0) :
|
||||||
|
@ -33,80 +33,81 @@
|
|||||||
|
|
||||||
namespace sf
|
namespace sf
|
||||||
{
|
{
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// Definition of key codes for keyboard events
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
namespace Key
|
namespace Key
|
||||||
{
|
{
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Definition of key codes for keyboard events
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
enum Code
|
enum Code
|
||||||
{
|
{
|
||||||
A = 'a',
|
A = 'a', ///< The A key
|
||||||
B = 'b',
|
B = 'b', ///< The B key
|
||||||
C = 'c',
|
C = 'c', ///< The C key
|
||||||
D = 'd',
|
D = 'd', ///< The D key
|
||||||
E = 'e',
|
E = 'e', ///< The E key
|
||||||
F = 'f',
|
F = 'f', ///< The F key
|
||||||
G = 'g',
|
G = 'g', ///< The G key
|
||||||
H = 'h',
|
H = 'h', ///< The H key
|
||||||
I = 'i',
|
I = 'i', ///< The I key
|
||||||
J = 'j',
|
J = 'j', ///< The J key
|
||||||
K = 'k',
|
K = 'k', ///< The K key
|
||||||
L = 'l',
|
L = 'l', ///< The L key
|
||||||
M = 'm',
|
M = 'm', ///< The M key
|
||||||
N = 'n',
|
N = 'n', ///< The N key
|
||||||
O = 'o',
|
O = 'o', ///< The O key
|
||||||
P = 'p',
|
P = 'p', ///< The P key
|
||||||
Q = 'q',
|
Q = 'q', ///< The Q key
|
||||||
R = 'r',
|
R = 'r', ///< The R key
|
||||||
S = 's',
|
S = 's', ///< The S key
|
||||||
T = 't',
|
T = 't', ///< The T key
|
||||||
U = 'u',
|
U = 'u', ///< The U key
|
||||||
V = 'v',
|
V = 'v', ///< The V key
|
||||||
W = 'w',
|
W = 'w', ///< The W key
|
||||||
X = 'x',
|
X = 'x', ///< The X key
|
||||||
Y = 'y',
|
Y = 'y', ///< The Y key
|
||||||
Z = 'z',
|
Z = 'z', ///< The Z key
|
||||||
Num0 = '0',
|
Num0 = '0', ///< The 0 key
|
||||||
Num1 = '1',
|
Num1 = '1', ///< The 1 key
|
||||||
Num2 = '2',
|
Num2 = '2', ///< The 2 key
|
||||||
Num3 = '3',
|
Num3 = '3', ///< The 3 key
|
||||||
Num4 = '4',
|
Num4 = '4', ///< The 4 key
|
||||||
Num5 = '5',
|
Num5 = '5', ///< The 5 key
|
||||||
Num6 = '6',
|
Num6 = '6', ///< The 6 key
|
||||||
Num7 = '7',
|
Num7 = '7', ///< The 7 key
|
||||||
Num8 = '8',
|
Num8 = '8', ///< The 8 key
|
||||||
Num9 = '9',
|
Num9 = '9', ///< The 9 key
|
||||||
Escape = 256,
|
Escape = 256, ///< The Escape key
|
||||||
LControl,
|
LControl, ///< The left Control key
|
||||||
LShift,
|
LShift, ///< The left Shift key
|
||||||
LAlt,
|
LAlt, ///< The left Alt key
|
||||||
LSystem, ///< OS specific key (left side) : windows (Win and Linux), apple (MacOS), ...
|
LSystem, ///< The left OS specific key : windows (Windows and Linux), apple (MacOS X), ...
|
||||||
RControl,
|
RControl, ///< The right Control key
|
||||||
RShift,
|
RShift, ///< The right Shift key
|
||||||
RAlt,
|
RAlt, ///< The right Alt key
|
||||||
RSystem, ///< OS specific key (right side) : windows (Win and Linux), apple (MacOS), ...
|
RSystem, ///< The right OS specific key : windows (Windows and Linux), apple (MacOS X), ...
|
||||||
Menu,
|
Menu, ///< The Menu key
|
||||||
LBracket, ///< [
|
LBracket, ///< The [ key
|
||||||
RBracket, ///< ]
|
RBracket, ///< The ] key
|
||||||
SemiColon, ///< ;
|
SemiColon, ///< The ; key
|
||||||
Comma, ///< ,
|
Comma, ///< The , key
|
||||||
Period, ///< .
|
Period, ///< The . key
|
||||||
Quote, ///< '
|
Quote, ///< The ' key
|
||||||
Slash, ///< /
|
Slash, ///< The / key
|
||||||
BackSlash,
|
BackSlash, ///< The \ key
|
||||||
Tilde, ///< ~
|
Tilde, ///< The ~ key
|
||||||
Equal, ///< =
|
Equal, ///< The = key
|
||||||
Dash, ///< -
|
Dash, ///< The - key
|
||||||
Space,
|
Space, ///< The Space key
|
||||||
Return,
|
Return, ///< The Return key
|
||||||
Back,
|
Back, ///< The Backspace key
|
||||||
Tab,
|
Tab, ///< The Tabulation key
|
||||||
PageUp,
|
PageUp, ///< The Page up key
|
||||||
PageDown,
|
PageDown, ///< The Page down key
|
||||||
End,
|
End, ///< The End key
|
||||||
Home,
|
Home, ///< The Home key
|
||||||
Insert,
|
Insert, ///< The Insert key
|
||||||
Delete,
|
Delete, ///< The Delete key
|
||||||
Add, ///< +
|
Add, ///< +
|
||||||
Subtract, ///< -
|
Subtract, ///< -
|
||||||
Multiply, ///< *
|
Multiply, ///< *
|
||||||
@ -115,180 +116,194 @@ namespace Key
|
|||||||
Right, ///< Right arrow
|
Right, ///< Right arrow
|
||||||
Up, ///< Up arrow
|
Up, ///< Up arrow
|
||||||
Down, ///< Down arrow
|
Down, ///< Down arrow
|
||||||
Numpad0,
|
Numpad0, ///< The numpad 0 key
|
||||||
Numpad1,
|
Numpad1, ///< The numpad 1 key
|
||||||
Numpad2,
|
Numpad2, ///< The numpad 2 key
|
||||||
Numpad3,
|
Numpad3, ///< The numpad 3 key
|
||||||
Numpad4,
|
Numpad4, ///< The numpad 4 key
|
||||||
Numpad5,
|
Numpad5, ///< The numpad 5 key
|
||||||
Numpad6,
|
Numpad6, ///< The numpad 6 key
|
||||||
Numpad7,
|
Numpad7, ///< The numpad 7 key
|
||||||
Numpad8,
|
Numpad8, ///< The numpad 8 key
|
||||||
Numpad9,
|
Numpad9, ///< The numpad 9 key
|
||||||
F1,
|
F1, ///< The F1 key
|
||||||
F2,
|
F2, ///< The F2 key
|
||||||
F3,
|
F3, ///< The F3 key
|
||||||
F4,
|
F4, ///< The F4 key
|
||||||
F5,
|
F5, ///< The F5 key
|
||||||
F6,
|
F6, ///< The F6 key
|
||||||
F7,
|
F7, ///< The F7 key
|
||||||
F8,
|
F8, ///< The F8 key
|
||||||
F9,
|
F9, ///< The F8 key
|
||||||
F10,
|
F10, ///< The F10 key
|
||||||
F11,
|
F11, ///< The F11 key
|
||||||
F12,
|
F12, ///< The F12 key
|
||||||
F13,
|
F13, ///< The F13 key
|
||||||
F14,
|
F14, ///< The F14 key
|
||||||
F15,
|
F15, ///< The F15 key
|
||||||
Pause,
|
Pause, ///< The Pause key
|
||||||
|
|
||||||
Count // Keep last -- total number of keyboard keys
|
Count ///< Keep last -- the total number of keyboard keys
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// Definition of button codes for mouse events
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
namespace Mouse
|
namespace Mouse
|
||||||
{
|
{
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Definition of button codes for mouse events
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
enum Button
|
enum Button
|
||||||
{
|
{
|
||||||
Left,
|
Left, ///< The left mouse button
|
||||||
Right,
|
Right, ///< The right mouse button
|
||||||
Middle,
|
Middle, ///< The middle (wheel) mouse button
|
||||||
XButton1,
|
XButton1, ///< The first extra mouse button
|
||||||
XButton2,
|
XButton2, ///< The second extra mouse button
|
||||||
|
|
||||||
Count // Keep last -- total number of mouse buttons
|
Count ///< Keep last -- the total number of mouse buttons
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// Definition of joystick axis for joystick events
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
namespace Joy
|
namespace Joy
|
||||||
{
|
{
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Definition of joystick axis for joystick events
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
enum Axis
|
enum Axis
|
||||||
{
|
{
|
||||||
AxisX,
|
AxisX, ///< The X axis
|
||||||
AxisY,
|
AxisY, ///< The Y axis
|
||||||
AxisZ,
|
AxisZ, ///< The Z axis
|
||||||
AxisR,
|
AxisR, ///< The R axis
|
||||||
AxisU,
|
AxisU, ///< The U axis
|
||||||
AxisV,
|
AxisV, ///< The V axis
|
||||||
AxisPOV,
|
AxisPOV, ///< The Point-Of-View axis (hat)
|
||||||
|
|
||||||
Count // Keep last -- total number of joystick axis
|
Count ///< Keep last -- the total number of joystick axis
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Event defines a system event and its parameters
|
/// \brief Defines a system event and its parameters
|
||||||
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
class Event
|
class Event
|
||||||
{
|
{
|
||||||
public :
|
public :
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Keyboard event parameters
|
/// \brief Keyboard event parameters (KeyPressed, KeyReleased)
|
||||||
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
struct KeyEvent
|
struct KeyEvent
|
||||||
{
|
{
|
||||||
Key::Code Code;
|
Key::Code Code; ///< Code of the key that has been pressed
|
||||||
bool Alt;
|
bool Alt; ///< Is the Alt key pressed?
|
||||||
bool Control;
|
bool Control; ///< Is the Control key pressed?
|
||||||
bool Shift;
|
bool Shift; ///< Is the Shift key pressed?
|
||||||
};
|
};
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Text event parameters
|
/// \brief Text event parameters (TextEntered)
|
||||||
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
struct TextEvent
|
struct TextEvent
|
||||||
{
|
{
|
||||||
Uint32 Unicode;
|
Uint32 Unicode; ///< UTF-32 unicode value of the character
|
||||||
};
|
};
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Mouse move event parameters
|
/// \brief Mouse move event parameters (MouseMoved)
|
||||||
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
struct MouseMoveEvent
|
struct MouseMoveEvent
|
||||||
{
|
{
|
||||||
int X;
|
int X; ///< X position of the mouse, relative to the left of the owner window
|
||||||
int Y;
|
int Y; ///< Y position of the mouse, relative to the top of the owner window
|
||||||
};
|
};
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Mouse buttons events parameters
|
/// \brief Mouse buttons events parameters
|
||||||
|
/// (MouseButtonPressed, MouseButtonReleased)
|
||||||
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
struct MouseButtonEvent
|
struct MouseButtonEvent
|
||||||
{
|
{
|
||||||
Mouse::Button Button;
|
Mouse::Button Button; ///< Code of the button that has been pressed
|
||||||
int X;
|
int X; ///< X position of the mouse, relative to the left of the owner window
|
||||||
int Y;
|
int Y; ///< Y position of the mouse, relative to the top of the owner window
|
||||||
};
|
};
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Mouse wheel events parameters
|
/// \brief Mouse wheel events parameters (MouseWheelMoved)
|
||||||
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
struct MouseWheelEvent
|
struct MouseWheelEvent
|
||||||
{
|
{
|
||||||
int Delta;
|
int Delta; ///< Number of ticks the wheel has moved (positive is up, negative is down)
|
||||||
};
|
};
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Joystick axis move event parameters
|
/// \brief Joystick axis move event parameters (JoyMoved)
|
||||||
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
struct JoyMoveEvent
|
struct JoyMoveEvent
|
||||||
{
|
{
|
||||||
unsigned int JoystickId;
|
unsigned int JoystickId; ///< Index of the joystick (0 or 1)
|
||||||
Joy::Axis Axis;
|
Joy::Axis Axis; ///< Axis on which the joystick moved
|
||||||
float Position;
|
float Position; ///< New position on the axis (in range [-100, 100])
|
||||||
};
|
};
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Joystick buttons events parameters
|
/// \brief Joystick buttons events parameters
|
||||||
|
/// (JoyButtonPressed, JoyButtonReleased)
|
||||||
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
struct JoyButtonEvent
|
struct JoyButtonEvent
|
||||||
{
|
{
|
||||||
unsigned int JoystickId;
|
unsigned int JoystickId; ///< Index of the joystick (0 or 1)
|
||||||
unsigned int Button;
|
unsigned int Button; ///< Index of the button that has been pressed
|
||||||
};
|
};
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Size events parameters
|
/// \brief Size events parameters (Resized)
|
||||||
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
struct SizeEvent
|
struct SizeEvent
|
||||||
{
|
{
|
||||||
unsigned int Width;
|
unsigned int Width; ///< New width, in pixels
|
||||||
unsigned int Height;
|
unsigned int Height; ///< New height, in pixels
|
||||||
};
|
};
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Enumeration of the different types of events
|
/// \brief Enumeration of the different types of events
|
||||||
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
enum EventType
|
enum EventType
|
||||||
{
|
{
|
||||||
Closed,
|
Closed, ///< The window requested to be closed
|
||||||
Resized,
|
Resized, ///< The window was resized
|
||||||
LostFocus,
|
LostFocus, ///< The window lost the focus
|
||||||
GainedFocus,
|
GainedFocus, ///< The window gained the focus
|
||||||
TextEntered,
|
TextEntered, ///< A character was entered
|
||||||
KeyPressed,
|
KeyPressed, ///< A key was pressed
|
||||||
KeyReleased,
|
KeyReleased, ///< A key was released
|
||||||
MouseWheelMoved,
|
MouseWheelMoved, ///< The mouse wheel was scrolled
|
||||||
MouseButtonPressed,
|
MouseButtonPressed, ///< A mouse button was pressed
|
||||||
MouseButtonReleased,
|
MouseButtonReleased, ///< A mouse button was released
|
||||||
MouseMoved,
|
MouseMoved, ///< The mouse cursor moved
|
||||||
MouseEntered,
|
MouseEntered, ///< The mouse cursor entered the area of the window
|
||||||
MouseLeft,
|
MouseLeft, ///< The mouse cursor left the area of the window
|
||||||
JoyButtonPressed,
|
JoyButtonPressed, ///< A joystick button was pressed
|
||||||
JoyButtonReleased,
|
JoyButtonReleased, ///< A joystick button was released
|
||||||
JoyMoved,
|
JoyMoved, ///< The joystick moved along an axis
|
||||||
|
|
||||||
Count // Keep last -- total number of event types
|
Count ///< Keep last -- the total number of event types
|
||||||
};
|
};
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
@ -298,14 +313,14 @@ public :
|
|||||||
|
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
KeyEvent Key;
|
KeyEvent Key; ///< Key event parameters
|
||||||
TextEvent Text;
|
TextEvent Text; ///< Text event parameters
|
||||||
MouseMoveEvent MouseMove;
|
MouseMoveEvent MouseMove; ///< Mouse move event parameters
|
||||||
MouseButtonEvent MouseButton;
|
MouseButtonEvent MouseButton; ///< Mouse button event parameters
|
||||||
MouseWheelEvent MouseWheel;
|
MouseWheelEvent MouseWheel; ///< Mouse wheel event parameters
|
||||||
JoyMoveEvent JoyMove;
|
JoyMoveEvent JoyMove; ///< Joystick move event parameters
|
||||||
JoyButtonEvent JoyButton;
|
JoyButtonEvent JoyButton; ///< Joystick button event parameters
|
||||||
SizeEvent Size;
|
SizeEvent Size; ///< Size event parameters
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -313,3 +328,45 @@ public :
|
|||||||
|
|
||||||
|
|
||||||
#endif // SFML_EVENT_HPP
|
#endif // SFML_EVENT_HPP
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \class sf::Event
|
||||||
|
///
|
||||||
|
/// sf::Event holds all the informations about a system event
|
||||||
|
/// that just happened. Events are retrieved using the
|
||||||
|
/// sf::Window::GetEvent function.
|
||||||
|
///
|
||||||
|
/// A sf::Event instance contains the type of the event
|
||||||
|
/// (mouse moved, key pressed, window closed, ...) as well
|
||||||
|
/// as the details about this particular event. Please note that
|
||||||
|
/// the event parameters are defined in a union, which means that
|
||||||
|
/// only the member matching the type of the event will be properly
|
||||||
|
/// filled; all other members will have undefined values and must not
|
||||||
|
/// be read if the type of the event doesn't match. For example,
|
||||||
|
/// if you received a KeyPressed event, then you must read the
|
||||||
|
/// event.Key member, all other members such as event.MouseMove
|
||||||
|
/// or event.Text will have undefined values.
|
||||||
|
///
|
||||||
|
/// Usage example:
|
||||||
|
/// \code
|
||||||
|
/// sf::Event event;
|
||||||
|
/// while (window.GetEvent(event))
|
||||||
|
/// {
|
||||||
|
/// // Request for closing the window
|
||||||
|
/// if (event.Type == sf::Event::Closed)
|
||||||
|
/// window.Close();
|
||||||
|
///
|
||||||
|
/// // The escape key was pressed
|
||||||
|
/// if ((event.Type == sf::Event::KeyPressed) && (event.Key.Code == sf::Key::Escape))
|
||||||
|
/// window.Close();
|
||||||
|
///
|
||||||
|
/// // The window was resized
|
||||||
|
/// if (event.Type == sf::Event::Resized)
|
||||||
|
/// DoSomethingWithTheNewSize(event.Size.Width, event.Size.Height);
|
||||||
|
///
|
||||||
|
/// // etc ...
|
||||||
|
/// }
|
||||||
|
/// \endcode
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
@ -37,24 +37,24 @@
|
|||||||
namespace sf
|
namespace sf
|
||||||
{
|
{
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Input handles real-time input from keyboard and mouse.
|
/// \brief Give access to the real-time states of keyboard,
|
||||||
/// Use it instead of events to handle continuous moves and more
|
/// mouse and joysticks
|
||||||
/// game-friendly inputs
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
class SFML_API Input : public WindowListener, NonCopyable
|
class SFML_API Input : public WindowListener, NonCopyable
|
||||||
{
|
{
|
||||||
public :
|
public :
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Default constructor
|
/// \brief Default constructor
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
Input();
|
Input();
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Get the state of a key
|
/// \brief Get the current state of a key (pressed or released)
|
||||||
///
|
///
|
||||||
/// \param key : Key to check
|
/// \param key Code of the key to test
|
||||||
///
|
///
|
||||||
/// \return True if key is down, false if key is up
|
/// \return True if key is down, false if key is up
|
||||||
///
|
///
|
||||||
@ -62,9 +62,9 @@ public :
|
|||||||
bool IsKeyDown(Key::Code key) const;
|
bool IsKeyDown(Key::Code key) const;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Get the state of a mouse button
|
/// \brief Get the current state of a mouse button (pressed or released)
|
||||||
///
|
///
|
||||||
/// \param button : Button to check
|
/// \param button Code of the mouse button to check
|
||||||
///
|
///
|
||||||
/// \return True if button is down, false if button is up
|
/// \return True if button is down, false if button is up
|
||||||
///
|
///
|
||||||
@ -72,10 +72,10 @@ public :
|
|||||||
bool IsMouseButtonDown(Mouse::Button button) const;
|
bool IsMouseButtonDown(Mouse::Button button) const;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Get the state of a joystick button
|
/// \brief Get the current state of a joystick button (pressed or released)
|
||||||
///
|
///
|
||||||
/// \param joystick : Identifier of the joystick to check (0 or 1)
|
/// \param joystick Index of the joystick to test (0 or 1)
|
||||||
/// \param button : Button to check
|
/// \param button Index of the button to test
|
||||||
///
|
///
|
||||||
/// \return True if button is down, false if button is up
|
/// \return True if button is down, false if button is up
|
||||||
///
|
///
|
||||||
@ -83,28 +83,37 @@ public :
|
|||||||
bool IsJoystickButtonDown(unsigned int joystick, unsigned int button) const;
|
bool IsJoystickButtonDown(unsigned int joystick, unsigned int button) const;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Get the mouse X position
|
/// \brief Get the current mouse X position
|
||||||
///
|
///
|
||||||
/// \return Current mouse left position, relative to owner window
|
/// The returned position is relative to the left border
|
||||||
|
/// of the owner window.
|
||||||
|
///
|
||||||
|
/// \return Current mouse left position
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
int GetMouseX() const;
|
int GetMouseX() const;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Get the mouse Y position
|
/// \brief Get the current mouse Y position
|
||||||
///
|
///
|
||||||
/// \return Current mouse top position, relative to owner window
|
/// The returned position is relative to the top border
|
||||||
|
/// of the owner window.
|
||||||
|
///
|
||||||
|
/// \return Current mouse top position
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
int GetMouseY() const;
|
int GetMouseY() const;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Get a joystick axis position
|
/// \brief Get the current position of a joystick axis
|
||||||
///
|
///
|
||||||
/// \param joystick : Identifier of the joystick to check (0 or 1)
|
/// The returned position is in the range [-100, 100], except
|
||||||
/// \param axis : Axis to get
|
/// the POV which is an angle and is thus defined in [0, 360].
|
||||||
///
|
///
|
||||||
/// \return Current axis position, in the range [-100, 100] (except for POV, which is [0, 360])
|
/// \param joystick Index of the joystick to test (0 or 1)
|
||||||
|
/// \param axis Axis to test
|
||||||
|
///
|
||||||
|
/// \return Current axis position
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
float GetJoystickAxis(unsigned int joystick, Joy::Axis axis) const;
|
float GetJoystickAxis(unsigned int joystick, Joy::Axis axis) const;
|
||||||
@ -112,7 +121,9 @@ public :
|
|||||||
private :
|
private :
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// /see WindowListener::OnEvent
|
/// \brief Called each time an event is received from the attached window
|
||||||
|
///
|
||||||
|
/// \param event Event received
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
virtual void OnEvent(const Event& event);
|
virtual void OnEvent(const Event& event);
|
||||||
@ -122,7 +133,7 @@ private :
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
bool myKeys[Key::Count]; ///< Array containing the state of all keyboard keys
|
bool myKeys[Key::Count]; ///< Array containing the state of all keyboard keys
|
||||||
bool myMouseButtons[Mouse::Count]; ///< Array containing the state of all mouse buttons
|
bool myMouseButtons[Mouse::Count]; ///< Array containing the state of all mouse buttons
|
||||||
bool myJoystickButtons[2][16]; ///< Array containing the state of all joysticks buttons
|
bool myJoystickButtons[2][32]; ///< Array containing the state of all joysticks buttons
|
||||||
int myMouseX; ///< Mouse position on X
|
int myMouseX; ///< Mouse position on X
|
||||||
int myMouseY; ///< Mouse position on Y
|
int myMouseY; ///< Mouse position on Y
|
||||||
float myJoystickAxis[2][Joy::Count]; ///< Joysticks position on each axis
|
float myJoystickAxis[2][Joy::Count]; ///< Joysticks position on each axis
|
||||||
@ -132,3 +143,43 @@ private :
|
|||||||
|
|
||||||
|
|
||||||
#endif // SFML_INPUT_HPP
|
#endif // SFML_INPUT_HPP
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \class sf::Input
|
||||||
|
///
|
||||||
|
/// sf::Input provides a way to access the state of keys,
|
||||||
|
/// mouse buttons, mouse position, joystick buttons and
|
||||||
|
/// jostick axis.
|
||||||
|
///
|
||||||
|
/// sf::Input provides the same informations as the event
|
||||||
|
/// system, but these informations can be accessed at any time,
|
||||||
|
/// which is more convenient in many situations.
|
||||||
|
///
|
||||||
|
/// For example, to move an entity you can decide to catch the
|
||||||
|
/// sf::Event::KeyPressed event on arrow keys. But if you do so,
|
||||||
|
/// you will only receive one event when the key gets pressed
|
||||||
|
/// (or repeated events if you activated this feature), thus the
|
||||||
|
/// entity will not move smoothly. The best solution here is to
|
||||||
|
/// use sf::Input::IsKeyDown so that you can update your entity's
|
||||||
|
/// position at every iteration of your game loop, not only when you
|
||||||
|
/// catch a KeyPressed event.
|
||||||
|
///
|
||||||
|
/// Note that instances of sf::Input cannot be created directly,
|
||||||
|
/// they must be retrieved from a window (sf::Window) with its
|
||||||
|
/// GetInput() function.
|
||||||
|
///
|
||||||
|
/// Usage example:
|
||||||
|
/// \code
|
||||||
|
/// // Retrieve the input object attached to our window
|
||||||
|
/// const sf::Input& input = window.GetInput();
|
||||||
|
///
|
||||||
|
/// // Move an entity according to the current keys state
|
||||||
|
/// float offset = 5 * window.GetFrameTime(); // 5 pixels/sec
|
||||||
|
/// if (input.IsKeyDown(sf::Key::Left)) entity.Move(-offset, 0);
|
||||||
|
/// if (input.IsKeyDown(sf::Key::Right)) entity.Move( offset, 0);
|
||||||
|
/// if (input.IsKeyDown(sf::Key::Up)) entity.Move(0, -offset);
|
||||||
|
/// if (input.IsKeyDown(sf::Key::Down)) entity.Move(0, offset);
|
||||||
|
/// \endcode
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
@ -35,32 +35,33 @@
|
|||||||
namespace sf
|
namespace sf
|
||||||
{
|
{
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// VideoMode defines a video mode (width, height, bpp, frequency)
|
/// \brief VideoMode defines a video mode (width, height, bpp)
|
||||||
/// and provides static functions for getting modes supported
|
///
|
||||||
/// by the display device
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
class SFML_API VideoMode
|
class SFML_API VideoMode
|
||||||
{
|
{
|
||||||
public :
|
public :
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Default constructor
|
/// \brief Default constructor
|
||||||
|
///
|
||||||
|
/// This constructors initializes all members to 0.
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
VideoMode();
|
VideoMode();
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Construct the video mode with its attributes
|
/// \brief Construct the video mode with its attributes
|
||||||
///
|
///
|
||||||
/// \param width : Width in pixels
|
/// \param width Width in pixels
|
||||||
/// \param height : Height in pixels
|
/// \param height Height in pixels
|
||||||
/// \param bitsPerPixel : Pixel depths in bits per pixel (32 by default)
|
/// \param bitsPerPixel Pixel depths in bits per pixel
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
VideoMode(unsigned int width, unsigned int height, unsigned int bitsPerPixel = 32);
|
VideoMode(unsigned int width, unsigned int height, unsigned int bitsPerPixel = 32);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Get the current desktop video mode
|
/// \brief Get the current desktop video mode
|
||||||
///
|
///
|
||||||
/// \return Current desktop video mode
|
/// \return Current desktop video mode
|
||||||
///
|
///
|
||||||
@ -68,11 +69,13 @@ public :
|
|||||||
static VideoMode GetDesktopMode();
|
static VideoMode GetDesktopMode();
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Get a valid video mode
|
/// \brief Get a valid video mode
|
||||||
/// Index must be in range [0, GetModesCount()[
|
|
||||||
/// Modes are sorted from best to worst
|
|
||||||
///
|
///
|
||||||
/// \param index : Index of video mode to get
|
/// The parameter \index must be in the range [0, GetModesCount()[.
|
||||||
|
/// Modes are sorted from best to worst, so that
|
||||||
|
/// sf::VideoMode::GetMode(0) will always give the best.
|
||||||
|
///
|
||||||
|
/// \param index Index of video mode to get
|
||||||
///
|
///
|
||||||
/// \return Corresponding video mode (invalid mode if index is out of range)
|
/// \return Corresponding video mode (invalid mode if index is out of range)
|
||||||
///
|
///
|
||||||
@ -80,41 +83,29 @@ public :
|
|||||||
static VideoMode GetMode(std::size_t index);
|
static VideoMode GetMode(std::size_t index);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Get valid video modes count
|
/// \brief Get the total number of valid video modes available
|
||||||
///
|
///
|
||||||
/// \return Number of valid video modes available
|
/// The validity of video modes is only relevant when using
|
||||||
|
/// fullscreen windows; otherwise any video mode can be used
|
||||||
|
/// with no restriction.
|
||||||
|
///
|
||||||
|
/// \return Number of valid video modes available for fullscreen mode
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
static std::size_t GetModesCount();
|
static std::size_t GetModesCount();
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Tell whether or not the video mode is supported
|
/// \brief Tell whether or not the video mode is valid
|
||||||
///
|
///
|
||||||
/// \return True if video mode is supported, false otherwise
|
/// The validity of video modes is only relevant when using
|
||||||
|
/// fullscreen windows; otherwise any video mode can be used
|
||||||
|
/// with no restriction.
|
||||||
|
///
|
||||||
|
/// \return True if the video mode is valid for fullscreen mode
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
bool IsValid() const;
|
bool IsValid() const;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// Comparison operator overload -- tell if two video modes are equal
|
|
||||||
///
|
|
||||||
/// \param other : Video mode to compare
|
|
||||||
///
|
|
||||||
/// \return True if modes are equal
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
bool operator ==(const VideoMode& other) const;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// Comparison operator overload -- tell if two video modes are different
|
|
||||||
///
|
|
||||||
/// \param other : Video mode to compare
|
|
||||||
///
|
|
||||||
/// \return True if modes are different
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
bool operator !=(const VideoMode& other) const;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
// Member data
|
// Member data
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
@ -123,7 +114,81 @@ public :
|
|||||||
unsigned int BitsPerPixel; ///< Video mode pixel depth, in bits per pixels
|
unsigned int BitsPerPixel; ///< Video mode pixel depth, in bits per pixels
|
||||||
};
|
};
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Overload of binary == operator
|
||||||
|
///
|
||||||
|
/// This operator compares strict equality between two modes,
|
||||||
|
/// i.e. it checks if all their members are equal.
|
||||||
|
///
|
||||||
|
/// \param left Left operand
|
||||||
|
/// \param right Right operand
|
||||||
|
///
|
||||||
|
/// \return True if modes are equal
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
SFML_API bool operator ==(const VideoMode& left, const VideoMode& right);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Overload of binary != operator
|
||||||
|
///
|
||||||
|
/// This operator compares strict difference between two modes,
|
||||||
|
/// i.e. it checks if not all their members are equal.
|
||||||
|
///
|
||||||
|
/// \param left Left operand
|
||||||
|
/// \param right Right operand
|
||||||
|
///
|
||||||
|
/// \return True if modes are different
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
SFML_API bool operator !=(const VideoMode& left, const VideoMode& right);
|
||||||
|
|
||||||
} // namespace sf
|
} // namespace sf
|
||||||
|
|
||||||
|
|
||||||
#endif // SFML_VIDEOMODE_HPP
|
#endif // SFML_VIDEOMODE_HPP
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \class sf::VideoMode
|
||||||
|
///
|
||||||
|
/// A video mode is defined by a width and a height (in pixels)
|
||||||
|
/// and a depth (in bits per pixel). Video modes are used to
|
||||||
|
/// setup windows (sf::Window) at creation time.
|
||||||
|
///
|
||||||
|
/// The main usage of video modes is for fullscreen mode:
|
||||||
|
/// indeed you must use one of the valid video modes
|
||||||
|
/// allowed by the OS (which are defined by what the monitor
|
||||||
|
/// and the graphics card support), otherwise your window
|
||||||
|
/// creation will just fail.
|
||||||
|
///
|
||||||
|
/// sf::VideoMode provides two static functions for retrieving
|
||||||
|
/// the list of all the video modes supported by the system:
|
||||||
|
/// GetModesCount() to get the number of video modes in the
|
||||||
|
/// list, and GetMode() to retrieve a particular mode
|
||||||
|
/// from the list.
|
||||||
|
///
|
||||||
|
/// A custom video mode can also be checked directly with
|
||||||
|
/// its IsValid() function.
|
||||||
|
///
|
||||||
|
/// Additionnally, sf::VideoMode provides a static function
|
||||||
|
/// to get the mode currently used by the desktop: GetDesktopMode().
|
||||||
|
/// This allows to build windows with the same size or pixel
|
||||||
|
/// depth as the current resolution.
|
||||||
|
///
|
||||||
|
/// Usage example:
|
||||||
|
/// \code
|
||||||
|
/// // Display the list of all the video modes available for fullscreen
|
||||||
|
/// for (std::size_t i = 0; i < sf::VideoMode::GetModesCount(); ++i)
|
||||||
|
/// {
|
||||||
|
/// sf::VideoMode mode = sf::VideoMode::GetMode(i);
|
||||||
|
/// std::cout << "Mode #" << i << ": "
|
||||||
|
/// << mode.Width << "x" << mode.Height << " - "
|
||||||
|
/// << mode.BitsPerPixel << " bpp" << std::endl;
|
||||||
|
/// }
|
||||||
|
///
|
||||||
|
/// // Create a window with the same pixel depth as the desktop
|
||||||
|
/// sf::VideoMode desktop = sf::VideoMode::GetDesktopMode();
|
||||||
|
/// window.Create(sf::VideoMode(1024, 768, desktop.BitsPerPixel), "SFML window");
|
||||||
|
/// \endcode
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
@ -68,8 +68,8 @@ public :
|
|||||||
///
|
///
|
||||||
/// \param mode : Video mode to use
|
/// \param mode : Video mode to use
|
||||||
/// \param title : Title of the window
|
/// \param title : Title of the window
|
||||||
/// \param style : Window style (Resize | Close by default)
|
/// \param style : Window style
|
||||||
/// \param settings : Additional settings for the underlying OpenGL context (see default constructor for default values)
|
/// \param settings : Additional settings for the underlying OpenGL context
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
Window(VideoMode mode, const std::string& title, unsigned long style = Style::Resize | Style::Close, const ContextSettings& settings = ContextSettings());
|
Window(VideoMode mode, const std::string& title, unsigned long style = Style::Resize | Style::Close, const ContextSettings& settings = ContextSettings());
|
||||||
@ -78,7 +78,7 @@ public :
|
|||||||
/// Construct the window from an existing control
|
/// Construct the window from an existing control
|
||||||
///
|
///
|
||||||
/// \param handle : Platform-specific handle of the control
|
/// \param handle : Platform-specific handle of the control
|
||||||
/// \param settings : Additional settings for the underlying OpenGL context (see default constructor for default values)
|
/// \param settings : Additional settings for the underlying OpenGL context
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
Window(WindowHandle handle, const ContextSettings& settings = ContextSettings());
|
Window(WindowHandle handle, const ContextSettings& settings = ContextSettings());
|
||||||
@ -94,8 +94,8 @@ public :
|
|||||||
///
|
///
|
||||||
/// \param mode : Video mode to use
|
/// \param mode : Video mode to use
|
||||||
/// \param title : Title of the window
|
/// \param title : Title of the window
|
||||||
/// \param style : Window style (Resize | Close by default)
|
/// \param style : Window style
|
||||||
/// \param Settings : Additional settings for the underlying OpenGL context (see default constructor for default values)
|
/// \param Settings : Additional settings for the underlying OpenGL context
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void Create(VideoMode mode, const std::string& title, unsigned long style = Style::Resize | Style::Close, const ContextSettings& settings = ContextSettings());
|
void Create(VideoMode mode, const std::string& title, unsigned long style = Style::Resize | Style::Close, const ContextSettings& settings = ContextSettings());
|
||||||
@ -104,7 +104,7 @@ public :
|
|||||||
/// Create (or recreate) the window from an existing control
|
/// Create (or recreate) the window from an existing control
|
||||||
///
|
///
|
||||||
/// \param handle : Platform-specific handle of the control
|
/// \param handle : Platform-specific handle of the control
|
||||||
/// \param settings : Additional settings for the underlying OpenGL context (see default constructor for default values)
|
/// \param settings : Additional settings for the underlying OpenGL context
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void Create(WindowHandle handle, const ContextSettings& settings = ContextSettings());
|
void Create(WindowHandle handle, const ContextSettings& settings = ContextSettings());
|
||||||
@ -236,7 +236,7 @@ public :
|
|||||||
/// Activate or deactivate the window as the current target
|
/// Activate or deactivate the window as the current target
|
||||||
/// for rendering
|
/// for rendering
|
||||||
///
|
///
|
||||||
/// \param active : True to activate, false to deactivate (true by default)
|
/// \param active : True to activate, false to deactivate
|
||||||
///
|
///
|
||||||
/// \return True if operation was successful, false otherwise
|
/// \return True if operation was successful, false otherwise
|
||||||
///
|
///
|
||||||
|
@ -36,7 +36,7 @@ namespace sf
|
|||||||
class Event;
|
class Event;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Base class for classes that want to receive events
|
/// \brief Base class for classes that want to receive events
|
||||||
/// from a window (for internal use only)
|
/// from a window (for internal use only)
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
class SFML_API WindowListener
|
class SFML_API WindowListener
|
||||||
@ -44,9 +44,9 @@ class SFML_API WindowListener
|
|||||||
public :
|
public :
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Called each time an event is received from attached window
|
/// \brief Called each time an event is received from the attached window
|
||||||
///
|
///
|
||||||
/// \param event : Event received
|
/// \param event Event received
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
virtual void OnEvent(const Event& event) = 0;
|
virtual void OnEvent(const Event& event) = 0;
|
||||||
@ -54,7 +54,7 @@ public :
|
|||||||
protected :
|
protected :
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Destructor
|
/// \brief Destructor
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
virtual ~WindowListener() {}
|
virtual ~WindowListener() {}
|
||||||
|
@ -28,9 +28,9 @@
|
|||||||
|
|
||||||
namespace sf
|
namespace sf
|
||||||
{
|
{
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Enumeration of window creation styles
|
/// \brief Enumeration of the window styles
|
||||||
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
namespace Style
|
namespace Style
|
||||||
{
|
{
|
||||||
@ -44,7 +44,6 @@ namespace Style
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
} // namespace sf
|
} // namespace sf
|
||||||
|
|
||||||
|
|
||||||
|
@ -23,8 +23,8 @@ public :
|
|||||||
/// Construct the QSFMLCanvas
|
/// Construct the QSFMLCanvas
|
||||||
///
|
///
|
||||||
/// \param size : Initial size of the widget
|
/// \param size : Initial size of the widget
|
||||||
/// \param frameTime : Frame duration, in milliseconds (0 by default)
|
/// \param frameTime : Frame duration, in milliseconds
|
||||||
/// \param parent : Parent of the widget (NULL by default)
|
/// \param parent : Parent of the widget
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
QSFMLCanvas(const QSize& size, unsigned int frameTime = 0, QWidget* parent = NULL);
|
QSFMLCanvas(const QSize& size, unsigned int frameTime = 0, QWidget* parent = NULL);
|
||||||
|
@ -19,11 +19,11 @@ public :
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Construct the wxSFMLCanvas
|
/// Construct the wxSFMLCanvas
|
||||||
///
|
///
|
||||||
/// \param parent : Parent of the control (NULL by default)
|
/// \param parent : Parent of the control
|
||||||
/// \param id : Identifier of the control (-1 by default)
|
/// \param id : Identifier of the control
|
||||||
/// \param position : Position of the control (wxDefaultPosition by default)
|
/// \param position : Position of the control
|
||||||
/// \param size : Size of the control (wxDefaultSize by default)
|
/// \param size : Size of the control
|
||||||
/// \param style : Style of the control (0 by default)
|
/// \param style : Style of the control
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
wxSFMLCanvas(wxWindow* parent = NULL, wxWindowID id = -1, const wxPoint& position = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0);
|
wxSFMLCanvas(wxWindow* parent = NULL, wxWindowID id = -1, const wxPoint& position = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0);
|
||||||
|
@ -32,8 +32,6 @@
|
|||||||
namespace sf
|
namespace sf
|
||||||
{
|
{
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Default constructor -- creates and activates the context
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
Context::Context()
|
Context::Context()
|
||||||
{
|
{
|
||||||
myContext = priv::ContextGL::New();
|
myContext = priv::ContextGL::New();
|
||||||
@ -41,8 +39,6 @@ Context::Context()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// Destructor -- deactivates and destroys the context
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
Context::~Context()
|
Context::~Context()
|
||||||
{
|
{
|
||||||
@ -51,8 +47,6 @@ Context::~Context()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// Activate or deactivate explicitely the context
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void Context::SetActive(bool active)
|
void Context::SetActive(bool active)
|
||||||
{
|
{
|
||||||
|
@ -73,16 +73,12 @@ namespace sf
|
|||||||
namespace priv
|
namespace priv
|
||||||
{
|
{
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Create a new context, not associated to a window
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
ContextGL* ContextGL::New()
|
ContextGL* ContextGL::New()
|
||||||
{
|
{
|
||||||
return new ContextType(&referenceContext);
|
return new ContextType(&referenceContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// Create a new context attached to a window
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
ContextGL* ContextGL::New(const WindowImpl* owner, unsigned int bitsPerPixel, const ContextSettings& settings)
|
ContextGL* ContextGL::New(const WindowImpl* owner, unsigned int bitsPerPixel, const ContextSettings& settings)
|
||||||
{
|
{
|
||||||
@ -96,8 +92,6 @@ ContextGL* ContextGL::New(const WindowImpl* owner, unsigned int bitsPerPixel, co
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// Destructor
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
ContextGL::~ContextGL()
|
ContextGL::~ContextGL()
|
||||||
{
|
{
|
||||||
@ -112,8 +106,6 @@ ContextGL::~ContextGL()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// Get the settings of the context
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
const ContextSettings& ContextGL::GetSettings() const
|
const ContextSettings& ContextGL::GetSettings() const
|
||||||
{
|
{
|
||||||
@ -121,9 +113,6 @@ const ContextSettings& ContextGL::GetSettings() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// Activate or deactivate the context as the current target
|
|
||||||
/// for rendering
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
bool ContextGL::SetActive(bool active)
|
bool ContextGL::SetActive(bool active)
|
||||||
{
|
{
|
||||||
@ -151,8 +140,6 @@ bool ContextGL::SetActive(bool active)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// Default constructor
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
ContextGL::ContextGL()
|
ContextGL::ContextGL()
|
||||||
{
|
{
|
||||||
@ -160,10 +147,6 @@ ContextGL::ContextGL()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// Evaluate a pixel format configuration.
|
|
||||||
/// This functions can be used by implementations that have
|
|
||||||
/// several valid formats and want to get the best one
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
int ContextGL::EvaluateFormat(unsigned int bitsPerPixel, const ContextSettings& settings, int colorBits, int depthBits, int stencilBits, int antialiasing)
|
int ContextGL::EvaluateFormat(unsigned int bitsPerPixel, const ContextSettings& settings, int colorBits, int depthBits, int stencilBits, int antialiasing)
|
||||||
{
|
{
|
||||||
|
@ -40,28 +40,35 @@ namespace priv
|
|||||||
class WindowImpl;
|
class WindowImpl;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Abstract class representing an OpenGL context
|
/// \brief Abstract class representing an OpenGL context
|
||||||
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
class ContextGL : NonCopyable
|
class ContextGL : NonCopyable
|
||||||
{
|
{
|
||||||
public :
|
public :
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Create a new context, not associated to a window
|
/// \brief Create a new context, not associated to a window
|
||||||
///
|
///
|
||||||
/// \return Pointer to the created context
|
/// This function automatically chooses the specialized class
|
||||||
|
/// to use according to the OS.
|
||||||
|
///
|
||||||
|
/// \return Pointer to the created context (don't forget to delete it)
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
static ContextGL* New();
|
static ContextGL* New();
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Create a new context attached to a window
|
/// \brief Create a new context attached to a window
|
||||||
///
|
///
|
||||||
/// \param owner : Pointer to the owner window
|
/// This function automatically chooses the specialized class
|
||||||
/// \param bitsPerPixel : Pixel depth (in bits per pixel)
|
/// to use according to the OS.
|
||||||
/// \param settings : Creation parameters
|
|
||||||
///
|
///
|
||||||
/// \return Pointer to the created context
|
/// \param owner Pointer to the owner window
|
||||||
|
/// \param bitsPerPixel Pixel depth (in bits per pixel)
|
||||||
|
/// \param settings Creation parameters
|
||||||
|
///
|
||||||
|
/// \return Pointer to the created context (don't forget to delete it)
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
static ContextGL* New(const WindowImpl* owner, unsigned int bitsPerPixel, const ContextSettings& settings);
|
static ContextGL* New(const WindowImpl* owner, unsigned int bitsPerPixel, const ContextSettings& settings);
|
||||||
@ -69,13 +76,17 @@ public :
|
|||||||
public :
|
public :
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Virtual destructor
|
/// \brief Destructor
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
virtual ~ContextGL();
|
virtual ~ContextGL();
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Get the settings of the context
|
/// \brief Get the settings of the context
|
||||||
|
///
|
||||||
|
/// Note that these settings may be different than the ones
|
||||||
|
/// passed to the constructor; they are indeed adjusted if the
|
||||||
|
/// original settings are not directly supported by the system.
|
||||||
///
|
///
|
||||||
/// \return Structure containing the settings
|
/// \return Structure containing the settings
|
||||||
///
|
///
|
||||||
@ -83,10 +94,16 @@ public :
|
|||||||
const ContextSettings& GetSettings() const;
|
const ContextSettings& GetSettings() const;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Activate or deactivate the context as the current target
|
/// \brief Activate or deactivate the context as the current target
|
||||||
/// for rendering
|
/// for rendering
|
||||||
///
|
///
|
||||||
/// \param active : True to activate, false to deactivate
|
/// A context is active only on the current thread, if you want to
|
||||||
|
/// make it active on another thread you have to deactivate it
|
||||||
|
/// on the previous thread first if it was active.
|
||||||
|
/// Only one context can be active on a thread at a time, thus
|
||||||
|
/// the context previously active (if any) automatically gets deactivated.
|
||||||
|
///
|
||||||
|
/// \param active True to activate, false to deactivate
|
||||||
///
|
///
|
||||||
/// \return True if operation was successful, false otherwise
|
/// \return True if operation was successful, false otherwise
|
||||||
///
|
///
|
||||||
@ -94,13 +111,18 @@ public :
|
|||||||
bool SetActive(bool active);
|
bool SetActive(bool active);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Display the contents of the context
|
/// \brief Display what has been rendered to the context so far
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
virtual void Display() = 0;
|
virtual void Display() = 0;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Enable / disable vertical synchronization
|
/// \brief Enable or disable vertical synchronization
|
||||||
|
///
|
||||||
|
/// Activating vertical synchronization will limit the number
|
||||||
|
/// of frames displayed to the refresh rate of the monitor.
|
||||||
|
/// This can avoid some visual artifacts, and limit the framerate
|
||||||
|
/// to a good value (but not constant across different computers).
|
||||||
///
|
///
|
||||||
/// \param enabled : True to enable v-sync, false to deactivate
|
/// \param enabled : True to enable v-sync, false to deactivate
|
||||||
///
|
///
|
||||||
@ -110,15 +132,18 @@ public :
|
|||||||
protected :
|
protected :
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Default constructor
|
/// \brief Default constructor
|
||||||
|
///
|
||||||
|
/// This constructor is meant for derived classes only.
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
ContextGL();
|
ContextGL();
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Make this context the current one
|
/// \brief Activate or deactivate the context as the current target
|
||||||
|
/// for rendering
|
||||||
///
|
///
|
||||||
/// \param active : True to activate, false to deactivate
|
/// \param active True to activate, false to deactivate
|
||||||
///
|
///
|
||||||
/// \return True on success, false if any error happened
|
/// \return True on success, false if any error happened
|
||||||
///
|
///
|
||||||
@ -126,18 +151,21 @@ protected :
|
|||||||
virtual bool MakeCurrent(bool active) = 0;
|
virtual bool MakeCurrent(bool active) = 0;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Evaluate a pixel format configuration.
|
/// \brief Evaluate a pixel format configuration
|
||||||
|
///
|
||||||
/// This functions can be used by implementations that have
|
/// This functions can be used by implementations that have
|
||||||
/// several valid formats and want to get the best one
|
/// several valid formats and want to get the best one.
|
||||||
|
/// A score is returned for the given configuration: the
|
||||||
|
/// lower the score is, the better the configuration is.
|
||||||
///
|
///
|
||||||
/// \param bitsPerPixel : Requested pixel depth (bits per pixel)
|
/// \param bitsPerPixel Requested pixel depth (bits per pixel)
|
||||||
/// \param settings : Requested additionnal settings
|
/// \param settings Requested additionnal settings
|
||||||
/// \param colorBits : Color bits of the configuration to evaluate
|
/// \param colorBits Color bits of the configuration to evaluate
|
||||||
/// \param depthBits : Depth bits of the configuration to evaluate
|
/// \param depthBits Depth bits of the configuration to evaluate
|
||||||
/// \param stencilBits : Stencil bits of the configuration to evaluate
|
/// \param stencilBits Stencil bits of the configuration to evaluate
|
||||||
/// \param antialiasing : Antialiasing level of the configuration to evaluate
|
/// \param antialiasing Antialiasing level of the configuration to evaluate
|
||||||
///
|
///
|
||||||
/// \return Score of the configuration : the lower the better
|
/// \return Score of the configuration
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
static int EvaluateFormat(unsigned int bitsPerPixel, const ContextSettings& settings, int colorBits, int depthBits, int stencilBits, int antialiasing);
|
static int EvaluateFormat(unsigned int bitsPerPixel, const ContextSettings& settings, int colorBits, int depthBits, int stencilBits, int antialiasing);
|
||||||
|
@ -31,8 +31,6 @@
|
|||||||
namespace sf
|
namespace sf
|
||||||
{
|
{
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Default constructor
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
Input::Input() :
|
Input::Input() :
|
||||||
myMouseX(0),
|
myMouseX(0),
|
||||||
myMouseY(0)
|
myMouseY(0)
|
||||||
@ -43,7 +41,7 @@ myMouseY(0)
|
|||||||
for (int i = 0; i < Mouse::Count; ++i)
|
for (int i = 0; i < Mouse::Count; ++i)
|
||||||
myMouseButtons[i] = false;
|
myMouseButtons[i] = false;
|
||||||
|
|
||||||
for (int i = 0; i < 16; ++i)
|
for (int i = 0; i < 32; ++i)
|
||||||
{
|
{
|
||||||
myJoystickButtons[0][i] = false;
|
myJoystickButtons[0][i] = false;
|
||||||
myJoystickButtons[1][i] = false;
|
myJoystickButtons[1][i] = false;
|
||||||
@ -57,8 +55,6 @@ myMouseY(0)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// Get the state of a key
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
bool Input::IsKeyDown(Key::Code key) const
|
bool Input::IsKeyDown(Key::Code key) const
|
||||||
{
|
{
|
||||||
@ -66,8 +62,6 @@ bool Input::IsKeyDown(Key::Code key) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// Get the state of a mouse button
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
bool Input::IsMouseButtonDown(Mouse::Button button) const
|
bool Input::IsMouseButtonDown(Mouse::Button button) const
|
||||||
{
|
{
|
||||||
@ -75,20 +69,16 @@ bool Input::IsMouseButtonDown(Mouse::Button button) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// Get the state of a joystick button
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
bool Input::IsJoystickButtonDown(unsigned int joystick, unsigned int button) const
|
bool Input::IsJoystickButtonDown(unsigned int joystick, unsigned int button) const
|
||||||
{
|
{
|
||||||
if ((joystick < 2) && (button < 16))
|
if ((joystick < 2) && (button < 32))
|
||||||
return myJoystickButtons[joystick][button];
|
return myJoystickButtons[joystick][button];
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// Get the mouse left position
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
int Input::GetMouseX() const
|
int Input::GetMouseX() const
|
||||||
{
|
{
|
||||||
@ -96,8 +86,6 @@ int Input::GetMouseX() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// Get the mouse top position
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
int Input::GetMouseY() const
|
int Input::GetMouseY() const
|
||||||
{
|
{
|
||||||
@ -105,8 +93,6 @@ int Input::GetMouseY() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// Get a joystick axis position
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
float Input::GetJoystickAxis(unsigned int joystick, Joy::Axis axis) const
|
float Input::GetJoystickAxis(unsigned int joystick, Joy::Axis axis) const
|
||||||
{
|
{
|
||||||
@ -114,8 +100,6 @@ float Input::GetJoystickAxis(unsigned int joystick, Joy::Axis axis) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// /see WindowListener::OnEvent
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void Input::OnEvent(const Event& event)
|
void Input::OnEvent(const Event& event)
|
||||||
{
|
{
|
||||||
@ -153,7 +137,7 @@ void Input::OnEvent(const Event& event)
|
|||||||
for (int i = 0; i < Mouse::Count; ++i)
|
for (int i = 0; i < Mouse::Count; ++i)
|
||||||
myMouseButtons[i] = false;
|
myMouseButtons[i] = false;
|
||||||
|
|
||||||
for (int i = 0; i < 16; ++i)
|
for (int i = 0; i < 32; ++i)
|
||||||
{
|
{
|
||||||
myJoystickButtons[0][i] = false;
|
myJoystickButtons[0][i] = false;
|
||||||
myJoystickButtons[1][i] = false;
|
myJoystickButtons[1][i] = false;
|
||||||
|
@ -37,7 +37,8 @@ namespace sf
|
|||||||
namespace priv
|
namespace priv
|
||||||
{
|
{
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Structure holding the joystick state's parameters
|
/// \brief Structure holding the joystick state's parameters
|
||||||
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
struct JoystickState
|
struct JoystickState
|
||||||
{
|
{
|
||||||
|
@ -37,8 +37,6 @@ namespace sf
|
|||||||
namespace priv
|
namespace priv
|
||||||
{
|
{
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Create a new context, not associated to a window
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
ContextGLX::ContextGLX(ContextGLX* shared) :
|
ContextGLX::ContextGLX(ContextGLX* shared) :
|
||||||
myWindow (0),
|
myWindow (0),
|
||||||
myContext (NULL),
|
myContext (NULL),
|
||||||
@ -63,13 +61,10 @@ myOwnsWindow(true)
|
|||||||
CreateContext(shared, VideoMode::GetDesktopMode().BitsPerPixel, ContextSettings(0, 0, 0));
|
CreateContext(shared, VideoMode::GetDesktopMode().BitsPerPixel, ContextSettings(0, 0, 0));
|
||||||
|
|
||||||
// Activate the context
|
// Activate the context
|
||||||
//if (shared)
|
|
||||||
SetActive(true);
|
SetActive(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// Create a new context attached to a window
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
ContextGLX::ContextGLX(ContextGLX* shared, const WindowImpl* owner, unsigned int bitsPerPixel, const ContextSettings& settings) :
|
ContextGLX::ContextGLX(ContextGLX* shared, const WindowImpl* owner, unsigned int bitsPerPixel, const ContextSettings& settings) :
|
||||||
myWindow (0),
|
myWindow (0),
|
||||||
@ -87,13 +82,10 @@ myOwnsWindow(false)
|
|||||||
CreateContext(shared, bitsPerPixel, settings);
|
CreateContext(shared, bitsPerPixel, settings);
|
||||||
|
|
||||||
// Activate the context
|
// Activate the context
|
||||||
//if (shared)
|
|
||||||
SetActive(true);
|
SetActive(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// Destructor
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
ContextGLX::~ContextGLX()
|
ContextGLX::~ContextGLX()
|
||||||
{
|
{
|
||||||
@ -120,8 +112,6 @@ ContextGLX::~ContextGLX()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \see Context::MakeCurrent
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
bool ContextGLX::MakeCurrent(bool active)
|
bool ContextGLX::MakeCurrent(bool active)
|
||||||
{
|
{
|
||||||
@ -149,8 +139,6 @@ bool ContextGLX::MakeCurrent(bool active)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \see Context::Display
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void ContextGLX::Display()
|
void ContextGLX::Display()
|
||||||
{
|
{
|
||||||
@ -159,8 +147,6 @@ void ContextGLX::Display()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \see Context::UseVerticalSync
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void ContextGLX::UseVerticalSync(bool enabled)
|
void ContextGLX::UseVerticalSync(bool enabled)
|
||||||
{
|
{
|
||||||
@ -171,8 +157,6 @@ void ContextGLX::UseVerticalSync(bool enabled)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// Check if a context is active on the current thread
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
bool ContextGLX::IsContextActive()
|
bool ContextGLX::IsContextActive()
|
||||||
{
|
{
|
||||||
@ -180,8 +164,6 @@ bool ContextGLX::IsContextActive()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// Create the context
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void ContextGLX::CreateContext(ContextGLX* shared, unsigned int bitsPerPixel, const ContextSettings& settings)
|
void ContextGLX::CreateContext(ContextGLX* shared, unsigned int bitsPerPixel, const ContextSettings& settings)
|
||||||
{
|
{
|
||||||
|
@ -38,57 +38,70 @@ namespace sf
|
|||||||
namespace priv
|
namespace priv
|
||||||
{
|
{
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Linux (GLX) implementation of OpenGL contexts
|
/// \brief Linux (GLX) implementation of OpenGL contexts
|
||||||
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
class ContextGLX : public ContextGL
|
class ContextGLX : public ContextGL
|
||||||
{
|
{
|
||||||
public :
|
public :
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Create a new context, not associated to a window
|
/// \brief Create a new context, not associated to a window
|
||||||
///
|
///
|
||||||
/// \param shared : Context to share the new one with (can be NULL)
|
/// \param shared Context to share the new one with (can be NULL)
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
ContextGLX(ContextGLX* shared);
|
ContextGLX(ContextGLX* shared);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Create a new context attached to a window
|
/// \brief Create a new context attached to a window
|
||||||
///
|
///
|
||||||
/// \param shared : Context to share the new one with (can be NULL)
|
/// \param shared Context to share the new one with (can be NULL)
|
||||||
/// \param owner : Pointer to the owner window
|
/// \param owner Pointer to the owner window
|
||||||
/// \param bitsPerPixel : Pixel depth (in bits per pixel)
|
/// \param bitsPerPixel Pixel depth (in bits per pixel)
|
||||||
/// \param settings : Creation parameters
|
/// \param settings Creation parameters
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
ContextGLX(ContextGLX* shared, const WindowImpl* owner, unsigned int bitsPerPixel, const ContextSettings& settings);
|
ContextGLX(ContextGLX* shared, const WindowImpl* owner, unsigned int bitsPerPixel, const ContextSettings& settings);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Destructor
|
/// \brief Destructor
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
~ContextGLX();
|
~ContextGLX();
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \see Context::MakeCurrent
|
/// \brief Activate or deactivate the context as the current target
|
||||||
|
/// for rendering
|
||||||
|
///
|
||||||
|
/// \param active True to activate, false to deactivate
|
||||||
|
///
|
||||||
|
/// \return True on success, false if any error happened
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
virtual bool MakeCurrent(bool active);
|
virtual bool MakeCurrent(bool active);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \see Context::Display
|
/// \brief Display what has been rendered to the context so far
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
virtual void Display();
|
virtual void Display();
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \see Context::UseVerticalSync
|
/// \brief Enable or disable vertical synchronization
|
||||||
|
///
|
||||||
|
/// Activating vertical synchronization will limit the number
|
||||||
|
/// of frames displayed to the refresh rate of the monitor.
|
||||||
|
/// This can avoid some visual artifacts, and limit the framerate
|
||||||
|
/// to a good value (but not constant across different computers).
|
||||||
|
///
|
||||||
|
/// \param enabled : True to enable v-sync, false to deactivate
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
virtual void UseVerticalSync(bool enabled);
|
virtual void UseVerticalSync(bool enabled);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Check if a context is active on the current thread
|
/// \brief Check if a context is active on the current thread
|
||||||
///
|
///
|
||||||
/// \return True if there's an active context, false otherwise
|
/// \return True if there's an active context, false otherwise
|
||||||
///
|
///
|
||||||
@ -98,11 +111,11 @@ public :
|
|||||||
private :
|
private :
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Create the context
|
/// \brief Create the context
|
||||||
///
|
///
|
||||||
/// \param shared : Context to share the new one with (can be NULL)
|
/// \param shared Context to share the new one with (can be NULL)
|
||||||
/// \param bitsPerPixel : Pixel depth, in bits per pixel
|
/// \param bitsPerPixel Pixel depth, in bits per pixel
|
||||||
/// \param settings : Creation parameters
|
/// \param settings Creation parameters
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void CreateContext(ContextGLX* shared, unsigned int bitsPerPixel, const ContextSettings& settings);
|
void CreateContext(ContextGLX* shared, unsigned int bitsPerPixel, const ContextSettings& settings);
|
||||||
|
@ -42,8 +42,6 @@ namespace priv
|
|||||||
{
|
{
|
||||||
#if defined(SFML_SYSTEM_LINUX)
|
#if defined(SFML_SYSTEM_LINUX)
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// Initialize the instance and bind it to a physical joystick
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void Joystick::Initialize(unsigned int index)
|
void Joystick::Initialize(unsigned int index)
|
||||||
{
|
{
|
||||||
@ -74,8 +72,6 @@ void Joystick::Initialize(unsigned int index)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// Update the current joystick and return its new state
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
JoystickState Joystick::UpdateState()
|
JoystickState Joystick::UpdateState()
|
||||||
{
|
{
|
||||||
@ -109,8 +105,6 @@ JoystickState Joystick::UpdateState()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// Get the number of axes supported by the joystick
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
unsigned int Joystick::GetAxesCount() const
|
unsigned int Joystick::GetAxesCount() const
|
||||||
{
|
{
|
||||||
@ -118,8 +112,6 @@ unsigned int Joystick::GetAxesCount() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// Get the number of buttons supported by the joystick
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
unsigned int Joystick::GetButtonsCount() const
|
unsigned int Joystick::GetButtonsCount() const
|
||||||
{
|
{
|
||||||
@ -130,16 +122,12 @@ unsigned int Joystick::GetButtonsCount() const
|
|||||||
#elif defined(SFML_SYSTEM_FREEBSD)
|
#elif defined(SFML_SYSTEM_FREEBSD)
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// Initialize the instance and bind it to a physical joystick
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void Joystick::Initialize(unsigned int index)
|
void Joystick::Initialize(unsigned int index)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// Update the current joystick and return its new state
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
JoystickState Joystick::UpdateState()
|
JoystickState Joystick::UpdateState()
|
||||||
{
|
{
|
||||||
@ -147,8 +135,6 @@ JoystickState Joystick::UpdateState()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// Get the number of axes supported by the joystick
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
unsigned int Joystick::GetAxesCount() const
|
unsigned int Joystick::GetAxesCount() const
|
||||||
{
|
{
|
||||||
@ -156,8 +142,6 @@ unsigned int Joystick::GetAxesCount() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// Get the number of buttons supported by the joystick
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
unsigned int Joystick::GetButtonsCount() const
|
unsigned int Joystick::GetButtonsCount() const
|
||||||
{
|
{
|
||||||
|
@ -35,22 +35,23 @@ namespace sf
|
|||||||
namespace priv
|
namespace priv
|
||||||
{
|
{
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Linux implementation of Joystick
|
/// \brief Linux implementation of Joystick
|
||||||
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
class Joystick
|
class Joystick
|
||||||
{
|
{
|
||||||
public :
|
public :
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Initialize the instance and bind it to a physical joystick
|
/// \brief Initialize the instance and bind it to a physical joystick
|
||||||
///
|
///
|
||||||
/// \param index : Index of the physical joystick to bind to
|
/// \param index Index of the physical joystick to bind to
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void Initialize(unsigned int index);
|
void Initialize(unsigned int index);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Update the current joystick and return its new state
|
/// \brief Update the current joystick and return its new state
|
||||||
///
|
///
|
||||||
/// \return Current state of the joystick
|
/// \return Current state of the joystick
|
||||||
///
|
///
|
||||||
@ -58,7 +59,7 @@ public :
|
|||||||
JoystickState UpdateState();
|
JoystickState UpdateState();
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Get the number of axes supported by the joystick
|
/// \brief Get the number of axes supported by the joystick
|
||||||
///
|
///
|
||||||
/// \return Number of axis
|
/// \return Number of axis
|
||||||
///
|
///
|
||||||
@ -66,7 +67,7 @@ public :
|
|||||||
unsigned int GetAxesCount() const;
|
unsigned int GetAxesCount() const;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Get the number of buttons supported by the joystick
|
/// \brief Get the number of buttons supported by the joystick
|
||||||
///
|
///
|
||||||
/// \return Number of buttons
|
/// \return Number of buttons
|
||||||
///
|
///
|
||||||
|
@ -37,8 +37,6 @@ namespace sf
|
|||||||
namespace priv
|
namespace priv
|
||||||
{
|
{
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Get supported video modes
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
void VideoModeSupport::GetSupportedVideoModes(std::vector<VideoMode>& modes)
|
void VideoModeSupport::GetSupportedVideoModes(std::vector<VideoMode>& modes)
|
||||||
{
|
{
|
||||||
// First, clear array to fill
|
// First, clear array to fill
|
||||||
@ -111,8 +109,6 @@ void VideoModeSupport::GetSupportedVideoModes(std::vector<VideoMode>& modes)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// Get current desktop video mode
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
VideoMode VideoModeSupport::GetDesktopVideoMode()
|
VideoMode VideoModeSupport::GetDesktopVideoMode()
|
||||||
{
|
{
|
||||||
|
@ -37,23 +37,23 @@ namespace sf
|
|||||||
namespace priv
|
namespace priv
|
||||||
{
|
{
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Linux implementation of VideoModeSupport
|
/// \brief Linux (X11) implementation of VideoModeSupport;
|
||||||
/// Give access to video mode related OS-specific functions
|
/// gives access to video mode related OS-specific functions
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
class VideoModeSupport
|
class VideoModeSupport
|
||||||
{
|
{
|
||||||
public :
|
public :
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Get supported video modes
|
/// \brief Get the list of all the supported video modes
|
||||||
///
|
///
|
||||||
/// \param modes : Array to fill with available video modes
|
/// \param modes Array to fill with available video modes
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
static void GetSupportedVideoModes(std::vector<VideoMode>& modes);
|
static void GetSupportedVideoModes(std::vector<VideoMode>& modes);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Get current desktop video mode
|
/// \brief Get the current desktop video mode
|
||||||
///
|
///
|
||||||
/// \return Current desktop video mode
|
/// \return Current desktop video mode
|
||||||
///
|
///
|
||||||
|
@ -46,10 +46,8 @@ namespace
|
|||||||
PointerMotionMask | KeyPressMask | KeyReleaseMask | StructureNotifyMask |
|
PointerMotionMask | KeyPressMask | KeyReleaseMask | StructureNotifyMask |
|
||||||
EnterWindowMask | LeaveWindowMask;
|
EnterWindowMask | LeaveWindowMask;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// Filter the events received by windows
|
/// Filter the events received by windows
|
||||||
/// (only allow those matching a specific window)
|
/// (only allow those matching a specific window)
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
Bool CheckEvent(::Display*, XEvent* event, XPointer userData)
|
Bool CheckEvent(::Display*, XEvent* event, XPointer userData)
|
||||||
{
|
{
|
||||||
// Just check if the event matches the window
|
// Just check if the event matches the window
|
||||||
@ -63,8 +61,6 @@ namespace sf
|
|||||||
namespace priv
|
namespace priv
|
||||||
{
|
{
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Create the window implementation from an existing control
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
WindowImplX11::WindowImplX11(WindowHandle handle) :
|
WindowImplX11::WindowImplX11(WindowHandle handle) :
|
||||||
myWindow (0),
|
myWindow (0),
|
||||||
myInputMethod (NULL),
|
myInputMethod (NULL),
|
||||||
@ -103,8 +99,6 @@ myKeyRepeat (true)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// Create the window implementation
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
WindowImplX11::WindowImplX11(VideoMode mode, const std::string& title, unsigned long style) :
|
WindowImplX11::WindowImplX11(VideoMode mode, const std::string& title, unsigned long style) :
|
||||||
myWindow (0),
|
myWindow (0),
|
||||||
@ -245,8 +239,6 @@ myKeyRepeat (true)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// Destructor
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
WindowImplX11::~WindowImplX11()
|
WindowImplX11::~WindowImplX11()
|
||||||
{
|
{
|
||||||
@ -273,9 +265,6 @@ WindowImplX11::~WindowImplX11()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// Get the display used by the window.
|
|
||||||
/// This functions is meant to be used internally by ContextGLX.
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
::Display* WindowImplX11::GetDisplay() const
|
::Display* WindowImplX11::GetDisplay() const
|
||||||
{
|
{
|
||||||
@ -283,8 +272,6 @@ WindowImplX11::~WindowImplX11()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// /see WindowImpl::GetHandle
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
WindowHandle WindowImplX11::GetHandle() const
|
WindowHandle WindowImplX11::GetHandle() const
|
||||||
{
|
{
|
||||||
@ -292,8 +279,6 @@ WindowHandle WindowImplX11::GetHandle() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// /see WindowImpl::ProcessEvents
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void WindowImplX11::ProcessEvents()
|
void WindowImplX11::ProcessEvents()
|
||||||
{
|
{
|
||||||
@ -347,8 +332,6 @@ void WindowImplX11::ProcessEvents()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// /see WindowImpl::ShowMouseCursor
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void WindowImplX11::ShowMouseCursor(bool show)
|
void WindowImplX11::ShowMouseCursor(bool show)
|
||||||
{
|
{
|
||||||
@ -357,8 +340,6 @@ void WindowImplX11::ShowMouseCursor(bool show)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// /see sfWindowImpl::SetCursorPosition
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void WindowImplX11::SetCursorPosition(unsigned int left, unsigned int top)
|
void WindowImplX11::SetCursorPosition(unsigned int left, unsigned int top)
|
||||||
{
|
{
|
||||||
@ -367,8 +348,6 @@ void WindowImplX11::SetCursorPosition(unsigned int left, unsigned int top)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// /see sfWindowImpl::SetPosition
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void WindowImplX11::SetPosition(int left, int top)
|
void WindowImplX11::SetPosition(int left, int top)
|
||||||
{
|
{
|
||||||
@ -377,8 +356,6 @@ void WindowImplX11::SetPosition(int left, int top)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// /see WindowImpl::SetSize
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void WindowImplX11::SetSize(unsigned int width, unsigned int height)
|
void WindowImplX11::SetSize(unsigned int width, unsigned int height)
|
||||||
{
|
{
|
||||||
@ -387,8 +364,6 @@ void WindowImplX11::SetSize(unsigned int width, unsigned int height)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// /see sfWindowImpl::Show
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void WindowImplX11::Show(bool show)
|
void WindowImplX11::Show(bool show)
|
||||||
{
|
{
|
||||||
@ -401,8 +376,6 @@ void WindowImplX11::Show(bool show)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// /see sfWindowImpl::EnableKeyRepeat
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void WindowImplX11::EnableKeyRepeat(bool enabled)
|
void WindowImplX11::EnableKeyRepeat(bool enabled)
|
||||||
{
|
{
|
||||||
@ -410,8 +383,6 @@ void WindowImplX11::EnableKeyRepeat(bool enabled)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// /see WindowImpl::SetIcon
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void WindowImplX11::SetIcon(unsigned int width, unsigned int height, const Uint8* pixels)
|
void WindowImplX11::SetIcon(unsigned int width, unsigned int height, const Uint8* pixels)
|
||||||
{
|
{
|
||||||
@ -473,8 +444,6 @@ void WindowImplX11::SetIcon(unsigned int width, unsigned int height, const Uint8
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// Switch to fullscreen mode
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void WindowImplX11::SwitchToFullscreen(const VideoMode& mode)
|
void WindowImplX11::SwitchToFullscreen(const VideoMode& mode)
|
||||||
{
|
{
|
||||||
@ -527,8 +496,6 @@ void WindowImplX11::SwitchToFullscreen(const VideoMode& mode)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// Do some common initializations after the window has been created
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void WindowImplX11::Initialize()
|
void WindowImplX11::Initialize()
|
||||||
{
|
{
|
||||||
@ -568,8 +535,6 @@ void WindowImplX11::Initialize()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// Create a transparent mouse cursor
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void WindowImplX11::CreateHiddenCursor()
|
void WindowImplX11::CreateHiddenCursor()
|
||||||
{
|
{
|
||||||
@ -590,8 +555,6 @@ void WindowImplX11::CreateHiddenCursor()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// Cleanup graphical resources attached to the window
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void WindowImplX11::CleanUp()
|
void WindowImplX11::CleanUp()
|
||||||
{
|
{
|
||||||
@ -622,8 +585,6 @@ void WindowImplX11::CleanUp()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// Process an incoming event from the window
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void WindowImplX11::ProcessEvent(XEvent windowEvent)
|
void WindowImplX11::ProcessEvent(XEvent windowEvent)
|
||||||
{
|
{
|
||||||
@ -856,8 +817,6 @@ void WindowImplX11::ProcessEvent(XEvent windowEvent)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// Convert a X11 keysym to SFML key code
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
Key::Code WindowImplX11::KeysymToSF(KeySym symbol)
|
Key::Code WindowImplX11::KeysymToSF(KeySym symbol)
|
||||||
{
|
{
|
||||||
|
@ -40,38 +40,40 @@ namespace sf
|
|||||||
namespace priv
|
namespace priv
|
||||||
{
|
{
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// WindowImplX11 is the Linux (X11) implementation of WindowImpl
|
/// \brief Linux (X11) implementation of WindowImpl
|
||||||
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
class WindowImplX11 : public WindowImpl
|
class WindowImplX11 : public WindowImpl
|
||||||
{
|
{
|
||||||
public :
|
public :
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Construct the window implementation from an existing control
|
/// \brief Construct the window implementation from an existing control
|
||||||
///
|
///
|
||||||
/// \param handle : Platform-specific handle of the control
|
/// \param handle Platform-specific handle of the control
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
WindowImplX11(WindowHandle handle);
|
WindowImplX11(WindowHandle handle);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Create the window implementation
|
/// \brief Create the window implementation
|
||||||
///
|
///
|
||||||
/// \param mode : Video mode to use
|
/// \param mode Video mode to use
|
||||||
/// \param title : Title of the window
|
/// \param title Title of the window
|
||||||
/// \param style : Window style (resizable, fixed, or fullscren)
|
/// \param style Window style (resizable, fixed, or fullscren)
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
WindowImplX11(VideoMode mode, const std::string& title, unsigned long style);
|
WindowImplX11(VideoMode mode, const std::string& title, unsigned long style);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Destructor
|
/// \brief Destructor
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
~WindowImplX11();
|
~WindowImplX11();
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Get the display used by the window.
|
/// \brief Get the display used by the window
|
||||||
|
///
|
||||||
/// This functions is meant to be used internally by ContextGLX.
|
/// This functions is meant to be used internally by ContextGLX.
|
||||||
///
|
///
|
||||||
/// \return Pointer to the X display of the window
|
/// \return Pointer to the X display of the window
|
||||||
@ -82,97 +84,118 @@ public :
|
|||||||
private :
|
private :
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// /see WindowImpl::GetHandle
|
/// \brief Get the OS-specific handle of the window
|
||||||
|
///
|
||||||
|
/// \return Handle of the window
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
virtual WindowHandle GetHandle() const;
|
virtual WindowHandle GetHandle() const;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// /see WindowImpl::ProcessEvents
|
/// \brief Process incoming events from operating system
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
virtual void ProcessEvents();
|
virtual void ProcessEvents();
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// /see WindowImpl::ShowMouseCursor
|
/// \brief Show or hide the mouse cursor
|
||||||
|
///
|
||||||
|
/// \param show True to show, false to hide
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
virtual void ShowMouseCursor(bool show);
|
virtual void ShowMouseCursor(bool show);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// /see sfWindowImpl::SetCursorPosition
|
/// \brief Change the position of the mouse cursor
|
||||||
|
///
|
||||||
|
/// \param left Left coordinate of the cursor, relative to the window
|
||||||
|
/// \param top Top coordinate of the cursor, relative to the window
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
virtual void SetCursorPosition(unsigned int left, unsigned int top);
|
virtual void SetCursorPosition(unsigned int left, unsigned int top);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// /see sfWindowImpl::SetPosition
|
/// \brief Change the position of the window on screen
|
||||||
|
///
|
||||||
|
/// \param left Left position
|
||||||
|
/// \param top Top position
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
virtual void SetPosition(int left, int top);
|
virtual void SetPosition(int left, int top);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// /see WindowImpl::SetSize
|
/// \brief Change the size of the rendering region of the window
|
||||||
|
///
|
||||||
|
/// \param width New width
|
||||||
|
/// \param height New height
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
virtual void SetSize(unsigned int width, unsigned int height);
|
virtual void SetSize(unsigned int width, unsigned int height);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// /see sfWindowImpl::Show
|
/// \brief Show or hide the window
|
||||||
|
///
|
||||||
|
/// \param show True to show, false to hide
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
virtual void Show(bool show);
|
virtual void Show(bool show);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// /see sfWindowImpl::EnableKeyRepeat
|
/// \brief Enable or disable automatic key-repeat
|
||||||
|
///
|
||||||
|
/// \param enabled True to enable, false to disable
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
virtual void EnableKeyRepeat(bool enabled);
|
virtual void EnableKeyRepeat(bool enabled);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// /see WindowImpl::SetIcon
|
/// \brief Change the window's icon
|
||||||
|
///
|
||||||
|
/// \param width Icon's width, in pixels
|
||||||
|
/// \param height Icon's height, in pixels
|
||||||
|
/// \param pixels Pointer to the pixels in memory, format must be RGBA 32 bits
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
virtual void SetIcon(unsigned int width, unsigned int height, const Uint8* pixels);
|
virtual void SetIcon(unsigned int width, unsigned int height, const Uint8* pixels);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Switch to fullscreen mode
|
/// \brief Switch to fullscreen mode
|
||||||
///
|
///
|
||||||
/// \param Mode : video mode to switch to
|
/// \param Mode video mode to switch to
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void SwitchToFullscreen(const VideoMode& mode);
|
void SwitchToFullscreen(const VideoMode& mode);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Do some common initializations after the window has been created
|
/// \brief Do some common initializations after the window has been created
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void Initialize();
|
void Initialize();
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Create a transparent mouse cursor
|
/// \brief Create a transparent mouse cursor
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void CreateHiddenCursor();
|
void CreateHiddenCursor();
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Cleanup graphical resources attached to the window
|
/// \brief Cleanup graphical resources attached to the window
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void CleanUp();
|
void CleanUp();
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Process an incoming event from the window
|
/// \brief Process an incoming event from the window
|
||||||
///
|
///
|
||||||
/// \param windowEvent : Event which has been received
|
/// \param windowEvent Event which has been received
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void ProcessEvent(XEvent windowEvent);
|
void ProcessEvent(XEvent windowEvent);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Convert a X11 keysym to SFML key code
|
/// \brief Convert a X11 keysym to SFML key code
|
||||||
///
|
///
|
||||||
/// \param symbol : keysym to convert
|
/// \param symbol Key symbol to convert
|
||||||
///
|
///
|
||||||
/// \return Corrsponding SFML key code
|
/// \return Corrsponding SFML key code
|
||||||
///
|
///
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Internal data
|
/// Private data
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
@ -57,9 +57,7 @@ namespace
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
// Get and sort valid video modes
|
||||||
/// Get and sort valid video modes
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
static void InitializeModes()
|
static void InitializeModes()
|
||||||
{
|
{
|
||||||
// We request the array of valid modes
|
// We request the array of valid modes
|
||||||
@ -74,8 +72,6 @@ namespace
|
|||||||
namespace sf
|
namespace sf
|
||||||
{
|
{
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Default constructor
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
VideoMode::VideoMode() :
|
VideoMode::VideoMode() :
|
||||||
Width (0),
|
Width (0),
|
||||||
Height (0),
|
Height (0),
|
||||||
@ -85,8 +81,6 @@ BitsPerPixel(0)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// Construct the video mode with its attributes
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
VideoMode::VideoMode(unsigned int width, unsigned int height, unsigned int bitsPerPixel) :
|
VideoMode::VideoMode(unsigned int width, unsigned int height, unsigned int bitsPerPixel) :
|
||||||
Width (width),
|
Width (width),
|
||||||
@ -97,8 +91,6 @@ BitsPerPixel(bitsPerPixel)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// Get the current desktop video mode
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
VideoMode VideoMode::GetDesktopMode()
|
VideoMode VideoMode::GetDesktopMode()
|
||||||
{
|
{
|
||||||
@ -107,12 +99,10 @@ VideoMode VideoMode::GetDesktopMode()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// Get a valid video mode
|
|
||||||
/// Index must be in range [0, GetModesCount()[
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
VideoMode VideoMode::GetMode(std::size_t index)
|
VideoMode VideoMode::GetMode(std::size_t index)
|
||||||
{
|
{
|
||||||
|
// Build and cache the list of valid modes on first call
|
||||||
if (supportedModes.empty())
|
if (supportedModes.empty())
|
||||||
InitializeModes();
|
InitializeModes();
|
||||||
|
|
||||||
@ -123,11 +113,10 @@ VideoMode VideoMode::GetMode(std::size_t index)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// Get valid video modes count
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
std::size_t VideoMode::GetModesCount()
|
std::size_t VideoMode::GetModesCount()
|
||||||
{
|
{
|
||||||
|
// Build and cache the list of valid modes on first call
|
||||||
if (supportedModes.empty())
|
if (supportedModes.empty())
|
||||||
InitializeModes();
|
InitializeModes();
|
||||||
|
|
||||||
@ -135,11 +124,10 @@ std::size_t VideoMode::GetModesCount()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// Tell whether or not the video mode is supported
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
bool VideoMode::IsValid() const
|
bool VideoMode::IsValid() const
|
||||||
{
|
{
|
||||||
|
// Build and cache the list of valid modes on first call
|
||||||
if (supportedModes.empty())
|
if (supportedModes.empty())
|
||||||
InitializeModes();
|
InitializeModes();
|
||||||
|
|
||||||
@ -148,22 +136,18 @@ bool VideoMode::IsValid() const
|
|||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Comparison operator overload -- tell if two video modes are equal
|
bool operator ==(const VideoMode& left, const VideoMode& right)
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
bool VideoMode::operator ==(const VideoMode& other) const
|
|
||||||
{
|
{
|
||||||
return (Width == other.Width) &&
|
return (left.Width == right.Width) &&
|
||||||
(Height == other.Height) &&
|
(left.Height == right.Height) &&
|
||||||
(BitsPerPixel == other.BitsPerPixel);
|
(left.BitsPerPixel == right.BitsPerPixel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Comparison operator overload -- tell if two video modes are different
|
bool operator !=(const VideoMode& left, const VideoMode& right)
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
bool VideoMode::operator !=(const VideoMode& other) const
|
|
||||||
{
|
{
|
||||||
return !(*this == other);
|
return !(left == right);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace sf
|
} // namespace sf
|
||||||
|
@ -37,8 +37,6 @@ namespace sf
|
|||||||
namespace priv
|
namespace priv
|
||||||
{
|
{
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Create a new context, not associated to a window
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
ContextWGL::ContextWGL(ContextWGL* shared) :
|
ContextWGL::ContextWGL(ContextWGL* shared) :
|
||||||
myWindow (NULL),
|
myWindow (NULL),
|
||||||
myDC (NULL),
|
myDC (NULL),
|
||||||
@ -57,13 +55,10 @@ myOwnsWindow(true)
|
|||||||
CreateContext(shared, VideoMode::GetDesktopMode().BitsPerPixel, ContextSettings(0, 0, 0));
|
CreateContext(shared, VideoMode::GetDesktopMode().BitsPerPixel, ContextSettings(0, 0, 0));
|
||||||
|
|
||||||
// Activate the context
|
// Activate the context
|
||||||
//if (shared)
|
|
||||||
SetActive(true);
|
SetActive(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// Create a new context attached to a window
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
ContextWGL::ContextWGL(ContextWGL* shared, const WindowImpl* owner, unsigned int bitsPerPixel, const ContextSettings& settings) :
|
ContextWGL::ContextWGL(ContextWGL* shared, const WindowImpl* owner, unsigned int bitsPerPixel, const ContextSettings& settings) :
|
||||||
myWindow (NULL),
|
myWindow (NULL),
|
||||||
@ -80,13 +75,10 @@ myOwnsWindow(false)
|
|||||||
CreateContext(shared, bitsPerPixel, settings);
|
CreateContext(shared, bitsPerPixel, settings);
|
||||||
|
|
||||||
// Activate the context
|
// Activate the context
|
||||||
//if (shared)
|
|
||||||
SetActive(true);
|
SetActive(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// Destructor
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
ContextWGL::~ContextWGL()
|
ContextWGL::~ContextWGL()
|
||||||
{
|
{
|
||||||
@ -108,8 +100,6 @@ ContextWGL::~ContextWGL()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \see Context::MakeCurrent
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
bool ContextWGL::MakeCurrent(bool active)
|
bool ContextWGL::MakeCurrent(bool active)
|
||||||
{
|
{
|
||||||
@ -137,8 +127,6 @@ bool ContextWGL::MakeCurrent(bool active)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \see Context::Display
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void ContextWGL::Display()
|
void ContextWGL::Display()
|
||||||
{
|
{
|
||||||
@ -147,8 +135,6 @@ void ContextWGL::Display()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \see Context::UseVerticalSync
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void ContextWGL::UseVerticalSync(bool enabled)
|
void ContextWGL::UseVerticalSync(bool enabled)
|
||||||
{
|
{
|
||||||
@ -158,8 +144,6 @@ void ContextWGL::UseVerticalSync(bool enabled)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// Check if a context is active on the current thread
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
bool ContextWGL::IsContextActive()
|
bool ContextWGL::IsContextActive()
|
||||||
{
|
{
|
||||||
@ -167,8 +151,6 @@ bool ContextWGL::IsContextActive()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// Create the context
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void ContextWGL::CreateContext(ContextWGL* shared, unsigned int bitsPerPixel, const ContextSettings& settings)
|
void ContextWGL::CreateContext(ContextWGL* shared, unsigned int bitsPerPixel, const ContextSettings& settings)
|
||||||
{
|
{
|
||||||
|
@ -37,57 +37,70 @@ namespace sf
|
|||||||
namespace priv
|
namespace priv
|
||||||
{
|
{
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Windows (WGL) implementation of OpenGL contexts
|
/// \brief Windows (WGL) implementation of OpenGL contexts
|
||||||
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
class ContextWGL : public ContextGL
|
class ContextWGL : public ContextGL
|
||||||
{
|
{
|
||||||
public :
|
public :
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Create a new context, not associated to a window
|
/// \brief Create a new context, not associated to a window
|
||||||
///
|
///
|
||||||
/// \param shared : Context to share the new one with (can be NULL)
|
/// \param shared Context to share the new one with (can be NULL)
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
ContextWGL(ContextWGL* shared);
|
ContextWGL(ContextWGL* shared);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Create a new context attached to a window
|
/// \brief Create a new context attached to a window
|
||||||
///
|
///
|
||||||
/// \param shared : Context to share the new one with (can be NULL)
|
/// \param shared Context to share the new one with (can be NULL)
|
||||||
/// \param owner : Pointer to the owner window
|
/// \param owner Pointer to the owner window
|
||||||
/// \param bitsPerPixel : Pixel depth (in bits per pixel)
|
/// \param bitsPerPixel Pixel depth (in bits per pixel)
|
||||||
/// \param settings : Creation parameters
|
/// \param settings Creation parameters
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
ContextWGL(ContextWGL* shared, const WindowImpl* owner, unsigned int bitsPerPixel, const ContextSettings& settings);
|
ContextWGL(ContextWGL* shared, const WindowImpl* owner, unsigned int bitsPerPixel, const ContextSettings& settings);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Destructor
|
/// \brief Destructor
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
~ContextWGL();
|
~ContextWGL();
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \see Context::MakeCurrent
|
/// \brief Activate or deactivate the context as the current target
|
||||||
|
/// for rendering
|
||||||
|
///
|
||||||
|
/// \param active True to activate, false to deactivate
|
||||||
|
///
|
||||||
|
/// \return True on success, false if any error happened
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
virtual bool MakeCurrent(bool active);
|
virtual bool MakeCurrent(bool active);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \see Context::Display
|
/// \brief Display what has been rendered to the context so far
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
virtual void Display();
|
virtual void Display();
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \see Context::UseVerticalSync
|
/// \brief Enable or disable vertical synchronization
|
||||||
|
///
|
||||||
|
/// Activating vertical synchronization will limit the number
|
||||||
|
/// of frames displayed to the refresh rate of the monitor.
|
||||||
|
/// This can avoid some visual artifacts, and limit the framerate
|
||||||
|
/// to a good value (but not constant across different computers).
|
||||||
|
///
|
||||||
|
/// \param enabled : True to enable v-sync, false to deactivate
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
virtual void UseVerticalSync(bool enabled);
|
virtual void UseVerticalSync(bool enabled);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Check if a context is active on the current thread
|
/// \brief Check if a context is active on the current thread
|
||||||
///
|
///
|
||||||
/// \return True if there's an active context, false otherwise
|
/// \return True if there's an active context, false otherwise
|
||||||
///
|
///
|
||||||
@ -97,11 +110,11 @@ public :
|
|||||||
private :
|
private :
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Create the context
|
/// \brief Create the context
|
||||||
///
|
///
|
||||||
/// \param shared : Context to share the new one with (can be NULL)
|
/// \param shared Context to share the new one with (can be NULL)
|
||||||
/// \param bitsPerPixel : Pixel depth, in bits per pixel
|
/// \param bitsPerPixel Pixel depth, in bits per pixel
|
||||||
/// \param settings : Creation parameters
|
/// \param settings Creation parameters
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void CreateContext(ContextWGL* shared, unsigned int bitsPerPixel, const ContextSettings& settings);
|
void CreateContext(ContextWGL* shared, unsigned int bitsPerPixel, const ContextSettings& settings);
|
||||||
|
@ -37,8 +37,6 @@ namespace sf
|
|||||||
namespace priv
|
namespace priv
|
||||||
{
|
{
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Initialize the instance and bind it to a physical joystick
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
void Joystick::Initialize(unsigned int index)
|
void Joystick::Initialize(unsigned int index)
|
||||||
{
|
{
|
||||||
// Reset state
|
// Reset state
|
||||||
@ -79,8 +77,6 @@ void Joystick::Initialize(unsigned int index)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// Update the current joystick and return its new state
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
JoystickState Joystick::UpdateState()
|
JoystickState Joystick::UpdateState()
|
||||||
{
|
{
|
||||||
@ -120,8 +116,6 @@ JoystickState Joystick::UpdateState()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// Get the number of axes supported by the joystick
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
unsigned int Joystick::GetAxesCount() const
|
unsigned int Joystick::GetAxesCount() const
|
||||||
{
|
{
|
||||||
@ -129,8 +123,6 @@ unsigned int Joystick::GetAxesCount() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// Get the number of buttons supported by the joystick
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
unsigned int Joystick::GetButtonsCount() const
|
unsigned int Joystick::GetButtonsCount() const
|
||||||
{
|
{
|
||||||
|
@ -35,22 +35,23 @@ namespace sf
|
|||||||
namespace priv
|
namespace priv
|
||||||
{
|
{
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Win32 implementation of Joystick
|
/// \brief Windows implementation of Joystick
|
||||||
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
class Joystick
|
class Joystick
|
||||||
{
|
{
|
||||||
public :
|
public :
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Initialize the instance and bind it to a physical joystick
|
/// \brief Initialize the instance and bind it to a physical joystick
|
||||||
///
|
///
|
||||||
/// \param index : Index of the physical joystick to bind to
|
/// \param index Index of the physical joystick to bind to
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void Initialize(unsigned int index);
|
void Initialize(unsigned int index);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Update the current joystick and return its new state
|
/// \brief Update the current joystick and return its new state
|
||||||
///
|
///
|
||||||
/// \return Current state of the joystick
|
/// \return Current state of the joystick
|
||||||
///
|
///
|
||||||
@ -58,7 +59,7 @@ public :
|
|||||||
JoystickState UpdateState();
|
JoystickState UpdateState();
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Get the number of axes supported by the joystick
|
/// \brief Get the number of axes supported by the joystick
|
||||||
///
|
///
|
||||||
/// \return Number of axis
|
/// \return Number of axis
|
||||||
///
|
///
|
||||||
@ -66,7 +67,7 @@ public :
|
|||||||
unsigned int GetAxesCount() const;
|
unsigned int GetAxesCount() const;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Get the number of buttons supported by the joystick
|
/// \brief Get the number of buttons supported by the joystick
|
||||||
///
|
///
|
||||||
/// \return Number of buttons
|
/// \return Number of buttons
|
||||||
///
|
///
|
||||||
|
@ -35,19 +35,17 @@ namespace sf
|
|||||||
namespace priv
|
namespace priv
|
||||||
{
|
{
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Get supported video modes
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
void VideoModeSupport::GetSupportedVideoModes(std::vector<VideoMode>& modes)
|
void VideoModeSupport::GetSupportedVideoModes(std::vector<VideoMode>& modes)
|
||||||
{
|
{
|
||||||
// First, clear array to fill
|
// First, clear array to fill
|
||||||
modes.clear();
|
modes.clear();
|
||||||
|
|
||||||
// Enumerate all available video modes for primary display adapter
|
// Enumerate all available video modes for the primary display adapter
|
||||||
DEVMODE win32Mode;
|
DEVMODE win32Mode;
|
||||||
win32Mode.dmSize = sizeof(win32Mode);
|
win32Mode.dmSize = sizeof(win32Mode);
|
||||||
for (int count = 0; EnumDisplaySettings(NULL, count, &win32Mode); ++count)
|
for (int count = 0; EnumDisplaySettings(NULL, count, &win32Mode); ++count)
|
||||||
{
|
{
|
||||||
// Convert to sfVideoMode
|
// Convert to sf::VideoMode
|
||||||
VideoMode mode(win32Mode.dmPelsWidth, win32Mode.dmPelsHeight, win32Mode.dmBitsPerPel);
|
VideoMode mode(win32Mode.dmPelsWidth, win32Mode.dmPelsHeight, win32Mode.dmBitsPerPel);
|
||||||
|
|
||||||
// Add it only if it is not already in the array
|
// Add it only if it is not already in the array
|
||||||
@ -57,8 +55,6 @@ void VideoModeSupport::GetSupportedVideoModes(std::vector<VideoMode>& modes)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// Get current desktop video mode
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
VideoMode VideoModeSupport::GetDesktopVideoMode()
|
VideoMode VideoModeSupport::GetDesktopVideoMode()
|
||||||
{
|
{
|
||||||
|
@ -37,23 +37,24 @@ namespace sf
|
|||||||
namespace priv
|
namespace priv
|
||||||
{
|
{
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Win32 implementation of VideoModeSupport
|
/// \brief Windows implementation of VideoModeSupport;
|
||||||
/// Give access to video mode related OS-specific functions
|
/// gives access to video mode related OS-specific functions
|
||||||
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
class VideoModeSupport
|
class VideoModeSupport
|
||||||
{
|
{
|
||||||
public :
|
public :
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Get supported video modes
|
/// \brief Get the list of all the supported video modes
|
||||||
///
|
///
|
||||||
/// \param Modes : Array to fill with available video modes
|
/// \param modes Array to fill with available video modes
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
static void GetSupportedVideoModes(std::vector<VideoMode>& modes);
|
static void GetSupportedVideoModes(std::vector<VideoMode>& modes);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Get current desktop video mode
|
/// \brief Get the current desktop video mode
|
||||||
///
|
///
|
||||||
/// \return Current desktop video mode
|
/// \return Current desktop video mode
|
||||||
///
|
///
|
||||||
|
@ -44,22 +44,22 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
// Private data
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
unsigned int WindowCount = 0;
|
||||||
|
const char* ClassNameA = "SFML_Window";
|
||||||
|
const wchar_t* ClassNameW = L"SFML_Window";
|
||||||
|
sf::priv::WindowImplWin32* FullscreenWindow = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
namespace sf
|
namespace sf
|
||||||
{
|
{
|
||||||
namespace priv
|
namespace priv
|
||||||
{
|
{
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
// Static member data
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
unsigned int WindowImplWin32::ourWindowCount = 0;
|
|
||||||
const char* WindowImplWin32::ourClassNameA = "SFML_Window";
|
|
||||||
const wchar_t* WindowImplWin32::ourClassNameW = L"SFML_Window";
|
|
||||||
WindowImplWin32* WindowImplWin32::ourFullscreenWindow = NULL;
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// Create the window implementation from an existing control
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
WindowImplWin32::WindowImplWin32(WindowHandle handle) :
|
WindowImplWin32::WindowImplWin32(WindowHandle handle) :
|
||||||
myHandle (NULL),
|
myHandle (NULL),
|
||||||
myCallback (0),
|
myCallback (0),
|
||||||
@ -86,8 +86,6 @@ myIsCursorIn (false)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// Create the window implementation
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
WindowImplWin32::WindowImplWin32(VideoMode mode, const std::string& title, unsigned long style) :
|
WindowImplWin32::WindowImplWin32(VideoMode mode, const std::string& title, unsigned long style) :
|
||||||
myHandle (NULL),
|
myHandle (NULL),
|
||||||
@ -98,7 +96,7 @@ myKeyRepeatEnabled(true),
|
|||||||
myIsCursorIn (false)
|
myIsCursorIn (false)
|
||||||
{
|
{
|
||||||
// Register the window class at first call
|
// Register the window class at first call
|
||||||
if (ourWindowCount == 0)
|
if (WindowCount == 0)
|
||||||
RegisterWindowClass();
|
RegisterWindowClass();
|
||||||
|
|
||||||
// Compute position and size
|
// Compute position and size
|
||||||
@ -136,11 +134,11 @@ myIsCursorIn (false)
|
|||||||
wchar_t wTitle[256];
|
wchar_t wTitle[256];
|
||||||
int count = MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, title.c_str(), static_cast<int>(title.size()), wTitle, sizeof(wTitle) / sizeof(*wTitle));
|
int count = MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, title.c_str(), static_cast<int>(title.size()), wTitle, sizeof(wTitle) / sizeof(*wTitle));
|
||||||
wTitle[count] = L'\0';
|
wTitle[count] = L'\0';
|
||||||
myHandle = CreateWindowW(ourClassNameW, wTitle, win32Style, left, top, width, height, NULL, NULL, GetModuleHandle(NULL), this);
|
myHandle = CreateWindowW(ClassNameW, wTitle, win32Style, left, top, width, height, NULL, NULL, GetModuleHandle(NULL), this);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
myHandle = CreateWindowA(ourClassNameA, title.c_str(), win32Style, left, top, width, height, NULL, NULL, GetModuleHandle(NULL), this);
|
myHandle = CreateWindowA(ClassNameA, title.c_str(), win32Style, left, top, width, height, NULL, NULL, GetModuleHandle(NULL), this);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Switch to fullscreen if requested
|
// Switch to fullscreen if requested
|
||||||
@ -148,7 +146,7 @@ myIsCursorIn (false)
|
|||||||
SwitchToFullscreen(mode);
|
SwitchToFullscreen(mode);
|
||||||
|
|
||||||
// Increment window count
|
// Increment window count
|
||||||
ourWindowCount++;
|
WindowCount++;
|
||||||
|
|
||||||
// Get the actual size of the window, which can be smaller even after the call to AdjustWindowRect
|
// Get the actual size of the window, which can be smaller even after the call to AdjustWindowRect
|
||||||
// This happens when the window is bigger than the desktop
|
// This happens when the window is bigger than the desktop
|
||||||
@ -159,8 +157,6 @@ myIsCursorIn (false)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// Destructor
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
WindowImplWin32::~WindowImplWin32()
|
WindowImplWin32::~WindowImplWin32()
|
||||||
{
|
{
|
||||||
@ -175,18 +171,18 @@ WindowImplWin32::~WindowImplWin32()
|
|||||||
DestroyWindow(myHandle);
|
DestroyWindow(myHandle);
|
||||||
|
|
||||||
// Decrement the window count
|
// Decrement the window count
|
||||||
ourWindowCount--;
|
WindowCount--;
|
||||||
|
|
||||||
// Unregister window class if we were the last window
|
// Unregister window class if we were the last window
|
||||||
if (ourWindowCount == 0)
|
if (WindowCount == 0)
|
||||||
{
|
{
|
||||||
if (HasUnicodeSupport())
|
if (HasUnicodeSupport())
|
||||||
{
|
{
|
||||||
UnregisterClassW(ourClassNameW, GetModuleHandle(NULL));
|
UnregisterClassW(ClassNameW, GetModuleHandle(NULL));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
UnregisterClassA(ourClassNameA, GetModuleHandle(NULL));
|
UnregisterClassA(ClassNameA, GetModuleHandle(NULL));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -198,8 +194,6 @@ WindowImplWin32::~WindowImplWin32()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// /see WindowImpl::GetHandle
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
WindowHandle WindowImplWin32::GetHandle() const
|
WindowHandle WindowImplWin32::GetHandle() const
|
||||||
{
|
{
|
||||||
@ -207,8 +201,6 @@ WindowHandle WindowImplWin32::GetHandle() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// /see WindowImpl::ProcessEvents
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void WindowImplWin32::ProcessEvents()
|
void WindowImplWin32::ProcessEvents()
|
||||||
{
|
{
|
||||||
@ -225,8 +217,6 @@ void WindowImplWin32::ProcessEvents()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// /see WindowImpl::ShowMouseCursor
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void WindowImplWin32::ShowMouseCursor(bool show)
|
void WindowImplWin32::ShowMouseCursor(bool show)
|
||||||
{
|
{
|
||||||
@ -239,8 +229,6 @@ void WindowImplWin32::ShowMouseCursor(bool show)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// /see WindowImpl::SetCursorPosition
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void WindowImplWin32::SetCursorPosition(unsigned int left, unsigned int top)
|
void WindowImplWin32::SetCursorPosition(unsigned int left, unsigned int top)
|
||||||
{
|
{
|
||||||
@ -250,8 +238,6 @@ void WindowImplWin32::SetCursorPosition(unsigned int left, unsigned int top)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// /see WindowImpl::SetPosition
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void WindowImplWin32::SetPosition(int left, int top)
|
void WindowImplWin32::SetPosition(int left, int top)
|
||||||
{
|
{
|
||||||
@ -259,8 +245,6 @@ void WindowImplWin32::SetPosition(int left, int top)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// /see WindowImpl::SetSize
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void WindowImplWin32::SetSize(unsigned int width, unsigned int height)
|
void WindowImplWin32::SetSize(unsigned int width, unsigned int height)
|
||||||
{
|
{
|
||||||
@ -275,8 +259,6 @@ void WindowImplWin32::SetSize(unsigned int width, unsigned int height)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// /see WindowImpl::Show
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void WindowImplWin32::Show(bool show)
|
void WindowImplWin32::Show(bool show)
|
||||||
{
|
{
|
||||||
@ -284,8 +266,6 @@ void WindowImplWin32::Show(bool show)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// /see WindowImpl::EnableKeyRepeat
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void WindowImplWin32::EnableKeyRepeat(bool enabled)
|
void WindowImplWin32::EnableKeyRepeat(bool enabled)
|
||||||
{
|
{
|
||||||
@ -293,8 +273,6 @@ void WindowImplWin32::EnableKeyRepeat(bool enabled)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// /see WindowImpl::SetIcon
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void WindowImplWin32::SetIcon(unsigned int width, unsigned int height, const Uint8* pixels)
|
void WindowImplWin32::SetIcon(unsigned int width, unsigned int height, const Uint8* pixels)
|
||||||
{
|
{
|
||||||
@ -328,8 +306,6 @@ void WindowImplWin32::SetIcon(unsigned int width, unsigned int height, const Uin
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// Register the window class
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void WindowImplWin32::RegisterWindowClass()
|
void WindowImplWin32::RegisterWindowClass()
|
||||||
{
|
{
|
||||||
@ -345,7 +321,7 @@ void WindowImplWin32::RegisterWindowClass()
|
|||||||
WindowClass.hCursor = 0;
|
WindowClass.hCursor = 0;
|
||||||
WindowClass.hbrBackground = 0;
|
WindowClass.hbrBackground = 0;
|
||||||
WindowClass.lpszMenuName = NULL;
|
WindowClass.lpszMenuName = NULL;
|
||||||
WindowClass.lpszClassName = ourClassNameW;
|
WindowClass.lpszClassName = ClassNameW;
|
||||||
RegisterClassW(&WindowClass);
|
RegisterClassW(&WindowClass);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -360,14 +336,12 @@ void WindowImplWin32::RegisterWindowClass()
|
|||||||
WindowClass.hCursor = 0;
|
WindowClass.hCursor = 0;
|
||||||
WindowClass.hbrBackground = 0;
|
WindowClass.hbrBackground = 0;
|
||||||
WindowClass.lpszMenuName = NULL;
|
WindowClass.lpszMenuName = NULL;
|
||||||
WindowClass.lpszClassName = ourClassNameA;
|
WindowClass.lpszClassName = ClassNameA;
|
||||||
RegisterClassA(&WindowClass);
|
RegisterClassA(&WindowClass);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// Switch to fullscreen mode
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void WindowImplWin32::SwitchToFullscreen(const VideoMode& mode)
|
void WindowImplWin32::SwitchToFullscreen(const VideoMode& mode)
|
||||||
{
|
{
|
||||||
@ -394,7 +368,7 @@ void WindowImplWin32::SwitchToFullscreen(const VideoMode& mode)
|
|||||||
ShowWindow(myHandle, SW_SHOW);
|
ShowWindow(myHandle, SW_SHOW);
|
||||||
|
|
||||||
// Set "this" as the current fullscreen window
|
// Set "this" as the current fullscreen window
|
||||||
ourFullscreenWindow = this;
|
FullscreenWindow = this;
|
||||||
|
|
||||||
// SetPixelFormat can fail (really ?) if window style doesn't contain these flags
|
// SetPixelFormat can fail (really ?) if window style doesn't contain these flags
|
||||||
long style = GetWindowLong(myHandle, GWL_STYLE);
|
long style = GetWindowLong(myHandle, GWL_STYLE);
|
||||||
@ -402,16 +376,14 @@ void WindowImplWin32::SwitchToFullscreen(const VideoMode& mode)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// Free all the graphical resources attached to the window
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void WindowImplWin32::Cleanup()
|
void WindowImplWin32::Cleanup()
|
||||||
{
|
{
|
||||||
// Restore the previous video mode (in case we were running in fullscreen)
|
// Restore the previous video mode (in case we were running in fullscreen)
|
||||||
if (ourFullscreenWindow == this)
|
if (FullscreenWindow == this)
|
||||||
{
|
{
|
||||||
ChangeDisplaySettings(NULL, 0);
|
ChangeDisplaySettings(NULL, 0);
|
||||||
ourFullscreenWindow = NULL;
|
FullscreenWindow = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Unhide the mouse cursor (in case it was hidden)
|
// Unhide the mouse cursor (in case it was hidden)
|
||||||
@ -419,8 +391,6 @@ void WindowImplWin32::Cleanup()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// Process a Win32 event
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void WindowImplWin32::ProcessEvent(UINT message, WPARAM wParam, LPARAM lParam)
|
void WindowImplWin32::ProcessEvent(UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
@ -703,9 +673,6 @@ void WindowImplWin32::ProcessEvent(UINT message, WPARAM wParam, LPARAM lParam)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// Check the state of the shift keys on a key event,
|
|
||||||
/// and return the corresponding SF key code
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
Key::Code WindowImplWin32::GetShiftState(bool keyDown)
|
Key::Code WindowImplWin32::GetShiftState(bool keyDown)
|
||||||
{
|
{
|
||||||
@ -734,8 +701,6 @@ Key::Code WindowImplWin32::GetShiftState(bool keyDown)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// Convert a Win32 virtual key code to a SFML key code
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
Key::Code WindowImplWin32::VirtualKeyCodeToSF(WPARAM key, LPARAM flags)
|
Key::Code WindowImplWin32::VirtualKeyCodeToSF(WPARAM key, LPARAM flags)
|
||||||
{
|
{
|
||||||
@ -845,10 +810,6 @@ Key::Code WindowImplWin32::VirtualKeyCodeToSF(WPARAM key, LPARAM flags)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// Check if the current version of the OS supports unicode
|
|
||||||
/// messages and functions ; Windows 95/98/Me may not support
|
|
||||||
/// it, whereas Windows NT/2000/XP/Vista will
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
bool WindowImplWin32::HasUnicodeSupport()
|
bool WindowImplWin32::HasUnicodeSupport()
|
||||||
{
|
{
|
||||||
@ -867,8 +828,6 @@ bool WindowImplWin32::HasUnicodeSupport()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// Function called whenever one of our windows receives a message
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
LRESULT CALLBACK WindowImplWin32::GlobalOnEvent(HWND handle, UINT message, WPARAM wParam, LPARAM lParam)
|
LRESULT CALLBACK WindowImplWin32::GlobalOnEvent(HWND handle, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
|
@ -39,32 +39,33 @@ namespace sf
|
|||||||
namespace priv
|
namespace priv
|
||||||
{
|
{
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// WindowImplWin32 is the Win32 implementation of WindowImpl
|
/// \brief Windows implementation of WindowImpl
|
||||||
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
class WindowImplWin32 : public WindowImpl
|
class WindowImplWin32 : public WindowImpl
|
||||||
{
|
{
|
||||||
public :
|
public :
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Construct the window implementation from an existing control
|
/// \brief Construct the window implementation from an existing control
|
||||||
///
|
///
|
||||||
/// \param handle : Platform-specific handle of the control
|
/// \param handle Platform-specific handle of the control
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
WindowImplWin32(WindowHandle handle);
|
WindowImplWin32(WindowHandle handle);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Create the window implementation
|
/// \brief Create the window implementation
|
||||||
///
|
///
|
||||||
/// \param mode : Video mode to use
|
/// \param mode Video mode to use
|
||||||
/// \param title : Title of the window
|
/// \param title Title of the window
|
||||||
/// \param style : Window style
|
/// \param style Window style
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
WindowImplWin32(VideoMode mode, const std::string& title, unsigned long style);
|
WindowImplWin32(VideoMode mode, const std::string& title, unsigned long style);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Destructor
|
/// \brief Destructor
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
~WindowImplWin32();
|
~WindowImplWin32();
|
||||||
@ -72,55 +73,76 @@ public :
|
|||||||
private :
|
private :
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// /see WindowImpl::GetHandle
|
/// \brief Get the OS-specific handle of the window
|
||||||
|
///
|
||||||
|
/// \return Handle of the window
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
virtual WindowHandle GetHandle() const;
|
virtual WindowHandle GetHandle() const;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// /see WindowImpl::ProcessEvents
|
/// \brief Process incoming events from operating system
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
virtual void ProcessEvents();
|
virtual void ProcessEvents();
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// /see WindowImpl::ShowMouseCursor
|
/// \brief Show or hide the mouse cursor
|
||||||
|
///
|
||||||
|
/// \param show True to show, false to hide
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
virtual void ShowMouseCursor(bool show);
|
virtual void ShowMouseCursor(bool show);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// /see WindowImpl::SetCursorPosition
|
/// \brief Change the position of the mouse cursor
|
||||||
|
///
|
||||||
|
/// \param left Left coordinate of the cursor, relative to the window
|
||||||
|
/// \param top Top coordinate of the cursor, relative to the window
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
virtual void SetCursorPosition(unsigned int left, unsigned int top);
|
virtual void SetCursorPosition(unsigned int left, unsigned int top);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// /see WindowImpl::SetPosition
|
/// \brief Change the position of the window on screen
|
||||||
|
///
|
||||||
|
/// \param left Left position
|
||||||
|
/// \param top Top position
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
virtual void SetPosition(int left, int top);
|
virtual void SetPosition(int left, int top);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// /see WindowImpl::SetSize
|
/// \brief Change the size of the rendering region of the window
|
||||||
|
///
|
||||||
|
/// \param width New width
|
||||||
|
/// \param height New height
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
virtual void SetSize(unsigned int width, unsigned int height);
|
virtual void SetSize(unsigned int width, unsigned int height);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// /see WindowImpl::Show
|
/// \brief Show or hide the window
|
||||||
|
///
|
||||||
|
/// \param show True to show, false to hide
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
virtual void Show(bool show);
|
virtual void Show(bool show);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// /see WindowImpl::EnableKeyRepeat
|
/// \brief Enable or disable automatic key-repeat
|
||||||
|
///
|
||||||
|
/// \param enabled True to enable, false to disable
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
virtual void EnableKeyRepeat(bool enabled);
|
virtual void EnableKeyRepeat(bool enabled);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// /see WindowImpl::SetIcon
|
/// \brief Change the window's icon
|
||||||
|
///
|
||||||
|
/// \param width Icon's width, in pixels
|
||||||
|
/// \param height Icon's height, in pixels
|
||||||
|
/// \param pixels Pointer to the pixels in memory, format must be RGBA 32 bits
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
virtual void SetIcon(unsigned int width, unsigned int height, const Uint8* pixels);
|
virtual void SetIcon(unsigned int width, unsigned int height, const Uint8* pixels);
|
||||||
@ -132,34 +154,34 @@ private :
|
|||||||
void RegisterWindowClass();
|
void RegisterWindowClass();
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Switch to fullscreen mode
|
/// \brief Switch to fullscreen mode
|
||||||
///
|
///
|
||||||
/// \param mode : video mode to switch to
|
/// \param mode Video mode to switch to
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void SwitchToFullscreen(const VideoMode& mode);
|
void SwitchToFullscreen(const VideoMode& mode);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Free all the graphical resources attached to the window
|
/// \brief Free all the graphical resources attached to the window
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void Cleanup();
|
void Cleanup();
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Process a Win32 event
|
/// \brief Process a Win32 event
|
||||||
///
|
///
|
||||||
/// \param message : Message to process
|
/// \param message Message to process
|
||||||
/// \param wParam : First parameter of the event
|
/// \param wParam First parameter of the event
|
||||||
/// \param lParam : Second parameter of the event
|
/// \param lParam Second parameter of the event
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void ProcessEvent(UINT message, WPARAM wParam, LPARAM lParam);
|
void ProcessEvent(UINT message, WPARAM wParam, LPARAM lParam);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Check the state of the shift keys on a key event,
|
/// \brief Check the state of the shift keys on a key event,
|
||||||
/// and return the corresponding SF key code
|
/// and return the corresponding SFML key code
|
||||||
///
|
///
|
||||||
/// \param keyDown : True for a keydown event, false for a keyup event
|
/// \param keyDown True for a keydown event, false for a keyup event
|
||||||
///
|
///
|
||||||
/// \return SFML key code corresponding to the shift key
|
/// \return SFML key code corresponding to the shift key
|
||||||
///
|
///
|
||||||
@ -167,10 +189,10 @@ private :
|
|||||||
static Key::Code GetShiftState(bool keyDown);
|
static Key::Code GetShiftState(bool keyDown);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Convert a Win32 virtual key code to a SFML key code
|
/// \brief Convert a Win32 virtual key code to a SFML key code
|
||||||
///
|
///
|
||||||
/// \param key : Virtual key code to convert
|
/// \param key Virtual key code to convert
|
||||||
/// \param flags : Additional flags
|
/// \param flags Additional flags
|
||||||
///
|
///
|
||||||
/// \return SFML key code corresponding to the key
|
/// \return SFML key code corresponding to the key
|
||||||
///
|
///
|
||||||
@ -178,9 +200,10 @@ private :
|
|||||||
static Key::Code VirtualKeyCodeToSF(WPARAM key, LPARAM flags);
|
static Key::Code VirtualKeyCodeToSF(WPARAM key, LPARAM flags);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Check if the current version of the OS supports unicode
|
/// \brief Check if the current version of the OS supports
|
||||||
/// messages and functions ; Windows 95/98/Me may not support
|
/// unicode messages and functions ; Windows 95/98/Me
|
||||||
/// it, whereas Windows NT/2000/XP/Vista will
|
/// may not support it, whereas Windows NT/2000/XP/Vista
|
||||||
|
/// will
|
||||||
///
|
///
|
||||||
/// \return True if the OS supports unicode
|
/// \return True if the OS supports unicode
|
||||||
///
|
///
|
||||||
@ -188,26 +211,18 @@ private :
|
|||||||
static bool HasUnicodeSupport();
|
static bool HasUnicodeSupport();
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Function called whenever one of our windows receives a message
|
/// \brief Function called whenever one of our windows receives a message
|
||||||
///
|
///
|
||||||
/// \param handle : Win32 handle of the window
|
/// \param handle Win32 handle of the window
|
||||||
/// \param message : Message received
|
/// \param message Message received
|
||||||
/// \param wParam : First parameter of the message
|
/// \param wParam First parameter of the message
|
||||||
/// \param lParam : Second parameter of the message
|
/// \param lParam Second parameter of the message
|
||||||
///
|
///
|
||||||
/// \return Something...
|
/// \return True to discard the event after it has been processed
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
static LRESULT CALLBACK GlobalOnEvent(HWND handle, UINT message, WPARAM wParam, LPARAM lParam);
|
static LRESULT CALLBACK GlobalOnEvent(HWND handle, UINT message, WPARAM wParam, LPARAM lParam);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
// Static member data
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
static unsigned int ourWindowCount; ///< Number of windows that we own
|
|
||||||
static const char* ourClassNameA; ///< Win32 window class name (ANSI version)
|
|
||||||
static const wchar_t* ourClassNameW; ///< Win32 window class name (unicode version)
|
|
||||||
static WindowImplWin32* ourFullscreenWindow; ///< Window currently in fullscreen
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
// Member data
|
// Member data
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
|
@ -54,16 +54,12 @@ namespace sf
|
|||||||
namespace priv
|
namespace priv
|
||||||
{
|
{
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Create a new window depending on the current OS
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
WindowImpl* WindowImpl::New(VideoMode mode, const std::string& title, unsigned long style)
|
WindowImpl* WindowImpl::New(VideoMode mode, const std::string& title, unsigned long style)
|
||||||
{
|
{
|
||||||
return new WindowImplType(mode, title, style);
|
return new WindowImplType(mode, title, style);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// Create a new window depending on the current OS
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
WindowImpl* WindowImpl::New(WindowHandle handle)
|
WindowImpl* WindowImpl::New(WindowHandle handle)
|
||||||
{
|
{
|
||||||
@ -71,8 +67,6 @@ WindowImpl* WindowImpl::New(WindowHandle handle)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// Default constructor
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
WindowImpl::WindowImpl() :
|
WindowImpl::WindowImpl() :
|
||||||
myWidth (0),
|
myWidth (0),
|
||||||
@ -88,8 +82,6 @@ myJoyThreshold(0.1f)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// Destructor
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
WindowImpl::~WindowImpl()
|
WindowImpl::~WindowImpl()
|
||||||
{
|
{
|
||||||
@ -97,8 +89,6 @@ WindowImpl::~WindowImpl()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// Add a listener to the window
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void WindowImpl::AddListener(WindowListener* listener)
|
void WindowImpl::AddListener(WindowListener* listener)
|
||||||
{
|
{
|
||||||
@ -107,8 +97,6 @@ void WindowImpl::AddListener(WindowListener* listener)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// Remove a listener from the window
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void WindowImpl::RemoveListener(WindowListener* listener)
|
void WindowImpl::RemoveListener(WindowListener* listener)
|
||||||
{
|
{
|
||||||
@ -116,8 +104,6 @@ void WindowImpl::RemoveListener(WindowListener* listener)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// Get the client width of the window
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
unsigned int WindowImpl::GetWidth() const
|
unsigned int WindowImpl::GetWidth() const
|
||||||
{
|
{
|
||||||
@ -125,8 +111,6 @@ unsigned int WindowImpl::GetWidth() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// Get the client height of the window
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
unsigned int WindowImpl::GetHeight() const
|
unsigned int WindowImpl::GetHeight() const
|
||||||
{
|
{
|
||||||
@ -134,9 +118,6 @@ unsigned int WindowImpl::GetHeight() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// Change the joystick threshold, ie. the value below which
|
|
||||||
/// no move event will be generated
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void WindowImpl::SetJoystickThreshold(float threshold)
|
void WindowImpl::SetJoystickThreshold(float threshold)
|
||||||
{
|
{
|
||||||
@ -144,8 +125,6 @@ void WindowImpl::SetJoystickThreshold(float threshold)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// Process incoming events from operating system
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void WindowImpl::DoEvents()
|
void WindowImpl::DoEvents()
|
||||||
{
|
{
|
||||||
@ -157,8 +136,6 @@ void WindowImpl::DoEvents()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// Send an event to listeners
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void WindowImpl::SendEvent(const Event& event)
|
void WindowImpl::SendEvent(const Event& event)
|
||||||
{
|
{
|
||||||
@ -169,8 +146,6 @@ void WindowImpl::SendEvent(const Event& event)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// Read the joysticks state and generate the appropriate events
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void WindowImpl::ProcessJoystickEvents()
|
void WindowImpl::ProcessJoystickEvents()
|
||||||
{
|
{
|
||||||
|
@ -45,30 +45,31 @@ class WindowListener;
|
|||||||
namespace priv
|
namespace priv
|
||||||
{
|
{
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Abstract base class for OS-specific window implementation
|
/// \brief Abstract base class for OS-specific window implementation
|
||||||
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
class WindowImpl : NonCopyable
|
class WindowImpl : NonCopyable
|
||||||
{
|
{
|
||||||
public :
|
public :
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Create a new window depending on the current OS
|
/// \brief Create a new window depending on the current OS
|
||||||
///
|
///
|
||||||
/// \param mode : Video mode to use
|
/// \param mode Video mode to use
|
||||||
/// \param title : Title of the window
|
/// \param title Title of the window
|
||||||
/// \param style : Window style
|
/// \param style Window style
|
||||||
///
|
///
|
||||||
/// \return Pointer to the created window
|
/// \return Pointer to the created window (don't forget to delete it)
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
static WindowImpl* New(VideoMode mode, const std::string& title, unsigned long style);
|
static WindowImpl* New(VideoMode mode, const std::string& title, unsigned long style);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Create a new window depending on to the current OS
|
/// \brief Create a new window depending on to the current OS
|
||||||
///
|
///
|
||||||
/// \param handle : Platform-specific handle of the control
|
/// \param handle Platform-specific handle of the control
|
||||||
///
|
///
|
||||||
/// \return Pointer to the created window
|
/// \return Pointer to the created window (don't forget to delete it)
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
static WindowImpl* New(WindowHandle handle);
|
static WindowImpl* New(WindowHandle handle);
|
||||||
@ -76,29 +77,29 @@ public :
|
|||||||
public :
|
public :
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Destructor
|
/// \brief Destructor
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
virtual ~WindowImpl();
|
virtual ~WindowImpl();
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Add a listener to the window
|
/// \brief Add a listener to the window
|
||||||
///
|
///
|
||||||
/// \param listener : Listener to add
|
/// \param listener Listener to add
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void AddListener(WindowListener* listener);
|
void AddListener(WindowListener* listener);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Remove a listener from the window
|
/// \brief Remove a listener from the window
|
||||||
///
|
///
|
||||||
/// \param listener : Listener to remove
|
/// \param listener Listener to remove
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void RemoveListener(WindowListener* listener);
|
void RemoveListener(WindowListener* listener);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Get the client width of the window
|
/// \brief Get the client width of the window
|
||||||
///
|
///
|
||||||
/// \return Width of the window in pixels
|
/// \return Width of the window in pixels
|
||||||
///
|
///
|
||||||
@ -106,7 +107,7 @@ public :
|
|||||||
unsigned int GetWidth() const;
|
unsigned int GetWidth() const;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Get the client height of the window
|
/// \brief Get the client height of the window
|
||||||
///
|
///
|
||||||
/// \return Height of the window in pixels
|
/// \return Height of the window in pixels
|
||||||
///
|
///
|
||||||
@ -114,7 +115,7 @@ public :
|
|||||||
unsigned int GetHeight() const;
|
unsigned int GetHeight() const;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Change the joystick threshold, ie. the value below which
|
/// \brief Change the joystick threshold, ie. the value below which
|
||||||
/// no move event will be generated
|
/// no move event will be generated
|
||||||
///
|
///
|
||||||
/// \param threshold : New threshold, in range [0, 100]
|
/// \param threshold : New threshold, in range [0, 100]
|
||||||
@ -123,13 +124,13 @@ public :
|
|||||||
void SetJoystickThreshold(float threshold);
|
void SetJoystickThreshold(float threshold);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Process incoming events from operating system
|
/// \brief Process incoming events from operating system
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void DoEvents();
|
void DoEvents();
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Get the OS-specific handle of the window
|
/// \brief Get the OS-specific handle of the window
|
||||||
///
|
///
|
||||||
/// \return Handle of the window
|
/// \return Handle of the window
|
||||||
///
|
///
|
||||||
@ -137,62 +138,62 @@ public :
|
|||||||
virtual WindowHandle GetHandle() const = 0;
|
virtual WindowHandle GetHandle() const = 0;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Show or hide the mouse cursor
|
/// \brief Show or hide the mouse cursor
|
||||||
///
|
///
|
||||||
/// \param show : True to show, false to hide
|
/// \param show True to show, false to hide
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
virtual void ShowMouseCursor(bool show) = 0;
|
virtual void ShowMouseCursor(bool show) = 0;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Change the position of the mouse cursor
|
/// \brief Change the position of the mouse cursor
|
||||||
///
|
///
|
||||||
/// \param left : Left coordinate of the cursor, relative to the window
|
/// \param left Left coordinate of the cursor, relative to the window
|
||||||
/// \param top : Top coordinate of the cursor, relative to the window
|
/// \param top Top coordinate of the cursor, relative to the window
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
virtual void SetCursorPosition(unsigned int left, unsigned int top) = 0;
|
virtual void SetCursorPosition(unsigned int left, unsigned int top) = 0;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Change the position of the window on screen
|
/// \brief Change the position of the window on screen
|
||||||
///
|
///
|
||||||
/// \param left : Left position
|
/// \param left Left position
|
||||||
/// \param top : Top position
|
/// \param top Top position
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
virtual void SetPosition(int left, int top) = 0;
|
virtual void SetPosition(int left, int top) = 0;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Change the size of the rendering region of the window
|
/// \brief Change the size of the rendering region of the window
|
||||||
///
|
///
|
||||||
/// \param width : New width
|
/// \param width New width
|
||||||
/// \param height : New height
|
/// \param height New height
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
virtual void SetSize(unsigned int width, unsigned int height) = 0;
|
virtual void SetSize(unsigned int width, unsigned int height) = 0;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Show or hide the window
|
/// \brief Show or hide the window
|
||||||
///
|
///
|
||||||
/// \param show : True to show, false to hide
|
/// \param show True to show, false to hide
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
virtual void Show(bool show) = 0;
|
virtual void Show(bool show) = 0;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Enable or disable automatic key-repeat
|
/// \brief Enable or disable automatic key-repeat
|
||||||
///
|
///
|
||||||
/// \param enabled : True to enable, false to disable
|
/// \param enabled True to enable, false to disable
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
virtual void EnableKeyRepeat(bool enabled) = 0;
|
virtual void EnableKeyRepeat(bool enabled) = 0;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Change the window's icon
|
/// \brief Change the window's icon
|
||||||
///
|
///
|
||||||
/// \param width : Icon's width, in pixels
|
/// \param width Icon's width, in pixels
|
||||||
/// \param height : Icon's height, in pixels
|
/// \param height Icon's height, in pixels
|
||||||
/// \param pixels : Pointer to the pixels in memory, format must be RGBA 32 bits
|
/// \param pixels Pointer to the pixels in memory, format must be RGBA 32 bits
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
virtual void SetIcon(unsigned int width, unsigned int height, const Uint8* pixels) = 0;
|
virtual void SetIcon(unsigned int width, unsigned int height, const Uint8* pixels) = 0;
|
||||||
@ -200,15 +201,15 @@ public :
|
|||||||
protected :
|
protected :
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Default constructor
|
/// \brief Default constructor
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
WindowImpl();
|
WindowImpl();
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Send an event to listeners (for derived classes only)
|
/// \brief Send an event to listeners (for derived classes only)
|
||||||
///
|
///
|
||||||
/// \param event : Event to send
|
/// \param event Event to send
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void SendEvent(const Event& event);
|
void SendEvent(const Event& event);
|
||||||
@ -222,13 +223,13 @@ protected :
|
|||||||
private :
|
private :
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Read the joysticks state and generate the appropriate events
|
/// \brief Read the joysticks state and generate the appropriate events
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void ProcessJoystickEvents();
|
void ProcessJoystickEvents();
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Process incoming events from operating system
|
/// \brief Process incoming events from operating system
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
virtual void ProcessEvents() = 0;
|
virtual void ProcessEvents() = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user