Ejemplo n.º 1
0
        public Puzzle(Graphics dc, string imgFile, int columns, int rows, Size size)
        {
            tilesheet = new Tilesheet("picture", imgFile);

            int tileWidth  = (int)((float)tilesheet.Bmp.Width / (float)columns);
            int tileHeight = (int)((float)tilesheet.Bmp.Height / (float)rows);
            int adjWidth   = tileWidth * columns;
            int adjHeight  = tileHeight * rows;

            tilesheet.TileSize = new Size(tileWidth, tileHeight);

            originalSize = tilesheet.Bmp.Size;
            numColumns   = columns;
            numRows      = rows;
            adjustedSize = new Size(adjWidth, adjHeight);

            GridPointMatrix matrix = new GridPointMatrix(numColumns, numRows, tileWidth, tileHeight);

            matrix.CoordinateSystem = new SquareIsoCoordinates();
            matrixes = new GridPointMatrixes(matrix);

            surface = new VisibleSurface(dc, size.Width, size.Height, matrixes);
            surface.Erase();

            InitializeSprites(tileWidth, tileHeight);
            //Gondwana.Scripting.Parser.WriteToFile("bmpProp_file.gond", System.IO.FileMode.Create, tilesheet);
            //Engine.ScriptEngineState("file.gond", true);

            delMoveStart = new SpriteMovementEventHandler(Sprites_SpriteMovementStarted);
            delMoveStop  = new SpriteMovementEventHandler(Sprites_SpriteMovementStopped);

            Sprites.SpriteMovementStarted += delMoveStart;
            Sprites.SpriteMovementStopped += delMoveStop;
        }
Ejemplo n.º 2
0
        public Puzzle(Graphics dc, string imgFile, int columns, int rows, Size size)
        {
            tilesheet = new Tilesheet("picture", imgFile);

            int tileWidth = (int)((float)tilesheet.Bmp.Width / (float)columns);
            int tileHeight = (int)((float)tilesheet.Bmp.Height / (float)rows);
            int adjWidth = tileWidth * columns;
            int adjHeight = tileHeight * rows;

            tilesheet.TileSize = new Size(tileWidth, tileHeight);

            originalSize = tilesheet.Bmp.Size;
            numColumns = columns;
            numRows = rows;
            adjustedSize = new Size(adjWidth, adjHeight);

            GridPointMatrix matrix = new GridPointMatrix(numColumns, numRows, tileWidth, tileHeight);
            matrix.CoordinateSystem = new SquareIsoCoordinates();
            matrixes = new GridPointMatrixes(matrix);

            surface = new VisibleSurface(dc, size.Width, size.Height, matrixes);
            surface.Erase();

            InitializeSprites(tileWidth, tileHeight);
            //Gondwana.Scripting.Parser.WriteToFile("bmpProp_file.gond", System.IO.FileMode.Create, tilesheet);
            //Engine.ScriptEngineState("file.gond", true);

            delMoveStart = new SpriteMovementEventHandler(Sprites_SpriteMovementStarted);
            delMoveStop = new SpriteMovementEventHandler(Sprites_SpriteMovementStopped);

            Sprites.SpriteMovementStarted += delMoveStart;
            Sprites.SpriteMovementStopped += delMoveStop;
        }
Ejemplo n.º 3
0
 /// <summary>
 /// set delegates to be used to subscribe to Sprite events
 /// </summary>
 private static void SetEventDelegates()
 {
     newCoordinates = new SpriteMovedEventHandler(sprite_NewGridPoint);
     disposing      = new SpriteDisposingEventHandler(sprite_Disposing);
     moveStart      = new SpriteMovementEventHandler(movement_Started);
     moveFinish     = new SpriteMovePointFinishedHandler(movement_MovePointFinished);
     moveStop       = new SpriteMovementEventHandler(movement_Stopped);
     animStart      = new AnimatorEventHandler(animator_Started);
     animStop       = new AnimatorEventHandler(animator_Stopped);
     animCycle      = new AnimatorEventHandler(animator_Cycled);
 }
Ejemplo n.º 4
0
 /// <summary>
 /// set delegates to be used to subscribe to Sprite events
 /// </summary>
 private static void SetEventDelegates()
 {
     newCoordinates = new SpriteMovedEventHandler(sprite_NewGridPoint);
     disposing = new SpriteDisposingEventHandler(sprite_Disposing);
     moveStart = new SpriteMovementEventHandler(movement_Started);
     moveFinish = new SpriteMovePointFinishedHandler(movement_MovePointFinished);
     moveStop = new SpriteMovementEventHandler(movement_Stopped);
     animStart = new AnimatorEventHandler(animator_Started);
     animStop = new AnimatorEventHandler(animator_Stopped);
     animCycle = new AnimatorEventHandler(animator_Cycled);
 }