Browse Source

WIP: Added additional properties to the Sprite object. Added draw list.

improved_timing
Ian Burgmyer 6 years ago
parent
commit
cf1bd35669
  1. 8
      DotSDL/Graphics/SdlWindow.cs
  2. 2
      DotSDL/Graphics/Sprite.cs
  3. 2
      Samples/Sample.Sprites/Player.cs

8
DotSDL/Graphics/SdlWindow.cs

@ -1,7 +1,8 @@
using DotSDL.Events;
using DotSDL.Input;
using System;
using DotSDL.Interop.Core;
using System;
using System.Collections.Generic;
namespace DotSDL.Graphics {
/// <summary>
@ -46,6 +47,9 @@ namespace DotSDL.Graphics {
/// <summary>Gets or sets the amount of time, in milliseconds, between game (logic) updates.</summary>
public uint GameUpdateTicks { get; set; }
/// <summary>The list of active <see cref="Sprite"/> objects.</summary>
public List<Sprite> Sprites { get; }
/// <summary>Indicates that the window manager should position the window. To place the window on a specific display, use the <see cref="WindowPosCenteredDisplay"/> function.</summary>
public const int WindowPosUndefined = 0x1FFF0000;
@ -121,6 +125,8 @@ namespace DotSDL.Graphics {
TextureWidth = textureWidth;
TextureHeight = textureHeight;
Sprites = new List<Sprite>();
IsDestroyed = false;
_resources.RegisterResource(this);
}

2
DotSDL/Graphics/Sprite.cs

@ -8,6 +8,7 @@ namespace DotSDL.Graphics {
public Vector2 Position { get; set; }
public Vector2 Scale { get; set; }
public int ZOrder { get; set; }
public bool Shown { get; set; }
/// <summary>
/// Initializes a new <see cref="Sprite"/>.
@ -67,6 +68,7 @@ namespace DotSDL.Graphics {
Position = position;
Scale = scale;
ZOrder = zorder;
Shown = false;
}
}
}

2
Samples/Sample.Sprites/Player.cs

@ -8,6 +8,8 @@ namespace Sample.Sprites {
public Player(Color color, int speed) : base(64, 64) {
_color = color;
_speed = speed;
Shown = true;
}
}
}

Loading…
Cancel
Save