Пример #1
0
 public BlockView()
 {
     currentSim  = new BlockSim(20, 20, 5);
     DisplaySize = new Size((int)((currentSim.X * 9 + 1) * scale), (int)((currentSim.Y * 9 + 1) * scale));
     //this.DoubleBuffered = true;
     // this.AutoScroll = true;
     InitializeComponent();
     SetUpInternalDisplay();
 }
Пример #2
0
 public BlockView()
 {
     currentSim = new BlockSim(20, 20, 5);
     DisplaySize = new Size((int)((currentSim.X * 9 + 1) * scale), (int)((currentSim.Y * 9 + 1) * scale));
     //this.DoubleBuffered = true;
        // this.AutoScroll = true;
     InitializeComponent();
     SetUpInternalDisplay();
 }
Пример #3
0
 private void SetUpInternalDisplay(BlockSim newSim)
 {
     stopPaint        = true;
     currentSim       = null;
     currentSim       = newSim;
     DisplaySize      = new Size((int)((currentSim.X * 9 + 1) * scale), (int)((currentSim.Y * 9 + 1) * scale));
     this.Size        = DisplaySize;
     this.MinimumSize = DisplaySize;
     stopPaint        = false;
     this.Refresh();
 }
Пример #4
0
 public BlockView()
 {
     InitializeComponent();
        // currentSim = new BlockSim(@"C:\Users\Paul Bruner\Documents\MC14500bv6.schematic");
     currentSim = new BlockSim(30, 30, 5);
     DisplaySize = new Size((int)((currentSim.X * 9 + 1) * scale), (int)((currentSim.Y * 9 + 1) * scale));
     SetUpInternalDisplay();
     this.SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.UserPaint, true);
     this.AutoScrollOffset = new Point(10, 10);
     this.Size = DisplaySize;
     this.Paint += this.Display_Paint;
     this.MouseDown += this.Display_MouseDown;
     this.MouseUp += this.Display_MouseUp;
     this.MouseMove += this.Display_MouseMove;
     this.MouseEnter += this.Display_MouseEnter;
     this.MouseLeave += this.Display_MouseLeave;
     this.MouseWheel += new MouseEventHandler(BlockView_MouseWheel);
     this.KeyDown += new KeyEventHandler(BlockView_KeyDown);
 }
Пример #5
0
 public BlockView()
 {
     InitializeComponent();
     // currentSim = new BlockSim(@"C:\Users\Paul Bruner\Documents\MC14500bv6.schematic");
     currentSim  = new BlockSim(30, 30, 5);
     DisplaySize = new Size((int)((currentSim.X * 9 + 1) * scale), (int)((currentSim.Y * 9 + 1) * scale));
     SetUpInternalDisplay();
     this.SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.UserPaint, true);
     this.AutoScrollOffset = new Point(10, 10);
     this.Size             = DisplaySize;
     this.Paint           += this.Display_Paint;
     this.MouseDown       += this.Display_MouseDown;
     this.MouseUp         += this.Display_MouseUp;
     this.MouseMove       += this.Display_MouseMove;
     this.MouseEnter      += this.Display_MouseEnter;
     this.MouseLeave      += this.Display_MouseLeave;
     this.MouseWheel      += new MouseEventHandler(BlockView_MouseWheel);
     this.KeyDown         += new KeyEventHandler(BlockView_KeyDown);
 }
Пример #6
0
        public void AddLayer()
        {
            //create new Simulation with Y+1 rows
            BlockSim _newSim = new BlockSim(this.currentSim.X, this.currentSim.Y, this.currentSim.Z + 1);

            for (int i = 0; i < currentSim.X; i++)
            {
                for (int j = 0; j < currentSim.Y; j++)
                {
                    for (int k = 0; k < currentSim.Z; k++)
                    {
                        if (currentSim.GetBlockType(i, j, k) == BlockType.AIR)
                        {
                            continue;
                        }
                        _newSim.SetBlock(i, j, k, currentSim.GetBlockType(i, j, k));
                    }
                }
            }
            _newSim.setAllConnections();
            SetUpInternalDisplay(_newSim);
        }
Пример #7
0
        public void addLeftColumn()
        {
            //create new Simulation with Y+1 rows
            BlockSim _newSim = new BlockSim(this.currentSim.X + 1, this.currentSim.Y, this.currentSim.Z);

            for (int i = 0; i < currentSim.X; i++)
            {
                for (int j = 0; j < currentSim.Y; j++)
                {
                    for (int k = 0; k < currentSim.Z; k++)
                    {
                        if (currentSim.GetBlockType(i, j, k) == BlockType.AIR)
                        {
                            continue;
                        }
                        _newSim.SetBlock(i + 1, j, k, currentSim.GetBlockType(i, j, k));
                    }
                }
            }


            SetUpInternalDisplay(_newSim);
        }
Пример #8
0
        public void addTopRow()
        {
            //create new Simulation with Y+1 rows
            BlockSim _newSim = new BlockSim(this.currentSim.X, this.currentSim.Y + 1, this.currentSim.Z);

            for (int i = 0; i < currentSim.X; i++)
            {
                for (int j = 0; j < currentSim.Y; j++)
                {
                    for (int k = 0; k < currentSim.Z; k++)
                    {
                        if (currentSim.GetBlockType(i, j, k) == BlockType.AIR)
                        {
                            continue;
                        }
                        _newSim.SetBlock(i, j + 1, k, currentSim.GetBlockType(i, j, k));
                    }
                }
            }


            DisplaySize = new Size((int)((currentSim.X * 9 + 1) * scale), (int)((currentSim.Y * 9 + 1) * scale));
            SetUpInternalDisplay(_newSim);
        }
Пример #9
0
 public BlockView(BlockSim sim)
 {
     InitializeComponent();
     currentSim = sim;
 }
Пример #10
0
 public BlockView(BlockSim sim)
 {
     currentSim  = sim;
     DisplaySize = new Size((int)((currentSim.X * 9 + 1) * scale), (int)((currentSim.Y * 9 + 1) * scale));
     // SetUpInternalDisplay();
 }
Пример #11
0
        public void addRightColumn()
        {
            //create new Simulation with Y+1 rows
            BlockSim _newSim = new BlockSim(this.currentSim.X + 1, this.currentSim.Y, this.currentSim.Z);
            for (int i = 0; i < currentSim.X; i++)
            {
                for (int j = 0; j < currentSim.Y; j++)
                {
                    for (int k = 0; k < currentSim.Z; k++)
                    {
                        if (currentSim.GetBlockType(i, j, k) == BlockType.AIR)
                            continue;
                        _newSim.SetBlock(i, j, k, currentSim.GetBlockType(i, j, k));
                    }
                }
            }

            SetUpInternalDisplay(_newSim);
        }
Пример #12
0
        public void LoadSim(string filename)
        {
            BlockSim sim = new BlockSim(filename);

            SetUpInternalDisplay(sim);
        }
Пример #13
0
 public BlockView(BlockSim sim)
 {
     currentSim = sim;
     DisplaySize = new Size((int)((currentSim.X * 9 + 1) * scale), (int)((currentSim.Y * 9 + 1) * scale));
        // SetUpInternalDisplay();
 }
Пример #14
0
 private void SetUpInternalDisplay(BlockSim newSim)
 {
     stopPaint = true;
     currentSim = null;
     currentSim = newSim;
     DisplaySize = new Size((int)((currentSim.X * 9 + 1) * scale), (int)((currentSim.Y * 9 + 1) * scale));
     this.Size = DisplaySize;
     this.MinimumSize = DisplaySize;
     stopPaint = false;
     this.Refresh();
 }
Пример #15
0
 public void LoadSim(string filename)
 {
     BlockSim sim = new BlockSim(filename);
        SetUpInternalDisplay(sim);
 }
Пример #16
0
        public void addTopRow()
        {
            //create new Simulation with Y+1 rows
            BlockSim _newSim = new BlockSim(this.currentSim.X, this.currentSim.Y + 1, this.currentSim.Z);
            for (int i = 0; i < currentSim.X; i++)
            {
                for (int j = 0; j < currentSim.Y; j++)
                {
                    for (int k = 0; k < currentSim.Z; k++)
                    {
                        if (currentSim.GetBlockType(i,j,k) == BlockType.AIR)
                            continue;
                        _newSim.SetBlock(i, j + 1, k, currentSim.GetBlockType(i,j,k));
                    }
                }
            }

            DisplaySize = new Size((int)((currentSim.X * 9 + 1) * scale), (int)((currentSim.Y * 9 + 1) * scale));
            SetUpInternalDisplay(_newSim);
        }
Пример #17
0
 public BlockView(BlockSim sim)
 {
     InitializeComponent();
     currentSim = sim;
 }
Пример #18
0
        public void AddLayer()
        {
            //create new Simulation with Y+1 rows
            BlockSim _newSim = new BlockSim(this.currentSim.X, this.currentSim.Y, this.currentSim.Z+1);
            for (int i = 0; i < currentSim.X; i++)
            {
                for (int j = 0; j < currentSim.Y; j++)
                {
                    for (int k = 0; k < currentSim.Z; k++)
                    {
                        if (currentSim.GetBlockType(i, j, k) == BlockType.AIR)
                            continue;
                        _newSim.SetBlock(i, j, k, currentSim.GetBlockType(i, j, k));

                    }
                }
            }
            _newSim.setAllConnections();
            SetUpInternalDisplay(_newSim);
        }