2017-09-15 16:25:55 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <cstdint>
|
|
|
|
|
|
|
|
#include <Processor.h>
|
|
|
|
|
|
|
|
namespace EightBit {
|
2017-10-19 21:43:09 +00:00
|
|
|
|
|
|
|
class Ram;
|
|
|
|
|
2017-09-15 16:25:55 +00:00
|
|
|
namespace GameBoy {
|
2018-05-02 01:47:47 +00:00
|
|
|
class ObjectAttribute final {
|
2017-09-15 16:25:55 +00:00
|
|
|
public:
|
2017-11-11 11:12:09 +00:00
|
|
|
ObjectAttribute() = default;
|
2017-10-22 20:25:06 +00:00
|
|
|
ObjectAttribute(Ram& ram, uint16_t address);
|
2017-09-15 16:25:55 +00:00
|
|
|
|
2018-10-27 18:23:02 +00:00
|
|
|
auto positionY() const { return m_positionY; }
|
|
|
|
auto positionX() const { return m_positionX; }
|
|
|
|
auto pattern() const { return m_pattern; }
|
|
|
|
auto flags() const { return m_flags; }
|
|
|
|
|
|
|
|
auto priority() const { return flags() & Chip::Bit7; }
|
|
|
|
|
|
|
|
auto highPriority() const { return !!priority(); }
|
|
|
|
auto lowPriority() const { return !priority(); }
|
|
|
|
auto flipY() const { return !!(flags() & Chip::Bit6); }
|
|
|
|
auto flipX() const { return !!(flags() & Chip::Bit5); }
|
|
|
|
auto palette() const { return (flags() & Chip::Bit4) >> 3; }
|
2017-09-15 16:25:55 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
uint8_t m_positionY;
|
|
|
|
uint8_t m_positionX;
|
|
|
|
uint8_t m_pattern;
|
|
|
|
uint8_t m_flags;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|