EightBitNet/LR35902/ObjectAttribute.cs
Adrian Conlon 8dea5746c4 Tidy up stylecopy usage for the LR35902 set of libraries.
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
2019-07-21 13:11:00 +01:00

44 lines
1.2 KiB
C#

// <copyright file="ObjectAttribute.cs" company="Adrian Conlon">
// Copyright (c) Adrian Conlon. All rights reserved.
// </copyright>
namespace EightBit
{
namespace GameBoy
{
public class ObjectAttribute
{
public ObjectAttribute()
{
}
public ObjectAttribute(Ram ram, ushort address)
{
this.PositionY = ram.Peek(address);
this.PositionX = ram.Peek(++address);
this.Pattern = ram.Peek(++address);
this.Flags = ram.Peek(++address);
}
public byte PositionY { get; }
public byte PositionX { get; }
public byte Pattern { get; }
public byte Flags { get; }
public int Priority => this.Flags & (byte)Bits.Bit7;
public bool HighPriority => this.Priority != 0;
public bool LowPriority => this.Priority == 0;
public bool FlipY => (this.Flags & (byte)Bits.Bit6) != 0;
public bool FlipX => (this.Flags & (byte)Bits.Bit5) != 0;
public int Palette => (this.Flags & (byte)Bits.Bit4) >> 3; // TODO: Check this!
}
}
}