view import/myrrdin/test.d @ 5:f4b89014ad39

added moving figure stuff + animated sprites. not usable atm.
author fred@reichbier.de
date Sat, 19 Jul 2008 14:33:08 +0200
parents src/test.d@292df259cc85
children 510541745cd1
line wrap: on
line source

/*
    This file is part of myrrdin.

    myrrdin is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as 
    published by the Free Software Foundation, either version 3 of 
    the License, or (at your option) any later version.

    myrrdin is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public 
    License along with myrrdin. If not, see <http://www.gnu.org/licenses/>.
*/

module test;

import dsfml.window.all;
import dsfml.system.all;
import dsfml.graphics.all;

import tileconsumer;
import renderer;
import consumer;
import imagecache;
import tilemap;
import tileset;
import xmlmap;
import tools;
import viewconsumer;
import animatedsprite;
import spriteconsumer;
import movingfigure;

int main(char[][] args) {
    Cache cache = new Cache("gfx");
    Tilemap map = parse_map(cache, read_file_contents("map-example.xml"));
    Renderer render = new Renderer("Blubb", 600, 480, 32);
//    render.add_consumer(new InteractiveViewConsumer(render));
    TileConsumer consumer = new TileConsumer(render, map);
    map.set_view(render.app.getView());
    render.add_consumer(consumer);
    render.add_consumer(load_charset(render, cache, "f-", ".png", 10)); 
/*    SpriteConsumer c = new SpriteConsumer(render);
    AnimatedSprite s = new AnimatedSprite;
    s.setX(10);
    s.setY(10);
    Animation a = new Animation;
    a.add_frame(map.tileset.tiles[0], 10);
    a.add_frame(map.tileset.tiles[1], 10);
//    s.setImage(map.tileset.tiles[0]);
    s.play_animation(a, true);
    c.add_sprite(s);
    render.add_consumer(c);*/

    render.mainloop();
    return 0; 
}