Ejemplo n.º 1
0
    /// <summary>
    /// Constructs the pane with all the sprites.
    /// </summary>
    public DemoSpriteTileset()
    {
        // Create the basics
        sprites = new SpriteList();
        viewport = new SpriteViewport(sprites);
        viewport.BackgroundColor = new Color(0, 0, 50);

        // Load in the static green sphere
        IDrawable drawable = DemoSprites.TilesetFactory.Create("green-sphere");
        DrawableSprite sprite = new DrawableSprite(drawable);
        sprite.Height = sprite.Width = 64;
        sprite.X = sprite.Y = 10;
        sprites.Add(sprite);

        // Load in the animated red sphere
        int rows = 6;
        int cols = 6;

        for (int i = 0; i < cols; i++)
        {
            for (int j = 0; j < rows; j++)
            {
                if (i == j)
                {
                    drawable = DemoSprites.TilesetFactory.Create("red-sphere2");
                }
                else
                {
                    drawable = DemoSprites.TilesetFactory.Create("red-sphere");
                }

                sprite = new DrawableSprite(drawable);
                sprite.Height = sprite.Width = 64;
                sprite.X = 100 + i * 100;
                sprite.Y = 10 + j * 100;
                sprite.Randomize();
                sprites.Add(sprite);
            }
        }
    }
Ejemplo n.º 2
0
    /// <summary>
    /// Main entry point into the system.
    /// </summary>
    public static void Main(string[] args)
    {
        // Set up Gtk
        Application.Init();

        // Load in the tileset
        // Create the demo
        ViewerEntry demo = new ViewerEntry();
        Viewer.TilesetFactory.Load(new FileInfo(args[0]));

        // Load the sprite
        IDrawable drawable = Viewer.TilesetFactory.Create(args[1]);
        DrawableSprite sprite = new DrawableSprite(drawable);
        sprite.Height = sprite.Width = 64;
        sprite.X = sprite.Y = 10;
        sprite.Randomize();
        Viewer.Sprites.Add(sprite);
        Viewer.Sprite = sprite;

        // Start everything running
        demo.ShowAll();
        Application.Run();
    }