本文整理汇总了C#中SFML类的典型用法代码示例。如果您正苦于以下问题:C# SFML类的具体用法?C# SFML怎么用?C# SFML使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SFML类属于命名空间,在下文中一共展示了SFML类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: update
public void update(SFML.Graphics.RenderWindow window, orientation orientation, List<IObject> list, Stopwatch touch, Stopwatch shot)
{
if (orientation == orientation.vertical)
_sprite.Position = new SFML.Window.Vector2f(_sprite.Position.X, _sprite.Position.Y + 0.05f + (_fireRate / 10));
else if (orientation == orientation.horizontal)
_sprite.Position = new SFML.Window.Vector2f(_sprite.Position.X + 0.05f + (_fireRate / 10), _sprite.Position.Y);
for (var x = 0; x < list.Count; x++)
{
if (list[x].isEnemy())
{
if ((orientation == orientation.vertical
&& (list[x]._sprite.Position.X <= _sprite.Position.X
&& _sprite.Position.X <= list[x]._sprite.Position.X + 32)
&& list[x]._sprite.Position.Y > _sprite.Position.Y)
|| (orientation == orientation.horizontal
&& (list[x]._sprite.Position.Y <= _sprite.Position.Y
&& _sprite.Position.Y <= list[x]._sprite.Position.Y + 32)
&& list[x]._sprite.Position.X < _sprite.Position.X))
{
list.RemoveAt(x);
list.Remove(this);
}
}
}
}
开发者ID:CostardRouge,项目名称:ShootEmUpMaker,代码行数:26,代码来源:Shot.cs
示例2: update
public override bool update(SFML.Time.Time dt)
{
mWorld.update(dt);
CommandQueue commands = mWorld.getCommandQueue();
mPlayer.handleRealtimeInput(commands);
return true;
}
开发者ID:pixeltasim,项目名称:SFML.NET_Gamedev,代码行数:7,代码来源:GameState.cs
示例3: DistanceBetweenTwoPoints
public static float DistanceBetweenTwoPoints(SFML.Window.Vector2f a, SFML.Window.Vector2f b)
{
float distanceX = b.X - a.X;
float distanceY = b.Y - a.Y;
return (float)Math.Sqrt((Double)(distanceX * distanceX) + (Double)(distanceY * distanceY));
}
开发者ID:Nimgoble,项目名称:CollisionTests,代码行数:7,代码来源:Helpers.cs
示例4: RenderWindow_KeyPressed
private void RenderWindow_KeyPressed(object sender, SFML.Window.KeyEventArgs e)
{
Vector2D copy = position;
if (e.Code == Keyboard.Key.Left)
{
position.X -= speed.X;
animation.SetCurrentAnimation("player_left");
}
if (e.Code == Keyboard.Key.Right)
{
position.X += speed.X;
animation.SetCurrentAnimation("player_right");
}
if (e.Code == Keyboard.Key.Up)
{
position.Y -= speed.Y;
animation.SetCurrentAnimation("player_up");
}
if (e.Code == Keyboard.Key.Down)
{
position.Y += speed.Y;
animation.SetCurrentAnimation("player_down");
}
animation.Update(deltaTime);
}
开发者ID:Chiheb2013,项目名称:GameLibs,代码行数:26,代码来源:Player.cs
示例5: Keyboard
public override void Keyboard(SFML.Window.KeyCode key)
{
switch (char.ToLower((char)key))
{
case 'c':
if (m_fixture2 == null)
{
CircleShape shape = new CircleShape();
shape.Radius = 3.0f;
shape.Position = new Vec2(0.5f, -4.0f);
m_fixture2 = m_body.CreateFixture(shape, 10.0f);
m_body.IsAwake = true;
}
break;
case 'd':
if (m_fixture2 != null)
{
m_body.DestroyFixture(m_fixture2.Value);
m_fixture2 = null;
m_body.IsAwake = true;
}
break;
}
}
开发者ID:RubisetCie,项目名称:box2c,代码行数:25,代码来源:ShapeEditing.cs
示例6: PrepareDrawToTargetSprite
/// <summary>
/// Prepares the <see cref="SFML.Graphics.Sprite"/> used to draw to a <see cref="RenderTarget"/>.
/// </summary>
/// <param name="sprite">The <see cref="SFML.Graphics.Sprite"/> to prepare.</param>
/// <param name="target">The <see cref="RenderTarget"/> begin drawn to.</param>
protected override void PrepareDrawToTargetSprite(SFML.Graphics.Sprite sprite, RenderTarget target)
{
base.PrepareDrawToTargetSprite(sprite, target);
// Always use alpha blending
sprite.BlendMode = BlendMode.Multiply;
}
开发者ID:Vizzini,项目名称:netgore,代码行数:12,代码来源:LightManager.cs
示例7: Draw
public void Draw(SFML.Graphics.RenderWindow window)
{
/*foreach (SFML.Graphics.Sprite spr in path)
{
window.Draw(spr);
}*/
}
开发者ID:jpx,项目名称:blazera,代码行数:7,代码来源:PlayerHdl.cs
示例8: Draw
public void Draw(SFML.Graphics.RenderWindow window)
{
if (CurrentMap == null)
return;
CurrentMap.Draw(window);
}
开发者ID:eickegao,项目名称:Blazera,代码行数:7,代码来源:CWorld.cs
示例9: OnKeyDown
protected override void OnKeyDown(SFML.Window.KeyEventArgs key)
{
if(key.Code == SFML.Window.Keyboard.Key.T)
{
}
}
开发者ID:Tricon2-Elf,项目名称:DystopiaRPG,代码行数:7,代码来源:GameplayScreen.cs
示例10: CollideFrom
/// <summary>
/// Handles when another Entity collides into us. Not synonymous CollideInto since the
/// <paramref name="collider"/> Entity is the one who collided into us. For example, if the
/// two entities in question were a moving Character and a stationary wall, this Entity would be
/// the Wall and <paramref name="collider"/> would be the Character.
/// </summary>
/// <param name="collider">Entity that collided into us.</param>
/// <param name="displacement">Displacement between the two Entities.</param>
public override void CollideFrom(Entity collider, SFML.Graphics.Vector2 displacement)
{
// When a character touches this, teleport the character to the destination
Character character = collider as Character;
if (character == null)
return;
// Only let users use teleports
if (character is NPC)
return;
// Teleport to a new map
if (DestinationMap > 0)
{
if (character.Map.ID != DestinationMap)
{
var newMap = character.World.GetMap(DestinationMap);
if (newMap == null)
{
const string errmsg = "Failed to teleport Character `{0}` - Invalid DestMap `{1}`.";
Debug.Fail(string.Format(errmsg, character, this));
if (log.IsErrorEnabled)
log.ErrorFormat(errmsg, character, this);
return;
}
character.Teleport(newMap, Destination);
}
}
// Teleport the CharacterEntity to our predefined location
character.Position = Destination;
}
开发者ID:wtfcolt,项目名称:game,代码行数:41,代码来源:TeleportEntity.cs
示例11: Window_KeyPressed
void Window_KeyPressed(object sender, SFML.Window.KeyEventArgs e)
{
if (e.Code == SFML.Window.Keyboard.Key.Num1)
{
_game.PushState((IGameState)(_prototypeStates[1].GetConstructor(new Type[] { }).Invoke(new Object[] { })));
}
}
开发者ID:floAr,项目名称:BeyondTheBlur,代码行数:7,代码来源:PickPrototypeState.cs
示例12: RenderTarget
public RenderTarget(SFML.Graphics.RenderTarget renderTarget)
{
this.renderTarget = renderTarget;
m_VertexCache = new Vertex[CacheSize];
m_RenderState = RenderStates.Default;
}
开发者ID:pzaps,项目名称:CrossGFX,代码行数:7,代码来源:RenderTarget.cs
示例13: OnKeyPressed
/// <summary>
/// Function called when a key is pressed
/// </summary>
static void OnKeyPressed(object sender, SFML.Window.KeyEventArgs e)
{
Window window = (Window)sender;
if (e.Code == Keyboard.Key.Escape)
window.Close();
game.OnKeyPressed(sender, e);
}
开发者ID:nyteshade,项目名称:FTLEdit,代码行数:11,代码来源:Program.cs
示例14: AABB
public AABB(SFML.Window.Vector2f position, float width, float height, SFML.Graphics.Color color)
{
Position = position;
Extents = new SFML.Window.Vector2f(width, height);
this.color = color;
Configure();
}
开发者ID:Nimgoble,项目名称:CollisionTests,代码行数:8,代码来源:AABB.cs
示例15: Shot
public Shot(SFML.Window.Vector2f pos, string sprite, int dmg, int fireRate)
{
_damage = dmg;
_fireRate = fireRate;
_sprite = new SFML.Graphics.Sprite();
_sprite.Texture = new SFML.Graphics.Texture(sprite, new SFML.Graphics.IntRect(10, 10, 5, 5));
_sprite.Position = new SFML.Window.Vector2f(pos.X + 15, pos.Y + 32);
}
开发者ID:CostardRouge,项目名称:ShootEmUpMaker,代码行数:8,代码来源:Shot.cs
示例16: Keyboard
public override void Keyboard(SFML.Window.KeyCode key)
{
switch (char.ToLower((char)key))
{
case 'c':
CreateCircle();
break;
}
}
开发者ID:RubisetCie,项目名称:box2c,代码行数:9,代码来源:Confined.cs
示例17: LineSegment
public LineSegment(SFML.Window.Vector2f start, SFML.Window.Vector2f end)
{
Start = start;
End = end;
linePoints = new VertexArray(PrimitiveType.Lines);
linePoints.Append(new Vertex(start));
linePoints.Append(new Vertex(end));
}
开发者ID:Nimgoble,项目名称:CollisionTests,代码行数:9,代码来源:LineSegment.cs
示例18: SFML2WPF
public static Color SFML2WPF(SFML.Graphics.Color sf)
{
return new Color {
R = sf.R,
G = sf.G,
B = sf.B,
A = sf.A
};
}
开发者ID:mkaput,项目名称:GameOfLifes-net,代码行数:9,代码来源:ColorConvert.cs
示例19: Draw
public override void Draw(SFML.Graphics.RenderTarget window)
{
SFML.Graphics.View currentView = window.GetView();
window.SetView(GetRoot().MapView);
base.Draw(window);
window.SetView(currentView);
}
开发者ID:jpx,项目名称:blazera,代码行数:9,代码来源:MapBaseWidget.cs
示例20: Update
////////////////////////
// Métodos
////////////////////////
/// <summary>
/// Actualiza el estado de la escena en función del tiempo transcurrido desde la última actualización
/// </summary>
/// <param name="time">tiempo transcurrido desde la última actualización </param>
/// <returns>true: siempre deja que las escenas inferiores se actualicen</returns>
public override bool Update(SFML.System.Time time)
{
// calculamos las nuevas posiciones de los elementos del mundo
_world.Update(time);
_player.HandleRealtimeInput(_world.CommandQueue);
return true;
}
开发者ID:aoltra,项目名称:Galaga-SFML.Net,代码行数:18,代码来源:GameScene.cs
注:本文中的SFML类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论