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
|
|
|
|
|
|
|
uint8_t positionY() const { return m_positionY; }
|
|
|
|
uint8_t positionX() const { return m_positionX; }
|
|
|
|
uint8_t pattern() const { return m_pattern; }
|
|
|
|
uint8_t flags() const { return m_flags; }
|
|
|
|
|
|
|
|
uint8_t priority() const { return flags() & Processor::Bit7; }
|
|
|
|
|
2018-08-17 12:59:59 +00:00
|
|
|
bool highPriority() const { return !!priority(); }
|
|
|
|
bool lowPriority() const { return !priority(); }
|
|
|
|
bool flipY() const { return !!(flags() & Processor::Bit6); }
|
|
|
|
bool flipX() const { return !!(flags() & Processor::Bit5); }
|
2017-09-15 16:25:55 +00:00
|
|
|
int palette() const { return (flags() & Processor::Bit4) >> 3; }
|
|
|
|
|
|
|
|
private:
|
|
|
|
uint8_t m_positionY;
|
|
|
|
uint8_t m_positionX;
|
|
|
|
uint8_t m_pattern;
|
|
|
|
uint8_t m_flags;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|