EightBit/LR35902/inc/ObjectAttribute.h
Adrian Conlon 759b4a9fa8 GameBoy: Correct a few (very minor C++) niggles in the implementation. No functional changes.
Signed-off-by: Adrian Conlon <adrian.conlon@gmail.com>
2020-11-07 09:41:12 +00:00

37 lines
1.1 KiB
C++

#pragma once
#include <cstdint>
#include <Chip.h>
namespace EightBit {
class Ram;
namespace GameBoy {
class ObjectAttribute final {
public:
ObjectAttribute() = default;
ObjectAttribute(Ram& ram, uint16_t address);
[[nodiscard]] auto positionY() const noexcept { return m_positionY; }
[[nodiscard]] auto positionX() const noexcept { return m_positionX; }
[[nodiscard]] auto pattern() const noexcept { return m_pattern; }
[[nodiscard]] auto flags() const noexcept { return m_flags; }
[[nodiscard]] auto priority() const noexcept { return flags() & Chip::Bit7; }
[[nodiscard]] auto highPriority() const noexcept { return !!priority(); }
[[nodiscard]] auto lowPriority() const noexcept { return !priority(); }
[[nodiscard]] auto flipY() const noexcept { return !!(flags() & Chip::Bit6); }
[[nodiscard]] auto flipX() const noexcept { return !!(flags() & Chip::Bit5); }
[[nodiscard]] auto palette() const noexcept { return (flags() & Chip::Bit4) >> 4; }
private:
uint8_t m_positionY;
uint8_t m_positionX;
uint8_t m_pattern;
uint8_t m_flags;
};
}
}