示例#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();
 }
 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();
 }
 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);
        }
 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();
 }
        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);
        }
 public BlockView(BlockSim sim)
 {
     currentSim = sim;
     DisplaySize = new Size((int)((currentSim.X * 9 + 1) * scale), (int)((currentSim.Y * 9 + 1) * scale));
        // SetUpInternalDisplay();
 }
 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();
 }
 public void LoadSim(string filename)
 {
     BlockSim sim = new BlockSim(filename);
        SetUpInternalDisplay(sim);
 }
        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;
 }
        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);
        }