Mercurial > projects > myrrdin
diff import/myrrdin/scenes/scene.d @ 10:79b534bbda65
new director model
author | fred@reichbier.de |
---|---|
date | Sat, 19 Jul 2008 19:29:00 +0200 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/import/myrrdin/scenes/scene.d Sat Jul 19 19:29:00 2008 +0200 @@ -0,0 +1,51 @@ +/* + myrrdin, a 2d tile engine + Copyright (c) 2008 Friedrich Weber + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + */ + +module myrrdin.scenes.scene; + +import myrrdin.consumers.consumer; + +class Scene { + public Consumer[] draw_consumers; + public Consumer[] event_consumers; + + this() { + } + + /* add a consumer for event handling and drawing */ + void add_consumer(Consumer consumer) { + this.add_event_consumer(consumer); + this.add_draw_consumer(consumer); + } + + /* add a consumer only for event handling */ + void add_event_consumer(Consumer consumer) { + this.event_consumers ~= consumer; + } + + /* add a consumer only for drawing */ + void add_draw_consumer(Consumer consumer) { + this.draw_consumers ~= consumer; + } + +}