本文整理汇总了C#中SdlDotNet类的典型用法代码示例。如果您正苦于以下问题:C# SdlDotNet类的具体用法?C# SdlDotNet怎么用?C# SdlDotNet使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SdlDotNet类属于命名空间,在下文中一共展示了SdlDotNet类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Draw
public void Draw(SdlDotNet.Graphics.Surface video)
{
foreach (Hero h in GameObjects)
{
h.Draw(video);
}
foreach (Enemy v in Vijanden)
{
v.Draw(video);
}
foreach (Grass g in GrassObjects)
{
g.Draw(video);
}
foreach (LifeItem l in LifeObjects)
{
l.Draw(video);
}
foreach (MetalBlock m in MetalObjects)
{
m.Draw(video);
}
foreach (NextLevelDoor n in NextLevelObjects)
{
n.Draw(video);
}
}
示例2: TextSprite
/// <summary>
/// Creates a new TextSprite given the text, font, color and anti-aliasing flag.
/// </summary>
/// <param name="textItem">Text to display</param>
/// <param name="font">The font to use when rendering.</param>
/// <param name="color">Color of Text</param>
/// <param name="antiAlias">A flag determining if it's to
/// use anti-aliasing when rendering. Defaults to true.</param>
public TextSprite(
string textItem,
SdlDotNet.Graphics.Font font,
Color color, bool antiAlias)
: this(textItem, font, color, antiAlias, new Point(0, 0))
{
}
示例3: TextSprite
/// <summary>
/// Creates a new TextSprite given the text, font and color.
/// </summary>
/// <param name="textItem">Text to display</param>
/// <param name="font">The font to use when rendering.</param>
/// <param name="color">color of Text</param>
public TextSprite(
string textItem,
SdlDotNet.Graphics.Font font,
Color color)
: this(textItem, font, color, true)
{
}
示例4: CombineImage
/// <summary>
/// Combines two surfaces together.
/// </summary>
/// <param name="bottomImage">The surface that will be used as the background.</param>
/// <param name="topImage">The surface that will be used as the foreground.</param>
/// <returns>The combined surface.</returns>
public static SdlDotNet.Graphics.Surface CombineImage(SdlDotNet.Graphics.Surface bottomImage, SdlDotNet.Graphics.Surface topImage)
{
SdlDotNet.Graphics.Surface returnSurf = new SdlDotNet.Graphics.Surface(new System.Drawing.Size(System.Math.Max(bottomImage.Width, topImage.Width), System.Math.Max(bottomImage.Height, topImage.Height)));
returnSurf.Blit(bottomImage, new System.Drawing.Point(0, 0));
returnSurf.Blit(topImage, new System.Drawing.Point(0, 0));
return returnSurf;
}
示例5: onKeyboard
// this procedure is called when a key is pressed or released
static void onKeyboard(object sender, SdlDotNet.Input.KeyboardEventArgs args) {
if (args.Down) {
switch (args.Key) {
case SdlDotNet.Input.Key.W:
ship.forward = !ship.forward;
break;
case SdlDotNet.Input.Key.D :
ship.rotation-= ship.TURNING_SPEED;
break;
case SdlDotNet.Input.Key.A :
ship.rotation+= ship.TURNING_SPEED;
break;
case SdlDotNet.Input.Key.Escape :
Events.QuitApplication();
break;
}
} else {
switch (args.Key) {
case SdlDotNet.Input.Key.W:
ship.forward = !ship.forward;
break;
case SdlDotNet.Input.Key.D:
case SdlDotNet.Input.Key.A:
ship.rotation = 0;
break;
}
}
}
示例6: Events_KeyboardDown
private void Events_KeyboardDown(object sender, SdlDotNet.Input.KeyboardEventArgs e)
{
if (e.Key == links)
left = true;
if (e.Key == rechts)
right = true;
}
示例7: SdlDotNet_Core_Events_Tick
public static void SdlDotNet_Core_Events_Tick(object sender, SdlDotNet.Core.TickEventArgs e)
{
// Only redraw the window if it isn't minimized
//if (SdlDotNet.Graphics.Video.IsActive) {
try {
if (Skins.SkinManager.ScreenBackground != null && Globals.InGame == false) {
SdlDotNet.Graphics.Video.Screen.Blit(Skins.SkinManager.ScreenBackground, new Point(0, 0));
} else {
if (Skins.SkinManager.ActiveSkin.IngameBackground != null) {
SdlDotNet.Graphics.Video.Screen.Blit(Skins.SkinManager.ActiveSkin.IngameBackground, new Point(0, 0));
} else {
SdlDotNet.Graphics.Video.Screen.Fill(Color.SteelBlue);
}
}
} catch {
SdlDotNet.Graphics.Video.Screen.Fill(Color.SteelBlue);
}
//try {
// Check if the FPS isn't something absurd
//if (!(SdlDotNet.Core.Events.Fps < 10 || SdlDotNet.Core.Events.Fps > Constants.FRAME_RATE + 10)) {
SdlDotNet.Widgets.WindowManager.DrawWindows(e);
//} catch { }
//}
//if (Graphics.FontManager.GameFont != null) {
// SdlDotNet.Graphics.Video.Screen.Blit(Graphics.FontManager.GameFont.Render("FPS: " + SdlDotNet.Core.Events.Fps.ToString(), Color.Black), new Point(0, 0));
//}
SdlDotNet.Graphics.Video.Update();
//} else {
// // Game window isn't active
//}
}
示例8: Events_KeyboardDown
void Events_KeyboardDown(object sender, SdlDotNet.Input.KeyboardEventArgs e)
{
if (e.Key == Key.Escape || e.Key == Key.Q)
{
Events.QuitApplication();
}
}
示例9: TextboxLine
public TextboxLine(int maxWidth, SdlDotNet.Graphics.Font font, Color defaultForeColor)
{
mMaxWidth = maxWidth;
mChars = new List<TextBoxChar>();
mFont = font;
mDefaultForeColor = defaultForeColor;
}
示例10: TextItem
/// <summary>
///
/// </summary>
/// <param name="font"></param>
/// <param name="positionY"></param>
/// <param name="phrase"></param>
/// <param name="startTime"></param>
public TextItem(string phrase, SdlDotNet.Graphics.Font font, int positionY, float startTime)
: base(phrase, font, false, new Point(25, positionY))
{
base.Surface.Alpha = 0;
base.Surface.AlphaBlending = true;
this.startTime = startTime;
}
示例11: ZX
private string View; // View = XY, ZY or ZX (Front,Left or Top)
#endregion Fields
#region Constructors
public View2D(SdlDotNet.Windows.SurfaceControl Control, string View, object _blocks, object _items, int _gridsize, object _layers)
{
this.View = View;
this.Control = Control;
this.layerStatus = (bool[])_layers;
this.Surf = new Surface(this.Control.Width, this.Control.Height);
this.GridSurf = new Surface(this.Control.Width, this.Control.Height);
this.BlockSurf = new Surface(this.Control.Width, this.Control.Height);
this.TempSurf = new Surface(this.Control.Width, this.Control.Height);
this.GridSize = _gridsize;
this.blocks = _blocks;
this.items = _items;
SdlDotNet.Core.Events.Tick += new EventHandler<TickEventArgs>(OnTick);
this.levelSize = 256;
this.scrollLocalX = this.levelSize*this.GridSize/2;
this.scrollLocalY = this.levelSize*this.GridSize/ 2;
this.UpdateGrid();
this.UpdateBlocks();
this.UpdateTemp();
}
示例12: power
public override void power(SdlDotNet.Input.KeyboardEventArgs args)
{
if (args.Key == SdlDotNet.Input.Key.Space)
Console.WriteLine("Pang, pang ...");
theHero.power(args);
}
示例13: Events_MouseButtonDown
void Events_MouseButtonDown(object sender, SdlDotNet.Input.MouseButtonEventArgs e)
{
if (e.ButtonPressed)
{
shoot = true;
}
}
示例14: Draw
public override void Draw(SdlDotNet.Graphics.Surface screen)
{
// Draw the title
titleTextSprite.X = 20;
titleTextSprite.Y = _BaseY;
titleTextSprite.Color = Color.Yellow;
titleTextSprite.Text = this.Name;
screen.Blit(titleTextSprite);
int item_y = _BaseY + _SpaceBetweenItems + 20;
// Draw the lines
for (int i = 0; i < Lines.Length; i++)
{
lineTextSprite.X = 20;
lineTextSprite.Y = item_y;
lineTextSprite.Color = Color.White;
lineTextSprite.Text = Lines[i];
screen.Blit(lineTextSprite);
item_y += 15;
}
// Draw the item
itemTextSprite.X = 20;
itemTextSprite.Y = screen.Height - 40;
itemTextSprite.Color = Color.LightYellow;
itemTextSprite.Text = Items[0].Text;
screen.Blit(itemTextSprite);
}
示例15: BoundedTextSprite
/// <summary>
///
/// </summary>
/// <param name="textItem"></param>
/// <param name="font"></param>
/// <param name="size"></param>
/// <param name="coordinates"></param>
public BoundedTextSprite(
string textItem,
SdlDotNet.Graphics.Font font,
Point coordinates)
: base(textItem, font, coordinates)
{
}