本文整理汇总了C#中TomShane.Neoforce.Controls.Renderer类的典型用法代码示例。如果您正苦于以下问题:C# Renderer类的具体用法?C# Renderer怎么用?C# Renderer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Renderer类属于TomShane.Neoforce.Controls命名空间,在下文中一共展示了Renderer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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);
}
示例2: DrawControl
protected override void DrawControl(Renderer renderer,
Rectangle rect, GameTime gameTime)
{
this.Left = this.Left - this.Width; // Eeeeeeeeh?
this.Top = this.Top - this.Height; // Eeeeeeeeh!
// As with the panning in TilemapBar I have no idea of what happens in Neoforce...
// ...but hey, at least I made it work!
base.DrawControl(renderer, rect, gameTime);
}
示例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 time)
{
//Draw the lifebar
renderer.Draw(m_BarImage, rect, Color.White);
//For each life
for (int i = 0; i < m_Life; i++) {
//Calculate position
Rectangle LifeRect = new Rectangle(rect.Left, rect.Top, m_LifeImage.Width, m_LifeImage.Height);
LifeRect.X += Global.LIFE_X + (i * (m_LifeImage.Width - 2));
LifeRect.Y += Global.LIFE_Y;
//Draw it
renderer.Draw(m_LifeImage, LifeRect, Color.White);
}
}
示例7: DrawControl
protected override void DrawControl(Renderer renderer, Rectangle rect, GameTime gameTime)
{
_policyRect.X = rect.X;
_policyRect.Y = rect.Y;
if (Policy != null)
{
if (MainWindow.Game.Human.Policies.Contains(Policy))
renderer.Draw(_button44gold, _policyRect, Color.White);
else if (MainWindow.Game.Human.PoliciesInReach.Contains(Policy))
renderer.Draw(_button44, _policyRect, Color.Gray);
else
renderer.Draw(_button44, _policyRect, Color.White);
renderer.Draw(Policy.Image, _policyRect, Color.White);
}
}
示例8: Render
public override void Render(Renderer renderer, GameTime gameTime)
{
if (_backgroundBuffer == null)
UpdateBackground(Width, Height);
// if buffer is still empty, something wrong
if (_backgroundBuffer == null)
return;
base.Render(renderer, gameTime);
if (Visible)
{
renderer.Begin(BlendingMode.Default);
renderer.Draw(_backgroundBuffer, this.AbsoluteRect, AlphaColor);
renderer.End();
}
}
示例9: 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);
}
示例10: 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);
}
}
示例11: DrawControl
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
protected override void DrawControl(Renderer renderer, Rectangle rect, GameTime gameTime)
{
// We draw the control the same way the ancestor does.
// In this case, ancestor draws all states automatically according to description in the skin file.
base.DrawControl(renderer, rect, gameTime);
//SkinLayer layer = Skin.Layers[lrButton];
//int ox = 0; int oy = 0;
//// We want to have the text pushed a bit down, when we press the button
//if (ControlState == ControlState.Pressed)
//{
// ox = 1; oy = 1;
//}
//// Now we draw text over our control. This method does it automatically,
//// based on the description in the skin file.
//// We use our pressed-state offset for text position.
//renderer.DrawString(this, layer, Text, rect, true, ox, oy);
}
示例12: 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 );
}
}
示例13: DrawControl
protected override void DrawControl(Renderer renderer, Rectangle rect, GameTime gameTime)
{
if (_buffer == null)
UpdateBackground(rect.Width, rect.Height);
// if buffer is still empty, something wrong
if (_buffer == null)
return;
// completely transparent, don't draw anything
if (Alpha == 0)
return;
if (Enabled)
{
if (Hovered)
renderer.Draw(_bufferGlow, rect, AlphaColor);
else
renderer.Draw(_buffer, rect, AlphaColor);
}
else
renderer.Draw(_bufferDisabled, rect, AlphaColor);
}
示例14: DrawControl
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
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];
renderer.DrawLayer(this, l1, rect, ControlState.Enabled);
int prev = l1.ContentMargins.Left;
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;
if (ItemIndex != i)
{
if (mi.Enabled && Enabled)
{
renderer.DrawString(this, l1, mi.Text, rs[i], ControlState.Enabled, false);
}
else
{
renderer.DrawString(this, l1, mi.Text, rs[i], ControlState.Disabled, false);
}
}
else
{
if (Items[i].Enabled && Enabled)
{
renderer.DrawLayer(this, l2, rs[i], ControlState.Enabled);
renderer.DrawString(this, l2, mi.Text, rs[i], ControlState.Enabled, false);
}
else
{
renderer.DrawLayer(this, l2, rs[i], ControlState.Disabled);
renderer.DrawString(this, l2, mi.Text, rs[i], ControlState.Disabled, false);
}
}
}
}
示例15: DrawControl
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
protected override void DrawControl(Renderer renderer, Rectangle rect, GameTime gameTime)
{
RecalcParams();
SkinLayer p = Skin.Layers["Control"];
SkinLayer l = Skin.Layers["Scale"];
float ratio = 0.66f;
int h = (int)(ratio * rect.Height);
int t = rect.Top + (Height - h) / 2;
float px = ((float)value / (float)range);
int w = (int)Math.Ceiling(px * (rect.Width - p.ContentMargins.Horizontal - btnSlider.Width)) + 2;
if (w < l.SizingMargins.Vertical) w = l.SizingMargins.Vertical;
if (w > rect.Width - p.ContentMargins.Horizontal) w = rect.Width - p.ContentMargins.Horizontal;
Rectangle r1 = new Rectangle(rect.Left + p.ContentMargins.Left, t + p.ContentMargins.Top, w, h - p.ContentMargins.Vertical);
base.DrawControl(renderer, new Rectangle(rect.Left, t, rect.Width, h), gameTime);
if (scale) renderer.DrawLayer(this, l, r1);
}