Window that serves as a target for OpenGL rendering.
Window is the main class of the Window module.
It defines an OS window that is able to receive an OpenGL rendering.
A 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 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 function .
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 structure which is passed as an optional argument when creating the window.
// Declare and create a new render-window
val window = Window(VideoMode(800, 600), "SFML window")
// Limit the framerate to 60 frames per second (this step is optional)
window.framerateLimit = 60;
// The main loop - ends as soon as the window is closed
while window.isOpen() do
// Event processing
for event <- window.pollEvent() do
event match
// Request for closing the window
case Event.Closed() => window.close()
case _ => ()
// End the current frame and display its contents on screen
window.display()
Attributes
- Companion
- object
- Graph
-
- Supertypes
-
class Objecttrait Matchableclass Any
- Known subtypes
-
trait RenderWindow