本文整理汇总了C#中TomShane.Neoforce.Controls.Renderer.DrawString方法的典型用法代码示例。如果您正苦于以下问题:C# Renderer.DrawString方法的具体用法?C# Renderer.DrawString怎么用?C# Renderer.DrawString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TomShane.Neoforce.Controls.Renderer
的用法示例。
在下文中一共展示了Renderer.DrawString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DrawControl
protected override void DrawControl(Renderer renderer, Rectangle rect, GameTime gameTime)
{
if (Player != null)
{
_iconRect.X = rect.X;
_iconRect.Y = rect.Y;
renderer.Draw(Player.Leader.Image, _iconRect, Color.White);
renderer.DrawString(_font, Player.Leader.Title, rect.X + 24, rect.Y, Color.White);
renderer.DrawString(_font, Player.Score.ToString(), rect.X + rect.Width - 20, rect.Y, Color.White);
}
_seperatorRect.X = rect.X;
_seperatorRect.Y = rect.Y + rect.Height - 2;
renderer.Draw(bar340x2, _seperatorRect, Color.White);
}
示例2: DrawControl
protected override void DrawControl(Renderer renderer, Rectangle rect, GameTime time)
{
//Create string
string Txt = "Step " + m_Counter1;
if (m_ShowNode) Txt += "\r\nVisited nodes " + m_Counter2;
// Txt = "raka";
//Draw string
renderer.DrawString(m_Font, Txt, rect, Color.White, Alignment.BottomLeft);
}
示例3: DrawControl
protected override void DrawControl(Renderer renderer, Rectangle rect, GameTime gameTime)
{
base.DrawControl(renderer, rect, gameTime);
clipRect.X = rect.X + 1;
clipRect.Y = rect.Y + 1;
renderer.Draw(_clipImg, clipRect, Color.White);
clipRect.Y += 5;
renderer.DrawString(_policyTitleFont, PolicyType.Title, clipRect, Color.White, Alignment.TopCenter);
}
示例4: DrawControl
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
protected override void DrawControl(Renderer renderer, Rectangle rect, GameTime gameTime)
{
SkinLayer layer = Skin.Layers["Control"];
SpriteFont font = (layer.Text != null && layer.Text.Font != null) ? layer.Text.Font.Resource : null;
Color col = (layer.Text != null) ? layer.Text.Colors.Enabled : Color.White;
Point offset = new Point(layer.Text.OffsetX, layer.Text.OffsetY);
renderer.DrawLayer(this, layer, rect);
if (font != null && Text != null && Text != "")
{
renderer.DrawString(this, layer, Text, new Rectangle(rect.Left, rect.Top + layer.ContentMargins.Top, rect.Width, Skin.ClientMargins.Top - layer.ContentMargins.Horizontal), false, offset.X, offset.Y, false);
}
}
示例5: DrawControl
protected override void DrawControl(Renderer renderer, Rectangle rect, GameTime gameTime)
{
//Set color based on state
Color FontColor = Color.White;
if (ControlState == ControlState.Hovered) FontColor = Color.Gold;
if (ControlState == ControlState.Pressed) FontColor = Color.Gray;
//Set offset based on state
Rectangle Rect = new Rectangle(rect.X, rect.Y, rect.Width, rect.Height);
if (ControlState == ControlState.Pressed) {
Rect.X += 4; Rect.Y += 4;
}
//Draw text only
if (m_Font != null) renderer.DrawString(m_Font, Text, Rect, FontColor, Alignment.MiddleLeft );
}
示例6: DrawControl
protected override void DrawControl(Renderer renderer, Rectangle rect, GameTime gameTime)
{
base.DrawControl(renderer, rect, gameTime);
SkinLayer layer = Skin.Layers["Control"];
if(Text != null && Text != "")
{
int width = (int)layer.Text.Font.Resource.MeasureString(Text).X;
int ox = 5;
if (width < this.Width)
{
ox = (this.Width - width) / 2;
}
renderer.DrawString(this, layer, Text, rect, true, ox, 0);
}
}
示例7: DrawControl
protected override void DrawControl(Renderer renderer, Rectangle rect, GameTime gameTime)
{
if( MainWindow.Game.Human.Technologies.Contains( Tech ))
renderer.Draw(_backgroundReached, rect, Color.White);
else if( MainWindow.Game.Human.CurrentResearch == Tech )
renderer.Draw(_backgroundActive, rect, Color.White);
else if( MainWindow.Game.Human.PossibleTechnologies.Contains( Tech ) )
renderer.Draw(_backgroundPossible, rect, Color.White);
else
renderer.Draw(_backgroundNoReach, rect, Color.White);
if( Tech != null )
{
_techIconRect.X = rect.X + 2;
_techIconRect.Y = rect.Y;
renderer.Draw(Tech.Image, _techIconRect, Color.White);
_techTitleRect.X = rect.X + 70;
_techTitleRect.Y = rect.Y + 5;
renderer.DrawString(_font, Tech.Title,_techTitleRect, Color.White,Alignment.MiddleLeft );
}
}
示例8: DrawControl
/// <summary>
/// Draws the main menu.
/// </summary>
/// <param name="renderer">Render management object.</param>
/// <param name="rect">Destination region where the menu will be drawn.</param>
/// <param name="gameTime">Snapshot of the application's timing values.</param>
protected override void DrawControl(Renderer renderer, Rectangle rect, GameTime gameTime)
{
SkinLayer l1 = Skin.Layers["Control"];
SkinLayer l2 = Skin.Layers["Selection"];
rs = new Rectangle[Items.Count];
// Draw the menu background.
renderer.DrawLayer(this, l1, rect, ControlState.Enabled);
int prev = l1.ContentMargins.Left;
// Draw all menu entries.
for (int i = 0; i < Items.Count; i++)
{
MenuItem mi = Items[i];
int tw = (int)l1.Text.Font.Resource.MeasureString(mi.Text).X + l1.ContentMargins.Horizontal;
rs[i] = new Rectangle(rect.Left + prev, rect.Top + l1.ContentMargins.Top, tw, Height - l1.ContentMargins.Vertical);
prev += tw;
// Is not the selected entry?
if (ItemIndex != i)
{
// Draw in the enabled state?
if (mi.Enabled && Enabled)
{
renderer.DrawString(this, l1, mi.Text, rs[i], ControlState.Enabled, false);
}
// Draw in the disabled state?
else
{
renderer.DrawString(this, l1, mi.Text, rs[i], ControlState.Disabled, false);
}
}
// Selected menu entry to draw.
else
{
// Draw enabled state with selection?
if (Items[i].Enabled && Enabled)
{
renderer.DrawLayer(this, l2, rs[i], ControlState.Enabled);
renderer.DrawString(this, l2, mi.Text, rs[i], ControlState.Enabled, false);
}
// Draw disabled state with selection.
else
{
renderer.DrawLayer(this, l2, rs[i], ControlState.Disabled);
renderer.DrawString(this, l2, mi.Text, rs[i], ControlState.Disabled, false);
}
}
}
}
示例9: DrawControl
/// <summary>
/// Draws the window and all child controls.
/// </summary>
/// <param name="renderer">Render management object.</param>
/// <param name="rect">Destination region where the window will be drawn.</param>
/// <param name="gameTime">Snapshot of the application's timing values.</param>
protected override void DrawControl(Renderer renderer, Rectangle rect, GameTime gameTime)
{
SkinLayer l1 = captionVisible ? Skin.Layers[lrCaption] : Skin.Layers[lrFrameTop];
SkinLayer l2 = Skin.Layers[lrFrameLeft];
SkinLayer l3 = Skin.Layers[lrFrameRight];
SkinLayer l4 = Skin.Layers[lrFrameBottom];
SkinLayer l5 = Skin.Layers[lrIcon];
LayerStates s1, s2, s3, s4;
SpriteFont f1 = l1.Text.Font.Resource;
Color c1 = l1.Text.Colors.Enabled;
// Window has focus?
if ((Focused || (Manager.FocusedControl != null && Manager.FocusedControl.Root == this.Root)) && ControlState != ControlState.Disabled)
{
s1 = l1.States.Focused;
s2 = l2.States.Focused;
s3 = l3.States.Focused;
s4 = l4.States.Focused;
c1 = l1.Text.Colors.Focused;
}
// Window is disabled?
else if (ControlState == ControlState.Disabled)
{
s1 = l1.States.Disabled;
s2 = l2.States.Disabled;
s3 = l3.States.Disabled;
s4 = l4.States.Disabled;
c1 = l1.Text.Colors.Disabled;
}
// Window not active or child control has focus?
else
{
s1 = l1.States.Enabled;
s2 = l2.States.Enabled;
s3 = l3.States.Enabled;
s4 = l4.States.Enabled;
c1 = l1.Text.Colors.Enabled;
}
// Draw the window layer.
renderer.DrawLayer(Skin.Layers[lrWindow], rect, Skin.Layers[lrWindow].States.Enabled.Color, Skin.Layers[lrWindow].States.Enabled.Index);
// Need to draw the window border?
if (borderVisible)
{
// Draw caption layer or top frame layer, then draw the left, right, and bottom frame layers.
renderer.DrawLayer(l1, new Rectangle(rect.Left, rect.Top, rect.Width, l1.Height), s1.Color, s1.Index);
renderer.DrawLayer(l2, new Rectangle(rect.Left, rect.Top + l1.Height, l2.Width, rect.Height - l1.Height - l4.Height), s2.Color, s2.Index);
renderer.DrawLayer(l3, new Rectangle(rect.Right - l3.Width, rect.Top + l1.Height, l3.Width, rect.Height - l1.Height - l4.Height), s3.Color, s3.Index);
renderer.DrawLayer(l4, new Rectangle(rect.Left, rect.Bottom - l4.Height, rect.Width, l4.Height), s4.Color, s4.Index);
// Draw the window icon if there is one and the window caption is displayed.
if (iconVisible && (icon != null || l5 != null) && captionVisible)
{
Texture2D i = (icon != null) ? icon : l5.Image.Resource;
renderer.Draw(i, GetIconRect(), Color.White);
}
int icosize = 0;
if (l5 != null && iconVisible && captionVisible)
{
icosize = l1.Height - l1.ContentMargins.Vertical + 4 + l5.OffsetX;
}
// Draw the close button if visible.
int closesize = 0;
if (btnClose.Visible)
{
closesize = btnClose.Width - (btnClose.Skin.Layers[lrButton].OffsetX);
}
// Create the rectangle defining the remaining caption area to draw text in.
Rectangle r = new Rectangle(rect.Left + l1.ContentMargins.Left + icosize,
rect.Top + l1.ContentMargins.Top,
rect.Width - l1.ContentMargins.Horizontal - closesize - icosize,
l1.Height - l1.ContentMargins.Top - l1.ContentMargins.Bottom);
int ox = l1.Text.OffsetX;
int oy = l1.Text.OffsetY;
// Draw the window title in the caption area remaining.
renderer.DrawString(f1, Text, r, c1, l1.Text.Alignment, ox, oy, true);
}
}
示例10: DrawControl
////////////////////////////////////////////////////////////////////////////
protected override void DrawControl(Renderer renderer, Rectangle rect, GameTime gameTime)
{
if (Left + Width > 1600)
Left = 1600 - Width;
if (Top + Height + 40 > 850)
Top = 850 - Height - 20;
rect.Width = Math.Max(rect.Width, rLine.Width + 20);
renderer.DrawLayer(this, Skin.Layers[0], rect);
if (lines != null)
{
int y = 5;
foreach (LineInfo line in lines)
{
// prepare bounding rect
rLine.X = rect.X + 5;
rLine.Y = rect.Y + y;
rLine.Height = line.LineHeight;
renderer.DrawString(this, Skin.Layers[0], line.StrippedText, rLine, true);
foreach (IconPosition icon in line.Icons)
renderer.Draw(_iconDict[icon.IconName], icon.Rect, Color.White);
foreach (LinkPosition link in line.Links)
renderer.DrawString(Skin.Layers[0].Text.Font.Resource, link.Link, link.Rect.X + 2, link.Rect.Y + y - 3, Color.DarkRed);
y += line.LineHeight;
}
}
}
示例11: DrawControl
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
protected override void DrawControl(Renderer renderer, Rectangle rect, GameTime gameTime)
{
SkinLayer layer = Skin.Layers[lrChecked];
SkinText font = Skin.Layers[lrChecked].Text;
if (!state)
{
layer = Skin.Layers[lrCheckBox];
font = Skin.Layers[lrCheckBox].Text;
}
rect.Width = layer.Width;
rect.Height = layer.Height;
Rectangle rc = new Rectangle(rect.Left + rect.Width + 4, rect.Y, Width - (layer.Width + 4), rect.Height);
renderer.DrawLayer(this, layer, rect);
renderer.DrawString(this, layer, Text, rc, false, 0, 0);
}
示例12: DrawControl
/// <summary>
/// Draws the group box control.
/// </summary>
/// <param name="renderer">Render management object.</param>
/// <param name="rect">Destination region where the group box should be drawn.</param>
/// <param name="gameTime">Snapshot of the application's timing values.</param>
protected override void DrawControl(Renderer renderer, Rectangle rect, GameTime gameTime)
{
SkinLayer layer = type == GroupBoxType.Normal ? Skin.Layers["Control"] : Skin.Layers["Flat"];
SpriteFont font = (layer.Text != null && layer.Text.Font != null) ? layer.Text.Font.Resource : null;
Color col = (layer.Text != null) ? layer.Text.Colors.Enabled : Color.White;
Point offset = new Point(layer.Text.OffsetX, layer.Text.OffsetY);
Vector2 size = font.MeasureString(Text);
size.Y = font.LineSpacing;
Rectangle r = new Rectangle(rect.Left, rect.Top + (int)(size.Y / 2), rect.Width, rect.Height - (int)(size.Y / 2));
renderer.DrawLayer(this, layer, r);
// Group box has header text to draw?
if (font != null && Text != null && Text != "")
{
Rectangle bg = new Rectangle(r.Left + offset.X, (r.Top - (int)(size.Y / 2)) + offset.Y, (int)size.X + layer.ContentMargins.Horizontal, (int)size.Y);
renderer.DrawLayer(Manager.Skin.Controls["Control"].Layers[0], bg, new Color(64, 64, 64), 0);
renderer.DrawString(this, layer, Text, new Rectangle(r.Left, r.Top - (int)(size.Y / 2), (int)(size.X), (int)size.Y), true, 0, 0, false);
}
}
示例13: DrawControl
/// <summary>
/// Draws the button control.
/// </summary>
/// <param name="renderer">Rendering management object.</param>
/// <param name="rect">Destination rectangle.</param>
/// <param name="gameTime">Snapshot of the application's timing values.</param>
protected override void DrawControl(Renderer renderer, Rectangle rect, GameTime gameTime)
{
// Toggle button in pressed state?
if (mode == ButtonMode.PushButton && pushed)
{
SkinLayer l = Skin.Layers[lrButton];
renderer.DrawLayer(l, rect, l.States.Pressed.Color, l.States.Pressed.Index);
// Does the layer's pressed state have an overlay?
if (l.States.Pressed.Overlay)
{
// Draw the overlay on top of the button.
renderer.DrawLayer(l, rect, l.Overlays.Pressed.Color, l.Overlays.Pressed.Index);
}
}
else
{
// Standard button. ButtonBase can handle drawing.
base.DrawControl(renderer, rect, gameTime);
}
SkinLayer layer = Skin.Layers[lrButton];
SpriteFont font = (layer.Text != null && layer.Text.Font != null) ? layer.Text.Font.Resource : null;
Color col = Color.White;
int ox = 0; int oy = 0;
// Standard button pressed?
if (ControlState == ControlState.Pressed)
{
if (layer.Text != null) col = layer.Text.Colors.Pressed;
ox = 1; oy = 1;
}
// Button has an image to apply?
if (glyph != null)
{
// Draw the button image.
Margins cont = layer.ContentMargins;
Rectangle r = new Rectangle(rect.Left + cont.Left,
rect.Top + cont.Top,
rect.Width - cont.Horizontal,
rect.Height - cont.Vertical);
renderer.DrawGlyph(glyph, r);
}
else
{
// Draw the button text.
renderer.DrawString(this, layer, Text, rect, true, ox, oy);
}
}
示例14: DrawControl
/// <summary>
/// Draws the checkbox control.
/// </summary>
/// <param name="renderer">Render management object.</param>
/// <param name="rect">Destination rectangle.</param>
/// <param name="gameTime">Snapshot of the application's timing values.</param>
protected override void DrawControl(Renderer renderer, Rectangle rect, GameTime gameTime)
{
// Grab the checked skin layer and skin font.
SkinLayer layer = Skin.Layers[lrChecked];
SkinText font = Skin.Layers[lrChecked].Text;
// Umm. See if we actually need the unchecked layer and font...
if (!state)
{
layer = Skin.Layers[lrCheckBox];
font = Skin.Layers[lrCheckBox].Text;
}
rect.Width = layer.Width;
rect.Height = layer.Height;
Rectangle rc = new Rectangle(rect.Left + rect.Width + 4, rect.Y, Width - (layer.Width + 4), rect.Height);
renderer.DrawLayer(this, layer, rect);
renderer.DrawString(this, layer, Text, rc, false, 0, 0);
}
示例15: DrawControl
protected override void DrawControl(Renderer renderer, Rectangle rect, GameTime gameTime)
{
//Draw Base Control
//base.DrawControl(renderer, rect, gameTime);
Color FontColor = Color.White;
//Set Display based on ControlState
if (ControlState == ControlState.Hovered) m_InfoVisible = true;
else m_InfoVisible = false;
if (m_Highlight) FontColor = Color.Gold;
else FontColor = Color.White;
//Set offset based on state
Rectangle Rect = new Rectangle(rect.X, rect.Y, rect.Width, rect.Height);
if (ControlState == ControlState.Pressed) {
Rect.X += 4; Rect.Y += 4;
}
//Draw Button
renderer.Draw(m_ButtonTexture, Rect, Color.White);
//Draw Information
Rectangle HeroRect = new Rectangle(Rect.X + 20, Rect.Y + 20, Global.HEROBUTTON_IMAGEWIDTH, Global.HEROBUTTON_IMAGEHEIGHT);
renderer.Draw(m_HeroImage, HeroRect, Color.White);
renderer.DrawString(m_Font, Text, HeroRect.X + 135, HeroRect.Y, FontColor);
if (m_InfoVisible || m_Highlight) renderer.DrawString(m_DescFont, m_Info, HeroRect.X + 156, HeroRect.Y + 30, FontColor);
//Draw Overlay
if (ControlState == ControlState.Hovered || m_Highlight) renderer.Draw(m_Layer, Rect, Color.White);
}