2017-09-15 17:25:55 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <cstdint>
|
|
|
|
|
2020-11-07 09:41:12 +00:00
|
|
|
#include <Chip.h>
|
2017-09-15 17:25:55 +01:00
|
|
|
|
|
|
|
namespace EightBit {
|
2017-10-19 22:43:09 +01:00
|
|
|
|
|
|
|
class Ram;
|
|
|
|
|
2017-09-15 17:25:55 +01:00
|
|
|
namespace GameBoy {
|
2018-05-02 02:47:47 +01:00
|
|
|
class ObjectAttribute final {
|
2017-09-15 17:25:55 +01:00
|
|
|
public:
|
2017-11-11 11:12:09 +00:00
|
|
|
ObjectAttribute() = default;
|
2017-10-22 21:25:06 +01:00
|
|
|
ObjectAttribute(Ram& ram, uint16_t address);
|
2017-09-15 17:25:55 +01:00
|
|
|
|
2020-11-07 09:41:12 +00:00
|
|
|
[[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; }
|
2018-10-27 19:23:02 +01:00
|
|
|
|
2020-11-07 09:41:12 +00:00
|
|
|
[[nodiscard]] auto priority() const noexcept { return flags() & Chip::Bit7; }
|
2018-10-27 19:23:02 +01:00
|
|
|
|
2020-11-07 09:41:12 +00:00
|
|
|
[[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; }
|
2017-09-15 17:25:55 +01:00
|
|
|
|
|
|
|
private:
|
|
|
|
uint8_t m_positionY;
|
|
|
|
uint8_t m_positionX;
|
|
|
|
uint8_t m_pattern;
|
|
|
|
uint8_t m_flags;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|