本文整理汇总了C#中SdlDotNet.Graphics.Surface类的典型用法代码示例。如果您正苦于以下问题:C# Surface类的具体用法?C# Surface怎么用?C# Surface使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Surface类属于SdlDotNet.Graphics命名空间,在下文中一共展示了Surface类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SceneGameOver
public SceneGameOver()
{
sceneType = SceneType.GameOver;
_menuItems = new MenuItem[]
{
new MenuItem(Key.R, Properties.Resources.MenuItem_RetryStage),
new MenuItem(Key.M, Properties.Resources.MenuItem_MapSelect),
new MenuItem(Key.T, Properties.Resources.MenuItem_ReturnTitle)
};
_keys = new Key[]
{
Key.UpArrow, Key.DownArrow, Key.Return, Key.Escape,
Key.M, Key.R, Key.T
};
_cursor = ResourceManager.GetColoredCursorGraphic(_foreColor);
_overImgSurface = ResourceManager.LoadSurface(Constants.Filename_GameoverImage);
ImageUtil.SetColor(_overImgSurface, _foreColor);
_menuSurfaces = new SurfaceCollection();
_menuRects = new Rectangle[_menuItems.Length];
ImageUtil.CreateStrMenu(_menuItems, _foreColor, ref _menuSurfaces, ref _menuRects, Constants.ScreenWidth);
}
示例2: VictoryArea
/// <summary>
/// Initializes a new instance of the VictoryArea class.
/// </summary>
/// <param name="area">Area of victory zone</param>
public VictoryArea(Rectangle area, Context context)
: base(area)
{
this.UpperLeft = new Point(area.Left, area.Top);
this.Area = area;
Surface toFill = new Surface(new Size(32, 32));
int x = 0;
int y = 0;
// Get left upper corner
TileManager.FromTilemap(toFill, "003-G_Ground01.png", 0 * toFill.Width, 1 * toFill.Height);
this.Blit(toFill);
// Upper separation of victory zone
TileManager.FromTilemap(toFill, "003-G_Ground01.png", 1 * toFill.Width, 1 * toFill.Height);
x += toFill.Width;
while (x < this.Width)
{
this.Blit(toFill, new Point(x, 0));
x += toFill.Width;
}
// Left separation of victory zone
TileManager.FromTilemap(toFill, "003-G_Ground01.png", 0 * toFill.Width, 2 * toFill.Height);
y += toFill.Height;
while (y < this.Height)
{
this.Blit(toFill, new Point(0, y));
y += toFill.Height;
}
// Center of the victory zone
TileManager.FromTilemap(toFill, "003-G_Ground01.png", 2 * toFill.Width, 2 * toFill.Height);
x = toFill.Width;
y = toFill.Height;
while (x < this.Width)
{
while (y < this.Height)
{
this.Blit(toFill, new Point(x, y));
y += toFill.Height;
}
x += toFill.Width;
}
// Get left lower corner
TileManager.FromTilemap(toFill, "003-G_Ground01.png", 0 * toFill.Width, 3 * toFill.Height);
this.Blit(toFill, new Point(0, this.Height - toFill.Height));
// Lower separation of victory zone
TileManager.FromTilemap(toFill, "003-G_Ground01.png", 1 * toFill.Width, 3 * toFill.Height);
x += toFill.Width;
while (x < this.Width)
{
this.Blit(toFill, new Point(x, this.Height - toFill.Height));
x += toFill.Width;
}
}
示例3: release
private void release()
{
if (_prevSurface != null) _prevSurface.Dispose();
if (_errorMessageSurface != null) foreach (Surface s in _errorMessageSurface) s.Dispose();
_prevSurface = null;
_errorMessageSurface = null;
}
示例4: Go
/// <summary>
///
/// </summary>
public void Go()
{
if (File.Exists(fileName))
{
filePath = "";
fileDirectory = "";
}
else if (File.Exists(Path.Combine(fileDirectory, fileName)))
{
filePath = "";
}
string file = Path.Combine(Path.Combine(filePath, fileDirectory), fileName);
Events.Tick +=
new EventHandler<TickEventArgs>(Events_TickEvent);
Events.KeyboardDown +=
new EventHandler<KeyboardEventArgs>(this.KeyboardDown);
Events.Quit += new EventHandler<QuitEventArgs>(this.Quit);
font = new SdlDotNet.Graphics.Font(file, size);
Video.WindowIcon();
Video.WindowCaption = "SDL.NET - Font Example";
screen = Video.SetVideoMode(width, height, true);
Surface surf = screen.CreateCompatibleSurface(width, height, true);
surf.Fill(new Rectangle(new Point(0, 0), surf.Size), Color.Black);
Events.Run();
}
示例5: MapDrawer
public MapDrawer(Surface Screen)
{
MapX = 100;
MapY = 100;
WindowsScreen = Screen;
}
示例6: Main
public static void Main(string[] args)
{
Events.Quit += new EventHandler<QuitEventArgs>(ApplicationQuitEventHandler);
Surface plate = Video.SetVideoMode(220, 220, 32, false, false, false, true);
Surface pic = new Surface("nyanbig.png");
pic.Update();
Population fellows = new Population(15, 100);
List<float> fitnesses;
while (fellows.members[0].fitness < 700f)
{
fitnesses = new List<float>();
foreach (Genome g in fellows.members)
{
g.Draw(plate);
Console.Read();
float f = g.GetFitness(plate, pic);
fitnesses.Add(f);
g.fitness = f;
}
fellows.members.Sort();
fellows.members[0].Draw(plate);
Console.WriteLine(fellows.members[0].fitness);
int x = 0;
}
}
示例7: Sprite
public Sprite(Surface surface2)
{
this.surface = surface2;
texture = new SurfaceGl(surface, true);
texture.WrapS = WrapOption.Clamp;
texture.WrapT = WrapOption.Clamp;
//texture.MagFilter = MagnificationOption.GL_LINEAR;
//texture.MinFilter = MinifyingOption.GL_LINEAR_MIPMAP_LINEAR;
int blank = surface.TransparentColor.ToArgb();
bool[,] bitmap = new bool[surface.Width, surface.Height];
Color[,] pixels = surface.GetColors(new System.Drawing.Rectangle(0, 0, surface.Width, surface.Height));
for (int x = 0; x < bitmap.GetLength(0); ++x)
{
for (int y = 0; y < bitmap.GetLength(1); ++y)
{
bitmap[x, y] = !(pixels[x, y].A == 0 || pixels[x, y].ToArgb() == blank);
}
}
vertexes = VertexHelper.CreateRangeFromBitmap(bitmap);
Console.WriteLine("Before {0}", GetCount);
vertexes = VertexHelper.ReduceRange(vertexes, 1);
vertexes = VertexHelper.ReduceRange(vertexes, 2);
vertexes = VertexHelper.ReduceRange(vertexes, 3);
Console.WriteLine("After {0}", GetCount);
vertexes = VertexHelper.SubdivideRange(vertexes, 10);
Console.WriteLine("Subdivide {0}", GetCount);
offset = VertexHelper.GetCentroidOfRange(vertexes);
vertexes = VertexHelper.CenterVertexesRange(vertexes);
}
示例8: 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();
}
示例9: Enemy
public Enemy(int x, int y,bool moveright, bool moveleft)
{
try
{
Image = new Surface("Enemy_CommanderKeen_rechts.png");
ImageLeft = new Surface("Enemy_CommanderKeen_links.png");
ImageRight = new Surface("Enemy_CommanderKeen_rechts.png");
}
catch (Exception error)
{
Console.WriteLine(error);
}
Position = new Point(x, y);
ShowPartImage = new Rectangle(0, 0,55,71 );
BeginPositie = Position.X;
Collisionrectangle = new Rectangle(Position.X, Position.Y, 55, 71);
Leftcollisionrectangle = new Rectangle(Position.X, Position.Y, 3, 71);
Rightcollisionrectangle = new Rectangle((Position.X + 55), Position.Y, 3, 71);
Uppercollisionrectangle = new Rectangle(Position.X, Position.Y, 55, 3);
Lowercollisionrectangle = new Rectangle(Position.X, (Position.Y + 71), 55, 3);
MoveLeft = moveleft;
MoveRight = moveright;
}
示例10: Texture
public Texture(Surface surface)
{
this.surface = surface;
//this.surface.AlphaBlending = true;
//this.Alpha = 255;
}
示例11: Draw
public override void Draw(Surface s, uint chip, Rectangle r, ChipResizeMethod m)
{
if (chip != 0)
{
s.Fill(r, _foreColor);
}
}
示例12: Dialogs
public Dialogs(Game game)
{
this.game = game;
PropertyReader props = game.loader.GetPropertyReader().Select("dialog/dialog.xml");
Border = props.GetInt("border");
string fontName = props.GetString("font");
int fontSize = props.GetInt("fontsize");
Font = new SdlDotNet.Graphics.Font(game.loader.LoadRaw("dialog/" + fontName), fontSize);
bgColor = Color.FromArgb(
props.GetInt("background/alpha"),
props.GetInt("background/red"),
props.GetInt("background/green"),
props.GetInt("background/blue"));
selectedBorder = Color.FromArgb(
props.GetInt("selectedborder/alpha"),
props.GetInt("selectedborder/red"),
props.GetInt("selectedborder/green"),
props.GetInt("selectedborder/blue"));
selectedBg = Color.FromArgb(
props.GetInt("selectedbackground/alpha"),
props.GetInt("selectedbackground/red"),
props.GetInt("selectedbackground/green"),
props.GetInt("selectedbackground/blue"));
TextHeight = Font.SizeText(" ").Height;
surface = new Surface(game.loader.LoadBitmap("dialog/windowborder.png"));
}
示例13: Initialize
public static void Initialize()
{
activeAnimations = new List<Moves.IMoveAnimation>();
srfcMoveTargetTile = new Surface(Constants.TILE_WIDTH, Constants.TILE_HEIGHT);
srfcMoveTargetTile.Blit(GraphicsManager.Tiles[10][77], new Point(0, 0));
srfcMoveTargetTile.Transparent = true;
//srfcMoveTargetTile.Alpha = 150;
//srfcMoveTargetTile.AlphaBlending = true;
srfcMoveTargetTileHit = new Surface(Constants.TILE_WIDTH, Constants.TILE_HEIGHT);
srfcMoveTargetTileHit.Blit(GraphicsManager.Tiles[10][91], new Point(0,0));
srfcMoveTargetTileHit.Transparent = true;
//srfcMoveTargetTileHit.Alpha = 150;
//srfcMoveTargetTileHit.AlphaBlending = true;
srfcMoveTargetTileDark = new Surface(Constants.TILE_WIDTH, Constants.TILE_HEIGHT);
srfcMoveTargetTileDark.Blit(GraphicsManager.Tiles[10][105], new Point(0, 0));
srfcMoveTargetTileDark.Transparent = true;
srfcMoveTargetUnknown = new Surface(Constants.TILE_WIDTH * 3, Constants.TILE_HEIGHT * 3);
for (int i = 0; i < 9; i++)
{
srfcMoveTargetUnknown.Blit(GraphicsManager.Tiles[10][8 + i % 3 + i / 3 * 14], new Point(i % 3 * Constants.TILE_WIDTH, i / 3 * Constants.TILE_HEIGHT));
}
srfcMoveTargetUnknown.Transparent = true;
srfcMoveTargetUnknown.Alpha = 150;
srfcMoveTargetUnknown.AlphaBlending = true;
}
示例14: UpdateSurfaces
public void UpdateSurfaces()
{
mButtonUpBounds = new Rectangle(0, 0, this.Width, 25);
mScrollBackgroundBounds = new Rectangle(0, mButtonUpBounds.Height, this.Width, this.Height - (mButtonUpBounds.Height * 2));
mButtonDownBounds = new Rectangle(0, mButtonUpBounds.Height + mScrollBackgroundBounds.Height, this.Width, mButtonUpBounds.Height);
mScrollBarBounds = new Rectangle(0, mButtonUpBounds.Height, this.Width, (this.mMaximum / this.mValue) * 25);
mBackground = new SdlDotNet.Graphics.Surface(this.Size);
mButtonSurface = new SdlDotNet.Graphics.Surface(mButtonUpBounds.Size);
mScrollbarBackgroundSurface = new SdlDotNet.Graphics.Surface(mScrollBackgroundBounds.Size);
mScrollbarSurface = new SdlDotNet.Graphics.Surface(mScrollBarBounds.Size);
mScrollbarSurface.Fill(Color.Transparent);
//mScrollbarSurface.Transparent = true;
mButtonSurface.Fill(mForecolor);
Gfx.Primitives.Box border = new SdlDotNet.Graphics.Primitives.Box(new Point(0, 0), new Size(mScrollBackgroundBounds.Width - 2, mScrollBackgroundBounds.Height - 1));
mScrollbarBackgroundSurface.Draw(border, Color.Blue);
Gfx.Primitives.Box border2 = new SdlDotNet.Graphics.Primitives.Box(new Point(0, 0), new Size(mScrollbarSurface.Width - 2, mScrollbarSurface.Height - 2));
mScrollbarSurface.Draw(border, Color.Red);
mBackground.Blit(mButtonSurface);
mBackground.Blit(mScrollbarBackgroundSurface, new Point(0, mButtonSurface.Height));
mBackground.Blit(mScrollbarSurface, new Point(0, mButtonSurface.Height));
mBackground.Blit(mButtonSurface, new Point(0, mButtonSurface.Height + mScrollbarBackgroundSurface.Height));
}
示例15: Init
private void Init()
{
mBackgroundSurf = new SdlDotNet.Graphics.Surface(IO.IO.CreateOSPath("Skins\\" + Globals.ActiveSkin + "\\General\\TaskBar\\taskbarbutton.png"));
if (mWindow.TaskBarText != "") {
Gfx.Font font = Logic.Graphics.FontManager.LoadFont("tahoma", 12);
Gfx.Surface textSurf = font.Render(mWindow.TaskBarText, Color.White);
//textSurf = textSurf.CreateStretchedSurface(new Size(130, 12));
mBackgroundSurf.Blit(textSurf, GetCenter(mBackgroundSurf, textSurf.Size), new Rectangle(0, 0, 125, 14));
string stateString = "?";
switch (mWindow.WindowState) {
case Client.Logic.Windows.WindowManager.WindowState.Normal:
stateString = "^";
break;
case Client.Logic.Windows.WindowManager.WindowState.Minimized:
stateString = "v";
break;
case Client.Logic.Windows.WindowManager.WindowState.Maximized:
stateString = "[]";
break;
}
mBackgroundSurf.Blit(font.Render(stateString, Color.White), new Point(this.Width - font.SizeText(stateString).Width - 1, 0));
font.Close();
}
base.Buffer.Blit(mBackgroundSurf, new Point(0, 0));
}