sf.Window Class Reference

sf.Window is a rendering window ; it can create a new window or connect to an existing one.
Default constructor : sf.Window()
Construct a new window : sf.Window(Mode, Title, sf.Style.Resize | sf.Style.Close, Params = sf.WindowSettings())
    Mode : Video mode to use (sf.VideoMode instance)
    Title : Title of the window
    WindowStyle : Window style (Resize | Close by default)
    Params : Creation parameters (see default constructor for default values)
Construct the window from an existing control : sf.Window(Handle, Params)
    Handle     : Platform-specific handle of the control
    Params     : Creation parameters (see default constructor for default values)

Methods

Close()
Close (destroy) the window. The sf.Window instance remains valid and you can call Create to recreate the window.
Create(Mode, Title, sf.Style.Resize | sf.Style.Close, Params = sf.WindowSettings())
Create a window.
    Mode : Video mode to use (sf.VideoMode instance)
    Title : Title of the window
    WindowStyle : Window style (Resize | Close by default)
    Params : Creation parameters (see default constructor for default values)
Display()
Display the window on screen.
EnableKeyRepeat(Enable)
Enable or disable automatic key-repeat. Automatic key-repeat is enabled by default.
    Enabled : True to enable, false to disable
GetEvent(Event)
Get the event on top of events stack, if any, and pop it. Returns True if an event was returned, False if events stack was empty.
    EventReceived : Event to fill, if any.
GetFrameTime()
Get time elapsed since last frame. Returns time elapsed, in seconds
GetHeight()
Get the height of the rendering region of the window.
GetInput()
Get the input manager of the window.
GetSettings()
Get the creation settings of the window.
GetWidth()
Get the width of the rendering region of the window.
IsOpened()
Tell whether or not the window is opened (ie. has been created). Note that a hidden window (Show(False)) will still return True.
SetActive(Active)
Activate of deactivate the window as the current target for rendering. Returns True if operation was successful, False otherwise.
    Active : True to activate, False to deactivate (True by default)
SetCursorPosition(Left, Top)
Change the position of the mouse cursor.
    Left : Left coordinate of the cursor, relative to the window
    Top : Top coordinate of the cursor, relative to the window
SetFramerateLimit(Limit)
Set the framerate at a fixed frequency.
    Limit : Framerate limit, in frames per seconds (use 0 to disable limit)
SetIcon(Width, Height, Pixels)
Change the window's icon.
    Width : Icon's width, in pixels
    Height : Icon's height, in pixels
    Pixels : Pointer to the pixels in memory, format must be RGBA 32 bits.
SetJoystickThreshold(Threshold)
Change the joystick threshold, ie. the value below which no move event will be generated.
    Threshold : New threshold, in range [0., 100.]
SetPosition(X, Y)
Change the position of the window on screen. Only works for top-level windows
    Left : Left position
    Top : Top position
SetSize(Width, Height)
Change the size of the rendering region of the window.
    Width : New width
    Height : New height
Show(State)
Show or hide the window.
    State : True to show, false to hide.
ShowMouseCursor(Show)
Show or hide the mouse cursor.
    Show : True to show, false to hide.
UseVerticalSync(Enabled)
Enable / disable vertical synchronization.
    Enabled : True to enable v-sync, False to deactivate