本文整理汇总了C#中Drawable类的典型用法代码示例。如果您正苦于以下问题:C# Drawable类的具体用法?C# Drawable怎么用?C# Drawable使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Drawable类属于命名空间,在下文中一共展示了Drawable类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
}
示例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));
}
示例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,
},
};
}
示例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)
}
}
}
};
}
示例5: AddDrawing
// --- UnLoad end ---//
// --- Drawable start ---//
public void AddDrawing(Drawable d)
{
lock (drawings)
{
drawings.Add(d);
}
}
示例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)
},
};
}
示例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);
}
示例8: RemoveDrawable
public void RemoveDrawable(int layer, Drawable d)
{
if (mLayers[layer] == null)
return;
mLayers[layer].Remove(d);
}
示例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,
}
};
}
示例10: AddDrawable
public void AddDrawable(int layer, Drawable d)
{
if (mLayers[layer] == null)
mLayers[layer] = new List<Drawable>();
mLayers[layer].Add(d);
}
示例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),
},
};
}
示例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);
}
示例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);
}
示例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;
}
}
}
示例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
}
}
},
};
}