Added the trunk/branches/tags directories at repository root, and moved previous root into trunk/
git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/trunk@1002 4e206d99-4929-0410-ac5d-dfc041789085
This commit is contained in:
commit
2f524481c1
974 changed files with 295448 additions and 0 deletions
68
CSFML/include/SFML/Window/Context.h
Normal file
68
CSFML/include/SFML/Window/Context.h
Normal file
|
@ -0,0 +1,68 @@
|
|||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com)
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied warranty.
|
||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
//
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it freely,
|
||||
// subject to the following restrictions:
|
||||
//
|
||||
// 1. The origin of this software must not be misrepresented;
|
||||
// you must not claim that you wrote the original software.
|
||||
// If you use this software in a product, an acknowledgment
|
||||
// in the product documentation would be appreciated but is not required.
|
||||
//
|
||||
// 2. Altered source versions must be plainly marked as such,
|
||||
// and must not be misrepresented as being the original software.
|
||||
//
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_CONTEXT_H
|
||||
#define SFML_CONTEXT_H
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Config.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Class wrapping an OpenGL context with no window.
|
||||
/// This class is for internal use mainly, it is required
|
||||
/// to solve tricky problems involving multi-threading
|
||||
////////////////////////////////////////////////////////////
|
||||
typedef struct sfContext sfContext;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Construct a new context
|
||||
///
|
||||
/// \return New context
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfContext* sfContext_Create();
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Destroy an existing context
|
||||
///
|
||||
/// \param Context : Context to destroy
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfContext_Destroy(sfContext* Context);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Activate or deactivate a context
|
||||
///
|
||||
/// \param Context : Context to activate or deactivate
|
||||
/// \param Active : sfTrue to activate, sfFalse to deactivate
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfContext_SetActive(sfContext* Context, sfBool Active);
|
||||
|
||||
|
||||
#endif // SFML_CONTEXT_H
|
300
CSFML/include/SFML/Window/Event.h
Normal file
300
CSFML/include/SFML/Window/Event.h
Normal file
|
@ -0,0 +1,300 @@
|
|||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2008-2008 Laurent Gomila (laurent.gom@gmail.com)
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied warranty.
|
||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
//
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it freely,
|
||||
// subject to the following restrictions:
|
||||
//
|
||||
// 1. The origin of this software must not be misrepresented;
|
||||
// you must not claim that you wrote the original software.
|
||||
// If you use this software in a product, an acknowledgment
|
||||
// in the product documentation would be appreciated but is not required.
|
||||
//
|
||||
// 2. Altered source versions must be plainly marked as such,
|
||||
// and must not be misrepresented as being the original software.
|
||||
//
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_EVENT_H
|
||||
#define SFML_EVENT_H
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Config.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Definition of key codes for keyboard events
|
||||
////////////////////////////////////////////////////////////
|
||||
typedef enum
|
||||
{
|
||||
sfKeyA = 'a',
|
||||
sfKeyB = 'b',
|
||||
sfKeyC = 'c',
|
||||
sfKeyD = 'd',
|
||||
sfKeyE = 'e',
|
||||
sfKeyF = 'f',
|
||||
sfKeyG = 'g',
|
||||
sfKeyH = 'h',
|
||||
sfKeyI = 'i',
|
||||
sfKeyJ = 'j',
|
||||
sfKeyK = 'k',
|
||||
sfKeyL = 'l',
|
||||
sfKeyM = 'm',
|
||||
sfKeyN = 'n',
|
||||
sfKeyO = 'o',
|
||||
sfKeyP = 'p',
|
||||
sfKeyQ = 'q',
|
||||
sfKeyR = 'r',
|
||||
sfKeyS = 's',
|
||||
sfKeyT = 't',
|
||||
sfKeyU = 'u',
|
||||
sfKeyV = 'v',
|
||||
sfKeyW = 'w',
|
||||
sfKeyX = 'x',
|
||||
sfKeyY = 'y',
|
||||
sfKeyZ = 'z',
|
||||
sfKeyNum0 = '0',
|
||||
sfKeyNum1 = '1',
|
||||
sfKeyNum2 = '2',
|
||||
sfKeyNum3 = '3',
|
||||
sfKeyNum4 = '4',
|
||||
sfKeyNum5 = '5',
|
||||
sfKeyNum6 = '6',
|
||||
sfKeyNum7 = '7',
|
||||
sfKeyNum8 = '8',
|
||||
sfKeyNum9 = '9',
|
||||
sfKeyEscape = 256,
|
||||
sfKeyLControl,
|
||||
sfKeyLShift,
|
||||
sfKeyLAlt,
|
||||
sfKeyLSystem, ///< OS specific key (left side) : windows (Win and Linux), apple (MacOS), ...
|
||||
sfKeyRControl,
|
||||
sfKeyRShift,
|
||||
sfKeyRAlt,
|
||||
sfKeyRSystem, ///< OS specific key (right side) : windows (Win and Linux), apple (MacOS), ...
|
||||
sfKeyMenu,
|
||||
sfKeyLBracket, ///< [
|
||||
sfKeyRBracket, ///< ]
|
||||
sfKeySemiColon, ///< ;
|
||||
sfKeyComma, ///< ,
|
||||
sfKeyPeriod, ///< .
|
||||
sfKeyQuote, ///< '
|
||||
sfKeySlash, ///< /
|
||||
sfKeyBackSlash,
|
||||
sfKeyTilde, ///< ~
|
||||
sfKeyEqual, ///< =
|
||||
sfKeyDash, ///< -
|
||||
sfKeySpace,
|
||||
sfKeyReturn,
|
||||
sfKeyBack,
|
||||
sfKeyTab,
|
||||
sfKeyPageUp,
|
||||
sfKeyPageDown,
|
||||
sfKeyEnd,
|
||||
sfKeyHome,
|
||||
sfKeyInsert,
|
||||
sfKeyDelete,
|
||||
sfKeyAdd, ///< +
|
||||
sfKeySubtract, ///< -
|
||||
sfKeyMultiply, ///< *
|
||||
sfKeyDivide, ///< /
|
||||
sfKeyLeft, ///< Left arrow
|
||||
sfKeyRight, ///< Right arrow
|
||||
sfKeyUp, ///< Up arrow
|
||||
sfKeyDown, ///< Down arrow
|
||||
sfKeyNumpad0,
|
||||
sfKeyNumpad1,
|
||||
sfKeyNumpad2,
|
||||
sfKeyNumpad3,
|
||||
sfKeyNumpad4,
|
||||
sfKeyNumpad5,
|
||||
sfKeyNumpad6,
|
||||
sfKeyNumpad7,
|
||||
sfKeyNumpad8,
|
||||
sfKeyNumpad9,
|
||||
sfKeyF1,
|
||||
sfKeyF2,
|
||||
sfKeyF3,
|
||||
sfKeyF4,
|
||||
sfKeyF5,
|
||||
sfKeyF6,
|
||||
sfKeyF7,
|
||||
sfKeyF8,
|
||||
sfKeyF9,
|
||||
sfKeyF10,
|
||||
sfKeyF11,
|
||||
sfKeyF12,
|
||||
sfKeyF13,
|
||||
sfKeyF14,
|
||||
sfKeyF15,
|
||||
sfKeyPause,
|
||||
|
||||
sfKeyCount // For internal use
|
||||
} sfKeyCode;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Definition of button codes for mouse events
|
||||
////////////////////////////////////////////////////////////
|
||||
typedef enum
|
||||
{
|
||||
sfButtonLeft,
|
||||
sfButtonRight,
|
||||
sfButtonMiddle,
|
||||
sfButtonX1,
|
||||
sfButtonX2
|
||||
} sfMouseButton;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Definition of joystick axis for joystick events
|
||||
////////////////////////////////////////////////////////////
|
||||
typedef enum
|
||||
{
|
||||
sfJoyAxisX,
|
||||
sfJoyAxisY,
|
||||
sfJoyAxisZ,
|
||||
sfJoyAxisR,
|
||||
sfJoyAxisU,
|
||||
sfJoyAxisV,
|
||||
sfJoyAxisPOV
|
||||
} sfJoyAxis;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Definition of all the event types
|
||||
////////////////////////////////////////////////////////////
|
||||
typedef enum
|
||||
{
|
||||
sfEvtClosed,
|
||||
sfEvtResized,
|
||||
sfEvtLostFocus,
|
||||
sfEvtGainedFocus,
|
||||
sfEvtTextEntered,
|
||||
sfEvtKeyPressed,
|
||||
sfEvtKeyReleased,
|
||||
sfEvtMouseWheelMoved,
|
||||
sfEvtMouseButtonPressed,
|
||||
sfEvtMouseButtonReleased,
|
||||
sfEvtMouseMoved,
|
||||
sfEvtMouseEntered,
|
||||
sfEvtMouseLeft,
|
||||
sfEvtJoyButtonPressed,
|
||||
sfEvtJoyButtonReleased,
|
||||
sfEvtJoyMoved
|
||||
} sfEventType;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Keyboard event parameters
|
||||
////////////////////////////////////////////////////////////
|
||||
struct sfKeyEvent
|
||||
{
|
||||
sfEventType Type;
|
||||
sfKeyCode Code;
|
||||
sfBool Alt;
|
||||
sfBool Control;
|
||||
sfBool Shift;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Text event parameters
|
||||
////////////////////////////////////////////////////////////
|
||||
struct sfTextEvent
|
||||
{
|
||||
sfEventType Type;
|
||||
sfUint32 Unicode;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Mouse move event parameters
|
||||
////////////////////////////////////////////////////////////
|
||||
struct sfMouseMoveEvent
|
||||
{
|
||||
sfEventType Type;
|
||||
int X;
|
||||
int Y;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Mouse buttons events parameters
|
||||
////////////////////////////////////////////////////////////
|
||||
struct sfMouseButtonEvent
|
||||
{
|
||||
sfEventType Type;
|
||||
sfMouseButton Button;
|
||||
int X;
|
||||
int Y;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Mouse wheel events parameters
|
||||
////////////////////////////////////////////////////////////
|
||||
struct sfMouseWheelEvent
|
||||
{
|
||||
sfEventType Type;
|
||||
int Delta;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Joystick axis move event parameters
|
||||
////////////////////////////////////////////////////////////
|
||||
struct sfJoyMoveEvent
|
||||
{
|
||||
sfEventType Type;
|
||||
unsigned int JoystickId;
|
||||
sfJoyAxis Axis;
|
||||
float Position;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Joystick buttons events parameters
|
||||
////////////////////////////////////////////////////////////
|
||||
struct sfJoyButtonEvent
|
||||
{
|
||||
sfEventType Type;
|
||||
unsigned int JoystickId;
|
||||
unsigned int Button;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Size events parameters
|
||||
////////////////////////////////////////////////////////////
|
||||
struct sfSizeEvent
|
||||
{
|
||||
sfEventType Type;
|
||||
unsigned int Width;
|
||||
unsigned int Height;
|
||||
};
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// sfEvent defines a system event and its parameters
|
||||
////////////////////////////////////////////////////////////
|
||||
typedef union
|
||||
{
|
||||
////////////////////////////////////////////////////////////
|
||||
// Member data
|
||||
////////////////////////////////////////////////////////////
|
||||
sfEventType Type; ///< Type of the event
|
||||
struct sfKeyEvent Key;
|
||||
struct sfTextEvent Text;
|
||||
struct sfMouseMoveEvent MouseMove;
|
||||
struct sfMouseButtonEvent MouseButton;
|
||||
struct sfMouseWheelEvent MouseWheel;
|
||||
struct sfJoyMoveEvent JoyMove;
|
||||
struct sfJoyButtonEvent JoyButton;
|
||||
struct sfSizeEvent Size;
|
||||
} sfEvent;
|
||||
|
||||
|
||||
#endif // SFML_EVENT_H
|
110
CSFML/include/SFML/Window/Input.h
Normal file
110
CSFML/include/SFML/Window/Input.h
Normal file
|
@ -0,0 +1,110 @@
|
|||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2008-2008 Laurent Gomila (laurent.gom@gmail.com)
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied warranty.
|
||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
//
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it freely,
|
||||
// subject to the following restrictions:
|
||||
//
|
||||
// 1. The origin of this software must not be misrepresented;
|
||||
// you must not claim that you wrote the original software.
|
||||
// If you use this software in a product, an acknowledgment
|
||||
// in the product documentation would be appreciated but is not required.
|
||||
//
|
||||
// 2. Altered source versions must be plainly marked as such,
|
||||
// and must not be misrepresented as being the original software.
|
||||
//
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_INPUT_H
|
||||
#define SFML_INPUT_H
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Config.h>
|
||||
#include <SFML/Window/Event.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// sfInput handles real-time input from keyboard and mouse.
|
||||
/// Use it instead of events to handle continuous moves and more
|
||||
/// game-friendly inputs
|
||||
////////////////////////////////////////////////////////////
|
||||
typedef struct sfInput sfInput;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the state of a key
|
||||
///
|
||||
/// \param Input : Input object
|
||||
/// \param KeyCode : Key to check
|
||||
///
|
||||
/// \return sfTrue if key is down, sfFalse if key is up
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfBool sfInput_IsKeyDown(sfInput* Input, sfKeyCode KeyCode);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the state of a mouse button
|
||||
///
|
||||
/// \param Input : Input object
|
||||
/// \param Button : Button to check
|
||||
///
|
||||
/// \return sfTrue if button is down, sfFalse if button is up
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfBool sfInput_IsMouseButtonDown(sfInput* Input, sfMouseButton Button);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the state of a joystick button
|
||||
///
|
||||
/// \param Input : Input object
|
||||
/// \param JoyId : Identifier of the joystick to check (0 or 1)
|
||||
/// \param Button : Button to check
|
||||
///
|
||||
/// \return sfTrue if button is down, sfFalse if button is up
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfBool sfInput_IsJoystickButtonDown(sfInput* Input, unsigned int JoyId, unsigned int Button);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the mouse X position
|
||||
///
|
||||
/// \param Input : Input object
|
||||
///
|
||||
/// \return Current mouse left position, relative to owner window
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API int sfInput_GetMouseX(sfInput* Input);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the mouse Y position
|
||||
///
|
||||
/// \param Input : Input object
|
||||
///
|
||||
/// \return Current mouse top position, relative to owner window
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API int sfInput_GetMouseY(sfInput* Input);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the joystick position on a given axis
|
||||
///
|
||||
/// \param Input : Input object
|
||||
/// \param JoyId : Identifier of the joystick to check (0 or 1)
|
||||
/// \param Axis : Identifier of the axis to read
|
||||
///
|
||||
/// \return Current joystick position, in the range [-100, 100]
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API float sfInput_GetJoystickAxis(sfInput* Input, unsigned int JoyId, sfJoyAxis Axis);
|
||||
|
||||
|
||||
#endif // SFML_INPUT_H
|
87
CSFML/include/SFML/Window/VideoMode.h
Normal file
87
CSFML/include/SFML/Window/VideoMode.h
Normal file
|
@ -0,0 +1,87 @@
|
|||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2008-2008 Laurent Gomila (laurent.gom@gmail.com)
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied warranty.
|
||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
//
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it freely,
|
||||
// subject to the following restrictions:
|
||||
//
|
||||
// 1. The origin of this software must not be misrepresented;
|
||||
// you must not claim that you wrote the original software.
|
||||
// If you use this software in a product, an acknowledgment
|
||||
// in the product documentation would be appreciated but is not required.
|
||||
//
|
||||
// 2. Altered source versions must be plainly marked as such,
|
||||
// and must not be misrepresented as being the original software.
|
||||
//
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_VIDEOMODE_H
|
||||
#define SFML_VIDEOMODE_H
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Config.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// sfVideoMode defines a video mode (width, height, bpp, frequency)
|
||||
/// and provides functions for getting modes supported
|
||||
/// by the display device
|
||||
////////////////////////////////////////////////////////////
|
||||
typedef struct
|
||||
{
|
||||
unsigned int Width; ///< Video mode width, in pixels
|
||||
unsigned int Height; ///< Video mode height, in pixels
|
||||
unsigned int BitsPerPixel; ///< Video mode pixel depth, in bits per pixels
|
||||
} sfVideoMode;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the current desktop video mode
|
||||
///
|
||||
/// \return Current desktop video mode
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfVideoMode sfVideoMode_GetDesktopMode();
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// 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
|
||||
///
|
||||
/// \return Corresponding video mode (invalid mode if index is out of range)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfVideoMode sfVideoMode_GetMode(size_t Index);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get valid video modes count
|
||||
///
|
||||
/// \return Number of valid video modes available
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API size_t sfVideoMode_GetModesCount();
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Tell whether or not a video mode is supported
|
||||
///
|
||||
/// \param Mode : Video mode to check
|
||||
///
|
||||
///
|
||||
/// \return True if video mode is supported, false otherwise
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfBool sfVideoMode_IsValid(sfVideoMode Mode);
|
||||
|
||||
|
||||
#endif // SFML_VIDEOMODE_H
|
294
CSFML/include/SFML/Window/Window.h
Normal file
294
CSFML/include/SFML/Window/Window.h
Normal file
|
@ -0,0 +1,294 @@
|
|||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2008-2008 Laurent Gomila (laurent.gom@gmail.com)
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied warranty.
|
||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
//
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it freely,
|
||||
// subject to the following restrictions:
|
||||
//
|
||||
// 1. The origin of this software must not be misrepresented;
|
||||
// you must not claim that you wrote the original software.
|
||||
// If you use this software in a product, an acknowledgment
|
||||
// in the product documentation would be appreciated but is not required.
|
||||
//
|
||||
// 2. Altered source versions must be plainly marked as such,
|
||||
// and must not be misrepresented as being the original software.
|
||||
//
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_WINDOW_H
|
||||
#define SFML_WINDOW_H
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Config.h>
|
||||
#include <SFML/Window/Event.h>
|
||||
#include <SFML/Window/Input.h>
|
||||
#include <SFML/Window/VideoMode.h>
|
||||
#include <SFML/Window/WindowHandle.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// sfWindow is a rendering window ; it can create a new window
|
||||
/// or connect to an existing one
|
||||
////////////////////////////////////////////////////////////
|
||||
typedef struct sfWindow sfWindow;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Enumeration of window creation styles
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
enum
|
||||
{
|
||||
sfNone = 0, ///< No border / title bar (this flag and all others are mutually exclusive)
|
||||
sfTitlebar = 1 << 0, ///< Title bar + fixed border
|
||||
sfResize = 1 << 1, ///< Titlebar + resizable border + maximize button
|
||||
sfClose = 1 << 2, ///< Titlebar + close button
|
||||
sfFullscreen = 1 << 3 ///< Fullscreen mode (this flag and all others are mutually exclusive)
|
||||
};
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Structure defining the window's creation settings
|
||||
////////////////////////////////////////////////////////////
|
||||
typedef struct
|
||||
{
|
||||
unsigned int DepthBits; ///< Bits of the depth buffer
|
||||
unsigned int StencilBits; ///< Bits of the stencil buffer
|
||||
unsigned int AntialiasingLevel; ///< Level of antialiasing
|
||||
} sfWindowSettings;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Construct a new window
|
||||
///
|
||||
/// \param Mode : Video mode to use
|
||||
/// \param Title : Title of the window
|
||||
/// \param Style : Window style
|
||||
/// \param Params : Creation settings
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfWindow* sfWindow_Create(sfVideoMode Mode, const char* Title, unsigned long Style, sfWindowSettings Params);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Construct a window from an existing control
|
||||
///
|
||||
/// \param Handle : Platform-specific handle of the control
|
||||
/// \param Params : Creation settings
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfWindow* sfWindow_CreateFromHandle(sfWindowHandle Handle, sfWindowSettings Params);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Destroy an existing window
|
||||
///
|
||||
/// \param Window : Window to destroy
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfWindow_Destroy(sfWindow* Window);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Close a window (but doesn't destroy the internal data)
|
||||
///
|
||||
/// \param Window : Window to close
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfWindow_Close(sfWindow* Window);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Tell whether or not a window is opened
|
||||
///
|
||||
/// \param Window : Window object
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfBool sfWindow_IsOpened(sfWindow* Window);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the width of the rendering region of a window
|
||||
///
|
||||
/// \param Window : Window object
|
||||
///
|
||||
/// \return Width in pixels
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API unsigned int sfWindow_GetWidth(sfWindow* Window);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the height of the rendering region of a window
|
||||
///
|
||||
/// \param Window : Window object
|
||||
///
|
||||
/// \return Height in pixels
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API unsigned int sfWindow_GetHeight(sfWindow* Window);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the creation settings of a window
|
||||
///
|
||||
/// \param Window : Window object
|
||||
///
|
||||
/// \return Settings used to create the window
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfWindowSettings sfWindow_GetSettings(sfWindow* Window);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the event on top of events stack of a window, if any, and pop it
|
||||
///
|
||||
/// \param Window : Window object
|
||||
/// \param Event : Event to fill, if any
|
||||
///
|
||||
/// \return sfTrue if an event was returned, sfFalse if events stack was empty
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfBool sfWindow_GetEvent(sfWindow* Window, sfEvent* Event);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Enable / disable vertical synchronization on a window
|
||||
///
|
||||
/// \param Window : Window object
|
||||
/// \param Enabled : sfTrue to enable v-sync, sfFalse to deactivate
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfWindow_UseVerticalSync(sfWindow* Window, sfBool Enabled);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Show or hide the mouse cursor on a window
|
||||
///
|
||||
/// \param Window : Window object
|
||||
/// \param Show : sfTrue to show, sfFalse to hide
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfWindow_ShowMouseCursor(sfWindow* Window, sfBool Show);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Change the position of the mouse cursor on a window
|
||||
///
|
||||
/// \param Window : Window object
|
||||
/// \param Left : Left coordinate of the cursor, relative to the window
|
||||
/// \param Top : Top coordinate of the cursor, relative to the window
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfWindow_SetCursorPosition(sfWindow* Window, unsigned int Left, unsigned int Top);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Change the position of a window on screen.
|
||||
/// Only works for top-level windows
|
||||
///
|
||||
/// \param Window : Window object
|
||||
/// \param Left : Left position
|
||||
/// \param Top : Top position
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfWindow_SetPosition(sfWindow* Window, int Left, int Top);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Change the size of the rendering region of a window
|
||||
///
|
||||
/// \param Window : Window object
|
||||
/// \param Width : New Width
|
||||
/// \param Height : New Height
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfWindow_SetSize(sfWindow* Window, unsigned int Width, unsigned int Height);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Show or hide a window
|
||||
///
|
||||
/// \param Window : Window object
|
||||
/// \param State : sfTrue to show, sfFalse to hide
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfWindow_Show(sfWindow* Window, sfBool State);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Enable or disable automatic key-repeat for keydown events.
|
||||
/// Automatic key-repeat is enabled by default
|
||||
///
|
||||
/// \param Window : Window object
|
||||
/// \param Enabled : sfTrue to enable, sfFalse to disable
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfWindow_EnableKeyRepeat(sfWindow* Window, sfBool Enabled);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Change the window's icon
|
||||
///
|
||||
/// \param Window : Window object
|
||||
/// \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
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfWindow_SetIcon(sfWindow* Window, unsigned int Width, unsigned int Height, sfUint8* Pixels);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Activate or deactivate a window as the current target for rendering
|
||||
///
|
||||
/// \param Window : Window object
|
||||
/// \param Active : sfTrue to activate, sfFalse to deactivate
|
||||
///
|
||||
/// \return True if operation was successful, false otherwise
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfBool sfWindow_SetActive(sfWindow* Window, sfBool Active);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Display a window on screen
|
||||
///
|
||||
/// \param Window : Window object
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfWindow_Display(sfWindow* Window);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the input manager of a window
|
||||
///
|
||||
/// \param Window : Window object
|
||||
///
|
||||
/// \return Reference to the input
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfInput* sfWindow_GetInput(sfWindow* Window);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Limit the framerate to a maximum fixed frequency for a window
|
||||
///
|
||||
/// \param Window : Window object
|
||||
///
|
||||
/// \param Limit : Framerate limit, in frames per seconds (use 0 to disable limit)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfWindow_SetFramerateLimit(sfWindow* Window, unsigned int Limit);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get time elapsed since last frame of a window
|
||||
///
|
||||
/// \param Window : Window object
|
||||
///
|
||||
/// \return Time elapsed, in seconds
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API float sfWindow_GetFrameTime(sfWindow* Window);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Change the joystick threshold, ie. the value below which
|
||||
/// no move event will be generated
|
||||
///
|
||||
/// \param Window : Window object
|
||||
/// \param Threshold : New threshold, in range [0, 100]
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfWindow_SetJoystickThreshold(sfWindow* Window, float Threshold);
|
||||
|
||||
|
||||
#endif // SFML_WINDOW_H
|
56
CSFML/include/SFML/Window/WindowHandle.h
Normal file
56
CSFML/include/SFML/Window/WindowHandle.h
Normal file
|
@ -0,0 +1,56 @@
|
|||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2008-2008 Laurent Gomila (laurent.gom@gmail.com)
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied warranty.
|
||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
//
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it freely,
|
||||
// subject to the following restrictions:
|
||||
//
|
||||
// 1. The origin of this software must not be misrepresented;
|
||||
// you must not claim that you wrote the original software.
|
||||
// If you use this software in a product, an acknowledgment
|
||||
// in the product documentation would be appreciated but is not required.
|
||||
//
|
||||
// 2. Altered source versions must be plainly marked as such,
|
||||
// and must not be misrepresented as being the original software.
|
||||
//
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_WINDOWHANDLE_H
|
||||
#define SFML_WINDOWHANDLE_H
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Config.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Define a low-level window handle type, specific to
|
||||
/// each platform
|
||||
////////////////////////////////////////////////////////////
|
||||
#if defined(CSFML_SYSTEM_WINDOWS)
|
||||
|
||||
// Windows defines a void* handle (HWND)
|
||||
typedef void* sfWindowHandle;
|
||||
|
||||
#elif defined(CSFML_SYSTEM_LINUX)
|
||||
|
||||
// Unix - X11 defines an unsigned integer handle (Window)
|
||||
typedef unsigned long sfWindowHandle;
|
||||
|
||||
#elif defined(CSFML_SYSTEM_MACOS)
|
||||
|
||||
// Mac OS X defines a void* handle (NSWindow)
|
||||
typedef void * sfWindowHandle;
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#endif // SFML_WINDOWHANDLE_H
|
Loading…
Add table
Add a link
Reference in a new issue