If you need to make OpenGL 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. * 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 $(U 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. *
$(U ContextSettings) allows to define several advanced settings of the OpenGL context attached to a window. * All these settings have no impact on the regular DSFML rendering (graphics module) – except the anti-aliasing level, so you may need to use this structure only if you're using SFML as a windowing system for custom OpenGL rendering. * The depthBits and stencilBits members define the number of bits per pixel requested for the (respectively) depth and stencil buffers. * antialiasingLevel represents the requested number of multisampling levels for anti-aliasing. * majorVersion and minorVersion define the version of the OpenGL context that you want. Only versions greater or equal to 3.0 are relevant; versions lesser than 3.0 are all handled the same way (i.e. you can use any version < 3.0 if you don't want an OpenGL 3 context). * When requesting a context with a version greater or equal to 3.2, you have the option of specifying whether the context should follow the core or compatibility profile of all newer (>= 3.2) OpenGL specifications. For versions 3.0 and 3.1 there is only the core profile. By default a compatibility context is created. You only need to specify the core flag if you want a core profile context to use with your own OpenGL rendering. Warning: The graphics module will not function if you request a core profile context. Make sure the attributes are set to Default if you want to use the graphics module. * Linking with a debug SFML binary will cause a context to be requested with additional debugging features enabled. Depending on the system, this might be required for advanced OpenGL debugging. OpenGL debugging is disabled by default. * Special Note for OS X: Apple only supports choosing between either a legacy context (OpenGL 2.1) or a core context (OpenGL version depends on the operating system version but is at least 3.2). Compatibility contexts are not supported. Further information is available on the OpenGL Capabilities Tables page. OS X also currently does not support debug contexts. * Please note that these values are only a hint. No failure will be reported if one or more of these values are not supported by the system; instead, SFML will try to find the closest valid match. You can then retrieve the settings that the window actually used to create its context, with Window.getSettings().
$(U Event) holds all the informations about a system event that just happened. Events are retrieved using the Window.pollEvent and Window.waitEvent functions. * An $(U 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. *
$(U Joystick) provides an interface to the state of the joysticks. It only contains static functions, so it's not meant to be instanciated. Instead, each joystick is identified by an index that is passed to the functions of this class. * This class allows users to query the state of joysticks at any time and directly, without having to deal with a window and its events. Compared to the JoystickMoved, JoystickButtonPressed, and JoystickButtonReleased events, $(U Joystick) can retrieve the state of axes and buttons of joysticks at any time (you don't need to store and update a boolean on your side in order to know if a button is pressed or released), and you always get the real state of joysticks, even if they are moved, pressed or released when your window is out of focus and no event is triggered. * DSFML supports:
* $(PARA Unlike the keyboard or mouse, the state of joysticks is sometimes not directly available (depending on the OS), therefore an `update()` function must be called in order to update the current state of joysticks. When you have a window with event handling, this is done automatically, you don't need to call anything. But if you have no window, or if you want to check joysticks state before creating one, you must call `Joystick.update` explicitly.) *
$(U Keyboard) provides an interface to the state of the keyboard. It only contains static functions (a single keyboard is assumed), so it's not meant to be instanciated. * This class allows users to query the keyboard state at any time and directly, without having to deal with a window and its events. Compared to the KeyPressed and KeyReleased events, $(U Keyboard) can retrieve the state of a key at any time (you don't need to store and update a boolean on your side in order to know if a key is pressed or released), and you always get the real state of the keyboard, even if keys are pressed or released when your window is out of focus and no event is triggered. *
$(U Mouse) provides an interface to the state of the mouse. It only contains static functions (a single mouse is assumed), so it's not meant to be instanciated. * This class allows users to query the mouse state at any time and directly, without having to deal with a window and its events. Compared to the MouseMoved, MouseButtonPressed and MouseButtonReleased events, Mouse can retrieve the state of the cursor and the buttons at any time (you don't need to store and update a boolean on your side in order to know if a button is pressed or released), and you always get the real state of the mouse, even if it is moved, pressed or released when your window is out of focus and no event is triggered. * The setPosition and getPosition functions can be used to change or retrieve the current position of the mouse pointer. There are two versions: one that operates in global coordinates (relative to the desktop) and one that operates in window coordinates (relative to a specific window). *
$(U Sensor) provides an interface to the state of the various sensors that a device provides. It only contains static functions, so it's not meant to be instantiated.
Touch provides an interface to the state of the touches.
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 ($(WINDOW_LINK)) 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 * $(U VideoMode) provides a static function for retrieving the list of all the video modes supported by the system: getFullscreenModes(). * A custom video mode can also be checked directly for fullscreen compatibility with its isValid() function. * Additionnally, $(U 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. *
$(U Window) is the main class of the Window module. It defines an OS window that is able to receive an OpenGL rendering. * A $(U Window) can create its own new window, or be embedded into an already existing control using the create(handle) function. This can be useful for embedding an OpenGL rendering area into a view which is part of a bigger GUI with existing windows, controls, etc. It can also serve as embedding an OpenGL rendering area into a window created by another (probably richer) GUI library like Qt or wxWidgets. * The $(U Window) class provides a simple interface for manipulating the window: move, resize, show/hide, control mouse cursor, etc. It also provides event handling through its pollEvent() and waitEvent() functions. * Note that OpenGL experts can pass their own parameters (antialiasing level bits for the depth and stencil buffers, etc.) to the OpenGL context attached to the window, with the $(CONTEXTSETTINGS_LINK) structure which is passed as an optional argument when creating the window. *
Define a low-level window handle type, specific to each platform. *
Platform | Type |
---|---|
Windows | HWND |
Linux/FreeBSD | Window |
Mac OS X | either NSWindow* or NSView*, disguised as void* |
$(LF) * $(PARA $(B Mac OS X Specification) * On Mac OS X, a $(WINDOW_LINK) can be created either from an existing `NSWindow*` or an `NSView*`. When the window is created from a window, DSFML will use its content view as the OpenGL area. `Window.getSystemHandle()` will return the handle that was used to create the window, which is a `NSWindow*` by default.)
Provides OpenGL-based windows, and abstractions for events and input handling.