RenderWindow


Object Hierarchy:

Object hierarchy for RenderWindow

Description:

[ Compact ]
[ CCode ( cprefix = "sfRenderWindow_" , free_function = "sfRenderWindow_destroy" ) ]
public class RenderWindow

Window that can serve as a target for 2D drawing.

sf.RenderWindow is the main class of the Graphics module.

It defines an OS window that can be painted using the other classes of the graphics module.

sf.RenderWindow is derived from sf.Window, thus it inherits all its features: events, window management, OpenGL rendering, etc. See the documentation of sf.Window for a more complete description of all these features, as well as code examples.

On top of that, sf.RenderWindow adds more features related to 2D drawing with the graphics module (see its base class sf.RenderTarget for more details). Here is a typical rendering and event loop with a sf.RenderWindow:

using sf;

void main()
{
var window = new RenderWindow(VideoMode(200, 200), "SFML works!");
var circle = new CircleShape();
circle.setFillColor(Color.Green);
circle.setRadius(100);

while (window.isOpen())
{
Event event;
while (window.pollEvent(out event))
{
if (event.type == EventType.Closed)
window.close();
}

window.clear();
window.draw(circle);
window.display();
}
}


Namespace: sf
Package: sfml

Content:

Properties:

Creation methods:

Methods: