• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Drawable类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Drawable的典型用法代码示例。如果您正苦于以下问题:C# Drawable类的具体用法?C# Drawable怎么用?C# Drawable使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Drawable类属于命名空间,在下文中一共展示了Drawable类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: StarCounter

        /// <summary>
        /// Shows a float count as stars. Used as star difficulty display.
        /// </summary>
        /// <param name="maxstars">Maximum amount of stars to display.</param>
        public StarCounter(int maxstars)
        {
            MaxStars = Math.Max(maxstars, 0);

            Children = new Drawable[]
            {
                starContainer = new Container
                {
                    Anchor = Anchor.CentreLeft,
                    Origin = Anchor.CentreLeft,
                }
            };

            starContainer.Width = MaxStars * StarSize + Math.Max(MaxStars - 1, 0) * StarSpacing;
            starContainer.Height = StarSize;

            for (int i = 0; i < MaxStars; i++)
            {
                TextAwesome star = new TextAwesome
                {
                    Icon = FontAwesome.fa_star,
                    Anchor = Anchor.CentreLeft,
                    Origin = Anchor.Centre,
                    TextSize = StarSize,
                    Scale = new Vector2(minStarScale),
                    Alpha = minStarAlpha,
                    Position = new Vector2((StarSize + StarSpacing) * i + (StarSize + StarSpacing) / 2, 0),
                };

                //todo: user Container<T> once we have it.
                stars.Add(star);
                starContainer.Add(star);
            }
        }
开发者ID:yheno,项目名称:osu,代码行数:38,代码来源:StarCounter.cs


示例2: Dialog

        public Dialog(Drawable drawable, VariableSet variables = null)
            : base("CountTool", variables)
        {
            var hbox = new HBox(false, 12) {BorderWidth = 12};
              VBox.PackStart(hbox, true, true, 0);

              var preview = new Preview(drawable, _coordinates);
              hbox.PackStart(preview, true, true, 0);

              var sw = new ScrolledWindow();
              hbox.Add(sw);

              var store = new TreeStore(typeof(Coordinate<int>));
              for (int i = 0; i < 10; i++)
            {
              var coordinate = new Coordinate<int>(10 * i, 10 * i);
              _coordinates.Add(coordinate);
              store.AppendValues(coordinate);
            }

              var view = new TreeView(store);
              sw.Add(view);

              var textRenderer = new CellRendererText();
              view.AppendColumn("X", textRenderer, new TreeCellDataFunc(RenderX));
              view.AppendColumn("Y", textRenderer, new TreeCellDataFunc(RenderY));
        }
开发者ID:unhammer,项目名称:gimp-sharp,代码行数:27,代码来源:Dialog.cs


示例3: MaintenanceSection

 public MaintenanceSection()
 {
     content.Spacing = new Vector2(0, 5);
     Children = new Drawable[]
     {
         new OsuButton
         {
             RelativeSizeAxes = Axes.X,
             Text = "Delete all unranked maps",
         },
         new OsuButton
         {
             RelativeSizeAxes = Axes.X,
             Text = "Repair folder permissions",
         },
         new OsuButton
         {
             RelativeSizeAxes = Axes.X,
             Text = "Mark all maps as played",
         },
         new OsuButton
         {
             RelativeSizeAxes = Axes.X,
             Text = "Run osu! updater",
         },
         new SpriteText
         {
             Text = "TODO: osu version here",
             Anchor = Anchor.TopCentre,
             Origin = Anchor.TopCentre,
         },
     };
 }
开发者ID:yheno,项目名称:osu,代码行数:33,代码来源:MaintenanceSection.cs


示例4: ChannelDisplay

        public ChannelDisplay(Channel channel)
        {
            this.channel = channel;
            newMessages(channel.Messages);
            channel.NewMessagesArrived += newMessages;

            RelativeSizeAxes = Axes.Both;

            Children = new Drawable[]
            {
                new SpriteText
                {
                    Text = channel.Name,
                    TextSize = 50,
                    Alpha = 0.3f,
                    Anchor = Anchor.Centre,
                    Origin = Anchor.Centre
                },
                new ScrollContainer
                {
                    Children = new Drawable[]
                    {
                        flow = new FlowContainer
                        {
                            Direction = FlowDirection.VerticalOnly,
                            RelativeSizeAxes = Axes.X,
                            AutoSizeAxes = Axes.Y,
                            Spacing = new Vector2(1, 1)
                        }
                    }
                }
            };
        }
开发者ID:yheno,项目名称:osu,代码行数:33,代码来源:ChannelDisplay.cs


示例5: AddDrawing

 // --- UnLoad end ---//
 // --- Drawable start ---//
 public void AddDrawing(Drawable d)
 {
     lock (drawings)
     {
         drawings.Add(d);
     }
 }
开发者ID:hellogithubtesting,项目名称:LGame,代码行数:9,代码来源:LProcess.cs


示例6: load

 private void load(OsuConfigManager config)
 {
     Children = new Drawable[]
     {
         new CheckBoxOption
         {
             LabelText = "Integrate with Yahoo! status display",
             Bindable = config.GetBindable<bool>(OsuConfig.YahooIntegration)
         },
         new CheckBoxOption
         {
             LabelText = "Integrate with MSN Live status display",
             Bindable = config.GetBindable<bool>(OsuConfig.MsnIntegration)
         },
         new CheckBoxOption
         {
             LabelText = "Automatically start osu!direct downloads",
             Bindable = config.GetBindable<bool>(OsuConfig.AutomaticDownload)
         },
         new CheckBoxOption
         {
             LabelText = "Prefer no-video downloads",
             Bindable = config.GetBindable<bool>(OsuConfig.AutomaticDownloadNoVideo)
         },
     };
 }
开发者ID:yheno,项目名称:osu,代码行数:26,代码来源:OnlineIntegrationOptions.cs


示例7: Preview

        public Preview(Drawable drawable, SliceData sliceData)
        {
            MaxSize = drawable.Dimensions;

              ExposeEvent += delegate {sliceData.Draw(Renderer);};
              Realized += delegate
            {
              var gc = new Gdk.GC(GdkWindow);
              Renderer = new PreviewRenderer(this, gc, drawable.Dimensions);
              Draw(drawable);
            };
              SizeAllocated += delegate {Draw(drawable);};

              Events = EventMask.ButtonPressMask | EventMask.ButtonReleaseMask |
            EventMask.PointerMotionHintMask | EventMask.PointerMotionMask |
            EventMask.LeaveNotifyMask;

              ButtonPressEvent += (o, args) =>
            {
              var c = new IntCoordinate((int) args.Event.X, (int) args.Event.Y);
              Func.GetActualFunc(c).OnButtonPress(o, args);
            };

              MotionNotifyEvent += (o, args) =>
            {
              GdkWindow.Cursor = Func.GetCursor(GetXY(args));
            };

              Func = new SelectFunc(sliceData, this);
        }
开发者ID:unhammer,项目名称:gimp-sharp,代码行数:30,代码来源:Preview.cs


示例8: RemoveDrawable

        public void RemoveDrawable(int layer, Drawable d)
        {
            if (mLayers[layer] == null)
                return;

            mLayers[layer].Remove(d);
        }
开发者ID:wirunekaewjai-education-projects,项目名称:windows-form-udp-example,代码行数:7,代码来源:Scene.cs


示例9: HitExplosion

        public HitExplosion(OsuJudgementInfo judgement, OsuHitObject h = null)
        {
            this.judgement = judgement;
            AutoSizeAxes = Axes.Both;
            Origin = Anchor.Centre;

            Direction = FlowDirection.VerticalOnly;
            Spacing = new Vector2(0, 2);
            Position = (h?.EndPosition ?? Vector2.Zero) + judgement.PositionOffset;

            Children = new Drawable[]
            {
                line1 = new SpriteText
                {
                    Anchor = Anchor.TopCentre,
                    Origin = Anchor.TopCentre,
                    Text = judgement.Score.GetDescription(),
                    Font = @"Venera",
                    TextSize = 16,
                },
                line2 = new SpriteText
                {
                    Text = judgement.Combo.GetDescription(),
                    Font = @"Venera",
                    TextSize = 11,
                }
            };
        }
开发者ID:yheno,项目名称:osu,代码行数:28,代码来源:HitExplosion.cs


示例10: AddDrawable

        public void AddDrawable(int layer, Drawable d)
        {
            if (mLayers[layer] == null)
                mLayers[layer] = new List<Drawable>();

            mLayers[layer].Add(d);
        }
开发者ID:wirunekaewjai-education-projects,项目名称:windows-form-udp-example,代码行数:7,代码来源:Scene.cs


示例11: load

 private void load(OsuConfigManager config)
 {
     // NOTE: Compatability mode omitted
     Children = new Drawable[]
     {
         // TODO: this needs to be a custom dropdown at some point
         new DropdownOption<FrameSync>
         {
             LabelText = "Frame limiter",
             Bindable = config.GetBindable<FrameSync>(OsuConfig.FrameSync)
         },
         new CheckBoxOption
         {
             LabelText = "Show FPS counter",
             Bindable = config.GetBindable<bool>(OsuConfig.FpsCounter),
         },
         new CheckBoxOption
         {
             LabelText = "Reduce dropped frames",
             Bindable = config.GetBindable<bool>(OsuConfig.ForceFrameFlush),
         },
         new CheckBoxOption
         {
             LabelText = "Detect performance issues",
             Bindable = config.GetBindable<bool>(OsuConfig.DetectPerformanceIssues),
         },
     };
 }
开发者ID:yheno,项目名称:osu,代码行数:28,代码来源:RendererOptions.cs


示例12: StartAction

 public override NodeActionState StartAction(Drawable target)
 {
     DrawNode node = target as DrawNode;
     if (node == null)
         throw new ArgumentException("Send signal can be started only on DrawNode");
     return new SendSignalActionState(node, this);
 }
开发者ID:nikita-sky,项目名称:SkidiKit,代码行数:7,代码来源:SendSignal.cs


示例13: Renderer

        public Renderer(VariableSet variables, Drawable drawable)
            : base(variables)
        {
            _drawable = drawable;

              const double lensAngle = 70.0;
              const double earthRadius = 6375.0;
              var amplitudes = new double[]{1.0, 0.5, 0.25, 0.125, 0.0625,
                    0.03125, 0.05, 0.05, 0.04, 0.0300};

              _width = drawable.Width;
              _height = drawable.Height;

              _clouds = new Perlin3D(10, 16.0, amplitudes,
                 (int) GetValue<UInt32>("seed"));
              _cameraDistance = _width * 0.5 / Math.Tan(lensAngle * Math.PI / 180.0);

              _intSunX = (int) Math.Round((_width - 1) * GetValue<double>("sun_x"));
              _intSunY = (int) Math.Round((_height - 1) * GetValue<double>("sun_y"));

              _horizonColor2 = FromScreen("horizon_color");
              _skyColor2 = FromScreen("sky_color");
              _sunColor2 = FromScreen("sun_color");
              _cloudColor2 = FromScreen("cloud_color");
              _shadowColor2 = FromScreen("shadow_color");

              var tilt = new TMatrix(GetValue<double>("tilt"), 1);
              var rotation = new TMatrix(GetValue<double>("rotation"), 2);
              _transform = TMatrix.Combine(tilt, rotation);
              _cameraLocation = new Vector3(0.0, earthRadius + 0.2, 0.0);
        }
开发者ID:unhammer,项目名称:gimp-sharp,代码行数:31,代码来源:Renderer.cs


示例14: Draw

 public void Draw(Graphics g, Drawable d)
 {
     int pi = 0;
     for (int i = 0; i < d.NumDrawables; i++)
     {
         int drawType = d.DrawableType(i);
         if (drawType == Constants.Graphics.DRAW_NOTHING) continue;
         int numPts = Constants.Graphics.DRAW_PT_LOOKUP_TABLE[drawType];
         Color4 c = d.DrawableColor(i);
         pen.Color = Color.FromArgb(c.ToArgb());
         for (int j = 0; j < numPts; j++)
             p[j] = scale * d.GetPoint(pi++);
         switch (drawType)
         {
             case Constants.Graphics.DRAW_NOTHING:
                 break;
             case Constants.Graphics.DRAW_POINT:
                 g.DrawRectangle(pen, p[0].X - 1f, p[0].Y - 1f, 2f, 2f);
                 break;
             case Constants.Graphics.DRAW_LINE:
                 g.DrawLine(pen, p[0].X, p[0].Y, p[1].X, p[1].Y);
                 break;
             case Constants.Graphics.DRAW_CIRCLE:
                 g.DrawEllipse(pen, p[0].X, p[0].Y, (p[1].X - p[0].X), (p[1].Y - p[0].Y));
                 break;
         }
     }
 }
开发者ID:kjin,项目名称:cs5643_a4,代码行数:28,代码来源:PanelDrawer.cs


示例15: OptionsSidebar

 public OptionsSidebar()
 {
     RelativeSizeAxes = Axes.Y;
     InternalChildren = new Drawable[]
     {
         new Box
         {
             Colour = Color4.Black,
             RelativeSizeAxes = Axes.Both,
         },
         new SidebarScrollContainer
         {
             Children = new []
             {
                 content = new FlowContainer
                 {
                     Origin = Anchor.CentreLeft,
                     Anchor = Anchor.CentreLeft,
                     AutoSizeAxes = Axes.Y,
                     RelativeSizeAxes = Axes.X,
                     Direction = FlowDirection.VerticalOnly
                 }
             }
         },
     };
 }
开发者ID:yheno,项目名称:osu,代码行数:26,代码来源:OptionsSidebar.cs


示例16: Render

	protected override void Render (Drawable window, Widget widget, Rectangle background_area, Rectangle cell_area, Rectangle expose_area, CellRendererState flags)
	{
		int width = 0, height = 0, x_offset = 0, y_offset = 0;
		StateType state;
		GetSize (widget, ref cell_area, out x_offset, out y_offset, out width, out height);

		if (widget.HasFocus)
			state = StateType.Active;
		else
			state = StateType.Normal;

		width -= (int) this.Xpad * 2;
		height -= (int) this.Ypad * 2;


		//FIXME: Style.PaintBox needs some customization so that if you pass it
		//a Gdk.Rectangle.Zero it gives a clipping area big enough to draw
		//everything
		Gdk.Rectangle clipping_area = new Gdk.Rectangle ((int) (cell_area.X + x_offset + this.Xpad), (int) (cell_area.Y + y_offset + this.Ypad), width - 1, height - 1);
		
		Style.PaintBox (widget.Style, (Gdk.Window) window, StateType.Normal, ShadowType.In, clipping_area, widget, "trough", (int) (cell_area.X + x_offset + this.Xpad), (int) (cell_area.Y + y_offset + this.Ypad), width - 1, height - 1);

		Gdk.Rectangle clipping_area2 = new Gdk.Rectangle ((int) (cell_area.X + x_offset + this.Xpad), (int) (cell_area.Y + y_offset + this.Ypad), (int) (width * Percentage), height - 1);
		
		Style.PaintBox (widget.Style, (Gdk.Window) window, state, ShadowType.Out, clipping_area2, widget, "bar", (int) (cell_area.X + x_offset + this.Xpad), (int) (cell_area.Y + y_offset + this.Ypad), (int) (width * Percentage), height - 1);
	}
开发者ID:ystk,项目名称:debian-gtk-sharp2,代码行数:26,代码来源:CustomCellRenderer.cs


示例17: Render

        public override void Render(Drawable window,
                                     Widget widget,
                                     Rectangle cell_area,
                                     Rectangle expose_area,
                                     StateType cell_state,
                                     IPhoto photo)
        {
            string text = GetRenderText (photo);

            var layout = new Pango.Layout (widget.PangoContext);
            layout.SetText (text);

            Rectangle layout_bounds;
            layout.GetPixelSize (out layout_bounds.Width, out layout_bounds.Height);

            layout_bounds.Y = cell_area.Y;
            layout_bounds.X = cell_area.X + (cell_area.Width - layout_bounds.Width) / 2;

            if (layout_bounds.IntersectsWith (expose_area)) {
                Style.PaintLayout (widget.Style, window, cell_state,
                                   true, expose_area, widget, "IconView",
                                   layout_bounds.X, layout_bounds.Y,
                                   layout);
            }
        }
开发者ID:Yetangitu,项目名称:f-spot,代码行数:25,代码来源:ThumbnailTextCaptionRenderer.cs


示例18: MainMenu

        public MainMenu()
        {
            background = new BackgroundModeDefault();

            Children = new Drawable[]
            {
                new ParallaxContainer
                {
                    ParallaxAmount = 0.01f,
                    Children = new Drawable[]
                    {
                        buttons = new ButtonSystem()
                        {
                            OnChart = delegate { Push(new ChartListing()); },
                            OnDirect = delegate { Push(new OnlineListing()); },
                            OnEdit = delegate { Push(new EditSongSelect()); },
                            OnSolo = delegate { Push(new PlaySongSelect()); },
                            OnMulti = delegate { Push(new Lobby()); },
                            OnTest  = delegate { Push(new TestBrowser()); },
                            OnExit = delegate { Exit(); },
                        }
                    }
                }
            };
        }
开发者ID:yheno,项目名称:osu,代码行数:25,代码来源:MainMenu.cs


示例19: Collide

        public static Point Collide(Drawable a, Drawable b, int dx, int dy)
        {
            Rectangle bbt = b.GetBound();

            Rectangle ab = a.GetBound();
            Rectangle bb = b.GetBound();

            bb.X += dx;
            bb.Y += dy;

            Rectangle cc = Rectangle.Intersect(ab, bb);

            if (cc.IsEmpty)
            {
                //Rectangle un = Rectangle.Union(bb, bbt);
                //Rectangle uc = Rectangle.Intersect(ab, un);

                //if (uc.IsEmpty)
                //    return Point.Empty;

                //// Incompleted
                return Point.Empty;

                //Rectangle abb = a.GetBound();
                //abb.X += -dx;
                //abb.Y += -dy;

                //Point gp = GetPoint(bb, ab, abb, Rectangle.Intersect(abb, bb), -dx, -dy);
                //return new Point(gp.X, gp.Y);
            }
            else
            {
                return GetPoint(ab, bb, bbt, cc, dx, dy);
            }
        }
开发者ID:wirunekaewjai-education-projects,项目名称:windows-form-udp-example,代码行数:35,代码来源:Collisions.cs


示例20: Render

        public void Render(BoolMatrix boolMatrix, PixelFetcher pf, 
		       Drawable drawable)
        {
            var dimensions = drawable.Dimensions;
              RenderDrop(boolMatrix, pf, dimensions);
              RenderShadow(pf, drawable, dimensions);
        }
开发者ID:unhammer,项目名称:gimp-sharp,代码行数:7,代码来源:Raindrop.cs



注:本文中的Drawable类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# DrawerLayout类代码示例发布时间:2022-05-24
下一篇:
C# DrawState类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap