Mercurial > projects > myrrdin
view src/renderer.d @ 1:f193d0c14685
layer support
author | fred@reichbier.de |
---|---|
date | Thu, 17 Jul 2008 20:19:24 +0200 |
parents | a2d653eb9e99 |
children | 292df259cc85 |
line wrap: on
line source
module renderer; import dsfml.window.all; import dsfml.system.all; import dsfml.graphics.all; import consumer; import imagecache; class Renderer { public RenderWindow app; public Cache cache; private Consumer[] consumers; this(char[] title, int width, int height, int depth=32) { this.app = new RenderWindow(VideoMode(width, height, depth), title); this.app.setFramerateLimit(40); this.cache = new Cache("."); // TODO } void add_consumer(Consumer consumer) { this.consumers ~= consumer; } /* start the mainloop */ void mainloop() { Event evt; while(this.app.isOpened()) { // handle all events while(this.app.getEvent(evt)) { if (evt.Type == Event.EventType.CLOSED) { this.app.close(); } } // draw all foreach(Consumer consumer; this.consumers) { consumer.draw(); } // display all this.app.display(); } } }