Path: blob/master/libmeteor/include/ameteor/graphics/object.hpp
2 views
// Meteor - A Nintendo Gameboy Advance emulator1// Copyright (C) 2009-2011 Philippe Daouadi2//3// This program is free software: you can redistribute it and/or modify4// it under the terms of the GNU General Public License as published by5// the Free Software Foundation, either version 3 of the License, or6// (at your option) any later version.7//8// This program is distributed in the hope that it will be useful,9// but WITHOUT ANY WARRANTY; without even the implied warranty of10// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the11// GNU General Public License for more details.12//13// You should have received a copy of the GNU General Public License14// along with this program. If not, see <http://www.gnu.org/licenses/>.1516#ifndef __GRAPHICS_OBJECT_H__17#define __GRAPHICS_OBJECT_H__1819#include <stdint.h>20#include <vector>21#include <list>2223namespace AMeteor24{25namespace Graphics26{27class Object28{29public :30static const uint8_t FLIP_HORIZONTAL = 1;31static const uint8_t FLIP_VERTICAL = 2;3233Object (uint16_t* pPalette, uint8_t* pChar);34// Warning : this copy constructor must not be used on an used object35// use it only on just created objects36Object (const Object& obj);3738inline uint8_t GetPriority () const;39inline int8_t GetRotationParam () const;40inline uint16_t GetTileNum () const;41inline bool IsWindow () const;4243void DrawLine (uint8_t line, uint32_t* surface, bool oneDim,44uint8_t mosaic);45void DrawLineRot (uint8_t line, uint32_t* surface, bool oneDim,46int16_t a, int16_t b, int16_t c, int16_t d, uint8_t mosaic);47void DrawWindow (uint8_t line, uint8_t* surface, bool oneDim,48uint8_t mask);49void DrawWindowRot (uint8_t line, uint8_t* surface,50bool oneDim, int16_t a, int16_t b, int16_t c, int16_t d,51uint8_t mask);5253void UpdateAttrs (uint16_t attr0, uint16_t attr1, uint16_t attr2);54void UpdateAttr0 (uint16_t attr);55void UpdateAttr1 (uint16_t attr);56void UpdateAttr2 (uint16_t attr);5758private :59inline void SetSize ();6061enum Shape62{63SHAPE_SQUARE = 0,64SHAPE_HORIZONTAL,65SHAPE_VERTICAL,66SHAPE_PROHIBITED67};6869uint16_t m_attr0, m_attr1, m_attr2;70uint8_t m_width, m_height;71uint16_t* m_pPalette;72uint8_t* m_pChar;73uint32_t m_charBegin;74uint32_t m_charEnd;75};7677inline int8_t Object::GetRotationParam () const78{79return (m_attr0 & (0x1 << 8)) ? (m_attr1 >> 9) & 0x1F : -1;80}8182inline uint8_t Object::GetPriority () const83{84return (m_attr2 >> 10) & 0x3;85}8687inline bool Object::IsWindow () const88{89return (m_attr0 & (0x3 << 10)) == (0x2 << 10);90}9192inline uint16_t Object::GetTileNum () const93{94return (m_attr2 & 0x3FF);95}96}97}9899#endif100101102