コード例 #1
0
        private void bRunBrush_Click(object sender, EventArgs e)
        {
            if (!EnsureConditions())
            {
                return;
            }

            var fill   = pBarFill2.Value / 100d;
            var width  = (int)nWidth.Value;
            var height = (int)nHeight.Value;

            var brush              = new RandomBrush(width, height);
            var tileset            = cmbTileSet.SelectedItem as RandomTilesList;
            RandomBrushMessage msg = null;

            if (rRandomHue.Checked)
            {
                var hues = cmbHues.SelectedItem as HuesCollection;

                msg = brush.CreateMessage(tileset, hues, fill);
            }
            else
            {
                if (rNoHue.Checked)
                {
                    msg = brush.CreateMessage(tileset, 0, fill);
                }
                else
                {
                    msg = brush.CreateMessage(tileset, Pandora.Profile.Hues.SelectedIndex, fill);
                }
            }

            Pandora.BoxConnection.SendToServer(msg);
        }
コード例 #2
0
ファイル: CmdCuboid.cs プロジェクト: tommyz56/MCGalaxy
        protected override void Blockchange2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {
            RevertAndClearState(p, x, y, z);
            CatchPos cpos = (CatchPos)p.blockchangeObject;
            GetRealBlock(type, extType, p, ref cpos);
            DrawOp drawOp = null;
            Brush brush = null;

            switch (cpos.solid) {
                case SolidType.solid:
                    drawOp = new CuboidDrawOp(); break;
                case SolidType.hollow:
                    drawOp = new CuboidHollowsDrawOp(); break;
                case SolidType.walls:
                    drawOp = new CuboidWallsDrawOp(); break;
                case SolidType.holes:
                    drawOp = new CuboidHolesDrawOp(); break;
                case SolidType.wire:
                    drawOp = new CuboidWireframeDrawOp(); break;
                case SolidType.random:
                    drawOp = new CuboidDrawOp();
                    brush = new RandomBrush(cpos.type, cpos.extType); break;
            }
            
            if (brush == null) brush = new SolidBrush(cpos.type, cpos.extType);
            ushort x1 = Math.Min(cpos.x, x), x2 = Math.Max(cpos.x, x);
            ushort y1 = Math.Min(cpos.y, y), y2 = Math.Max(cpos.y, y);
            ushort z1 = Math.Min(cpos.z, z), z2 = Math.Max(cpos.z, z);            
            if (!DrawOp.DoDrawOp(drawOp, brush, p, x1, y1, z1, x2, y2, z2))
                return;
            if (p.staticCommands)
                p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1);
        }
コード例 #3
0
        void DoBranch(int x, int y, int z, TreeOutput output)
        {
            int dx          = rnd.Next(-maxExtent, maxExtent);
            int dz          = rnd.Next(-maxExtent, maxExtent);
            int clusterSize = rnd.Next(1, maxCluster);
            int branchStart = rnd.Next(branchBaseHeight, height);
            int branchMax   = branchStart + rnd.Next(3, maxBranchHeight);

            int R = clusterSize;

            Vec3S32[] marks = new Vec3S32[] {
                new Vec3S32(x + dx - R, y + branchMax - R, z + dz - R),
                new Vec3S32(x + dx + R, y + branchMax + R, z + dz + R)
            };

            DrawOp op    = new EllipsoidDrawOp();
            Brush  brush = new RandomBrush(new ExtBlock[] { new ExtBlock(Block.Leaves, 0) });

            op.SetMarks(marks);
            op.Perform(marks, brush, b => output(b.X, b.Y, b.Z, b.Block.BlockID));

            Vec3S32 p1 = new Vec3S32(x, y + branchStart, z);
            Vec3S32 p2 = new Vec3S32(x + dx, y + branchMax, z + dz);

            Line(p1, p2, output);
        }
コード例 #4
0
ファイル: MainViewModel.cs プロジェクト: pmfai25/WPF-Masonry
 public MainViewModel()
 {
     this.random            = new Random();
     this.randomBrush       = new RandomBrush();
     this.Elements          = new ObservableCollection <FrameworkElement>();
     this.AddClickCommand   = new DelegateCommand(this.OnAddButtonClick);
     this.ResetClickCommand = new DelegateCommand(this.OnResetButtonClick);
     this.Header            = "Masonry Example";
     this.Amount            = "5";
 }
コード例 #5
0
ファイル: TypeGraphPlotter.cs プロジェクト: mono/heap-prof
    public TypeList(Profile p)
    {
        int num = 0;

        int cutoff = (int) (p.MaxSize * TypeTabulator.Threshold);

        foreach (long l in p.Metadata.TypeMax)
            if (l >= cutoff)
                num ++;

        Sizes = new long [num];
        TypeIndexes = new int [num];
        Names = new string [num];
        TypeBrushes = new Brush [num];

        num = 0;
        for (int i = 0; i < p.Metadata.TypeMax.Length; i ++) {
            if (p.Metadata.TypeMax [i] >= cutoff) {
                Sizes [num] = p.Metadata.TypeMax [i];
                TypeIndexes [num] = i;
                num ++;
            }
        }

        Array.Sort (Sizes, TypeIndexes);

        RandomBrush rb = new RandomBrush ();

        for (int i = 0; i < Sizes.Length; i ++) {
            TypeBrushes [i] = rb.Next ();
            Names [i] = p.GetTypeName (TypeIndexes [i]);
        }
    }