Пример #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;
        }
Пример #2
0
        public static void LoadVisibleSurfaces(Form1 frm)
        {
            Graphics g = frm.CreateGraphics();

            visSurf = new VisibleSurface(g, frm.Width, frm.Height);
            visSurf.Bind(layers);

            layers[0].ShowGridLines = false;
            layers[1].ShowGridLines = false;

            visSurf.RedrawDirtyRectangleOnly = true;

            fpsCounter = new Text(visSurf, "fps:", new Font("Times New Roman", 8),
                                  new Rectangle(0, 0, 200, 300), Color.White, Color.Transparent);

            Engine.CPSCalculated += new Gondwana.Common.EventArgs.CyclesPerSecondCalculatedHandler(Engine_CPSCalculated);
        }