本文整理汇总了C#中SFML.Graphics.Sprite.Dispose方法的典型用法代码示例。如果您正苦于以下问题:C# Sprite.Dispose方法的具体用法?C# Sprite.Dispose怎么用?C# Sprite.Dispose使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SFML.Graphics.Sprite
的用法示例。
在下文中一共展示了Sprite.Dispose方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateShadows
public static bool CreateShadows()
{
Image img = spriteSheet.Texture.CopyToImage();
for (uint k = 0; k < img.Size.X; k++)
for (uint j = 0; j < img.Size.Y; j++)
{
Color c = img.GetPixel(k, j);
if (c.A == 255)
{
Color d = new Color();
d.A = 40;
d.R = d.G = d.B = 0;
img.SetPixel(k, j, d);
}
}
Texture tex = new Texture(img);
Sprite tempsprite = new Sprite();
tempsprite.Texture = tex;
shadowSpriteSheet = new RenderTexture(textureSize, textureSize);
shadowSpriteSheet.Draw(tempsprite);
shadowSpriteSheet.Display();
shadowSprite.Texture = shadowSpriteSheet.Texture;
img.Dispose();
tempsprite.Dispose();
tex.Dispose();
return true;
}
示例2: Draw
public void Draw(RenderTarget t)
{
t.Clear(new Color(65, 64, 60));
btnAddRoom.Draw(t, cursorMode == CursorMode.AddRoom);
btnAddDoor.Draw(t, cursorMode == CursorMode.AddDoor);
//btnLoad.Draw(t, false);
btnLoadBase.Draw(t, false);
btnLoadFloor.Draw(t, false);
btnOptions.Draw(t, false);
if (BaseTex != null)
btnToggleBase.Draw(t, drawBase);
if (FloorTex != null)
btnToggleFloor.Draw(t, drawFloor);
if (BaseTex != null || FloorTex != null)
btnMoveBG.Draw(t, cursorMode == CursorMode.PlaceBGCursor || cursorMode == CursorMode.PlacedBGCursor);
btnMoveGibs.Draw(t, cursorMode == CursorMode.PlaceGibsCursor || cursorMode == CursorMode.PlacedGibsCursor);
placeRoomCloaking.Draw(t, false);
placeRoomDoors.Draw(t, false);
placeRoomDrones.Draw(t, false);
placeRoomEngines.Draw(t, false);
placeRoomMedbay.Draw(t, false);
placeRoomOxygen.Draw(t, false);
placeRoomPilot.Draw(t, false);
placeRoomSensors.Draw(t, false);
placeRoomShields.Draw(t, false);
placeRoomTeleporter.Draw(t, false);
placeRoomWeapons.Draw(t, false);
if (BaseTex != null && drawBase)
{
BaseTex.Position = bgOffset + (new Vector2f(Game.ship.LayoutData.X_OFFSET, Game.ship.LayoutData.Y_OFFSET) * 35);
BaseTex.Draw(t, RenderStates.Default);
}
if (FloorTex != null && drawFloor)
{
FloorTex.Position = bgOffset + (new Vector2f(Game.ship.LayoutData.X_OFFSET, Game.ship.LayoutData.Y_OFFSET) * 35);
FloorTex.Draw(t, RenderStates.Default);
}
// Draw grid
foreach (FTLRoom room in ShipRooms)
t.Draw(room.drawer);
foreach (FTLDoor door in ShipDoors)
t.Draw(door.drawer);
for (int currentY = 1; currentY < 600; currentY += 35)
{
verts[0].Position = new Vector2f(0, currentY);
verts[1].Position = new Vector2f(GUIStartX, currentY);
t.Draw(verts, PrimitiveType.Lines);
}
for (int currentX = 0; currentX < GUIStartX; currentX += 35)
{
verts[0].Position = new Vector2f(currentX, 0);
verts[1].Position = new Vector2f(currentX, 600);
t.Draw(verts, PrimitiveType.Lines);
}
if (ship != null)
foreach (RoomFunc rf in ship.rooms.Values)
{
if (rf == null || rf.location == null)
continue;
Sprite temp = new Sprite(rf.image);
temp.Position = new Vector2f((rf.location.position.X + (((float)rf.location.size.X - 1) / 2)) * 35, (rf.location.position.Y + (((float)rf.location.size.Y - 1) / 2)) * 35);
temp.Position += (new Vector2f(Game.ship.LayoutData.X_OFFSET, Game.ship.LayoutData.Y_OFFSET) * 35);
t.Draw(temp);
temp.Dispose();
}
ViewOffsetter.Draw(t, rs);
if (cursorMode == CursorMode.AddDoor)
{
RectangleShape curDoor;
if (DoorHorizontal)
{
curDoor = new RectangleShape(new Vector2f(19, 4));
curDoor.Position = new Vector2f((SFML.Window.Mouse.GetPosition(Program.app).X / 35) * 35 + 7, (SFML.Window.Mouse.GetPosition(Program.app).Y / 35) * 35 - 2);
}
else
{
curDoor = new RectangleShape(new Vector2f(4, 19));
curDoor.Position = new Vector2f((SFML.Window.Mouse.GetPosition(Program.app).X / 35) * 35 - 2, (SFML.Window.Mouse.GetPosition(Program.app).Y / 35) * 35 + 7);
}
curDoor.FillColor = new Color(255, 150, 50);
curDoor.OutlineColor = new Color(0, 0, 0);
curDoor.OutlineThickness = 1;
t.Draw(curDoor);
curDoor.Dispose();
}
if (cursorMode == CursorMode.AddRoom)
{
//.........这里部分代码省略.........