Window.h File Reference

#include <SFML/Config.h>
#include <SFML/Window/Event.h>
#include <SFML/Window/Input.h>
#include <SFML/Window/VideoMode.h>
#include <SFML/Window/WindowHandle.h>

Go to the source code of this file.


Data Structures

struct  sfWindowSettings
 Structure defining the window's creation settings. More...

Typedefs

typedef sfWindow sfWindow
 sfWindow is a rendering window ; it can create a new window or connect to an existing one

Enumerations

enum  {
  sfNone = 0,
  sfTitlebar = 1 << 0,
  sfResize = 1 << 1,
  sfClose = 1 << 2,
  sfFullscreen = 1 << 3
}
 Enumeration of window creation styles. More...

Functions

CSFML_API sfWindowsfWindow_Create (sfVideoMode Mode, const char *Title, unsigned long Style, sfWindowSettings Params)
 Construct a new window.
CSFML_API sfWindowsfWindow_CreateFromHandle (sfWindowHandle Handle, sfWindowSettings Params)
 Construct a window from an existing control.
CSFML_API void sfWindow_Destroy (sfWindow *Window)
 Destroy an existing window.
CSFML_API void sfWindow_Close (sfWindow *Window)
 Close a window (but doesn't destroy the internal data).
CSFML_API sfBool sfWindow_IsOpened (sfWindow *Window)
 Tell whether or not a window is opened.
CSFML_API unsigned int sfWindow_GetWidth (sfWindow *Window)
 Get the width of the rendering region of a window.
CSFML_API unsigned int sfWindow_GetHeight (sfWindow *Window)
 Get the height of the rendering region of a window.
CSFML_API sfWindowSettings sfWindow_GetSettings (sfWindow *Window)
 Get the creation settings of a window.
CSFML_API sfBool sfWindow_GetEvent (sfWindow *Window, sfEvent *Event)
 Get the event on top of events stack of a window, if any, and pop it.
CSFML_API void sfWindow_UseVerticalSync (sfWindow *Window, sfBool Enabled)
 Enable / disable vertical synchronization on a window.
CSFML_API void sfWindow_ShowMouseCursor (sfWindow *Window, sfBool Show)
 Show or hide the mouse cursor on a window.
CSFML_API void sfWindow_SetCursorPosition (sfWindow *Window, unsigned int Left, unsigned int Top)
 Change the position of the mouse cursor on a window.
CSFML_API void sfWindow_SetPosition (sfWindow *Window, int Left, int Top)
 Change the position of a window on screen.
CSFML_API void sfWindow_Show (sfWindow *Window, sfBool State)
 Show or hide a window.
CSFML_API void sfWindow_EnableKeyRepeat (sfWindow *Window, sfBool Enabled)
 Enable or disable automatic key-repeat for keydown events.
CSFML_API sfBool sfWindow_SetActive (sfWindow *Window, sfBool Active)
 Activate or deactivate a window as the current target for rendering.
CSFML_API void sfWindow_Display (sfWindow *Window)
 Display a window on screen.
CSFML_API sfInputsfWindow_GetInput (sfWindow *Window)
 Get the input manager of a window.
CSFML_API void sfWindow_SetFramerateLimit (sfWindow *Window, unsigned int Limit)
 Limit the framerate to a maximum fixed frequency for a window.
CSFML_API float sfWindow_GetFrameTime (sfWindow *Window)
 Get time elapsed since last frame of a window.
CSFML_API void sfWindow_SetJoystickThreshold (sfWindow *Window, float Threshold)
 Change the joystick threshold, ie.

Typedef Documentation

typedef struct sfWindow sfWindow

sfWindow is a rendering window ; it can create a new window or connect to an existing one

Definition at line 42 of file Window/Window.h.


Enumeration Type Documentation

anonymous enum

Enumeration of window creation styles.

Enumerator:
sfNone  No border / title bar (this flag and all others are mutually exclusive).
sfTitlebar  Title bar + fixed border.
sfResize  Titlebar + resizable border + maximize button.
sfClose  Titlebar + close button.
sfFullscreen  Fullscreen mode (this flag and all others are mutually exclusive).

Definition at line 49 of file Window/Window.h.


Function Documentation

CSFML_API void sfWindow_Close ( sfWindow Window  ) 

Close a window (but doesn't destroy the internal data).

Parameters:
Window : Window to close

CSFML_API sfWindow* sfWindow_Create ( sfVideoMode  Mode,
const char *  Title,
unsigned long  Style,
sfWindowSettings  Params 
)

Construct a new window.

Parameters:
Mode : Video mode to use
Title : Title of the window
Style : Window style
Params : Creation settings

CSFML_API sfWindow* sfWindow_CreateFromHandle ( sfWindowHandle  Handle,
sfWindowSettings  Params 
)

Construct a window from an existing control.

Parameters:
Handle : Platform-specific handle of the control
Params : Creation settings

CSFML_API void sfWindow_Destroy ( sfWindow Window  ) 

Destroy an existing window.

Parameters:
Window : Window to destroy

CSFML_API void sfWindow_Display ( sfWindow Window  ) 

Display a window on screen.

Parameters:
Window : Window object

CSFML_API void sfWindow_EnableKeyRepeat ( sfWindow Window,
sfBool  Enabled 
)

Enable or disable automatic key-repeat for keydown events.

Automatic key-repeat is enabled by default

Parameters:
Window : Window object
Enabled : sfTrue to enable, sfFalse to disable

CSFML_API sfBool sfWindow_GetEvent ( sfWindow Window,
sfEvent Event 
)

Get the event on top of events stack of a window, if any, and pop it.

Parameters:
Window : Window object
Event : Event to fill, if any
Returns:
sfTrue if an event was returned, sfFalse if events stack was empty

CSFML_API float sfWindow_GetFrameTime ( sfWindow Window  ) 

Get time elapsed since last frame of a window.

Parameters:
Window : Window object
Returns:
Time elapsed, in seconds

CSFML_API unsigned int sfWindow_GetHeight ( sfWindow Window  ) 

Get the height of the rendering region of a window.

Parameters:
Window : Window object
Returns:
Height in pixels

CSFML_API sfInput* sfWindow_GetInput ( sfWindow Window  ) 

Get the input manager of a window.

Parameters:
Window : Window object
Returns:
Reference to the input

CSFML_API sfWindowSettings sfWindow_GetSettings ( sfWindow Window  ) 

Get the creation settings of a window.

Parameters:
Window : Window object
Returns:
Settings used to create the window

CSFML_API unsigned int sfWindow_GetWidth ( sfWindow Window  ) 

Get the width of the rendering region of a window.

Parameters:
Window : Window object
Returns:
Width in pixels

CSFML_API sfBool sfWindow_IsOpened ( sfWindow Window  ) 

Tell whether or not a window is opened.

Parameters:
Window : Window object

CSFML_API sfBool sfWindow_SetActive ( sfWindow Window,
sfBool  Active 
)

Activate or deactivate a window as the current target for rendering.

Parameters:
Window : Window object
Active : sfTrue to activate, sfFalse to deactivate
Returns:
True if operation was successful, false otherwise

CSFML_API void sfWindow_SetCursorPosition ( sfWindow Window,
unsigned int  Left,
unsigned int  Top 
)

Change the position of the mouse cursor on a window.

Parameters:
Window : Window object
Left : Left coordinate of the cursor, relative to the window
Top : Top coordinate of the cursor, relative to the window

CSFML_API void sfWindow_SetFramerateLimit ( sfWindow Window,
unsigned int  Limit 
)

Limit the framerate to a maximum fixed frequency for a window.

Parameters:
Window : Window object
Limit : Framerate limit, in frames per seconds (use 0 to disable limit)

CSFML_API void sfWindow_SetJoystickThreshold ( sfWindow Window,
float  Threshold 
)

Change the joystick threshold, ie.

the value below which no move event will be generated

Parameters:
Window : Window object
Threshold : New threshold, in range [0, 100]

CSFML_API void sfWindow_SetPosition ( sfWindow Window,
int  Left,
int  Top 
)

Change the position of a window on screen.

Only works for top-level windows

Parameters:
Window : Window object
Left : Left position
Top : Top position

CSFML_API void sfWindow_Show ( sfWindow Window,
sfBool  State 
)

Show or hide a window.

Parameters:
Window : Window object
State : sfTrue to show, sfFalse to hide

CSFML_API void sfWindow_ShowMouseCursor ( sfWindow Window,
sfBool  Show 
)

Show or hide the mouse cursor on a window.

Parameters:
Window : Window object
Show : sfTrue to show, sfFalse to hide

CSFML_API void sfWindow_UseVerticalSync ( sfWindow Window,
sfBool  Enabled 
)

Enable / disable vertical synchronization on a window.

Parameters:
Window : Window object
Enabled : sfTrue to enable v-sync, sfFalse to deactivate