00001 /* 00002 Sprite.cpp - 2D sprite buffers library for Arduino & Wiring 00003 Copyright (c) 2006 David A. Mellis. All right reserved. 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Lesser General Public 00007 License as published by the Free Software Foundation; either 00008 version 2.1 of the License, or (at your option) any later version. 00009 00010 This library is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 Lesser General Public License for more details. 00014 00015 You should have received a copy of the GNU Lesser General Public 00016 License along with this library; if not, write to the Free Software 00017 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00018 */ 00019 00020 #ifndef Sprite_h 00021 #define Sprite_h 00022 00023 #include <inttypes.h> 00024 00025 #include "binary.h" 00026 00027 class Sprite 00028 { 00029 private: 00030 uint8_t _width; 00031 uint8_t _height; 00032 uint8_t _depth; 00033 uint8_t _ppb; 00034 uint8_t _bpr; 00035 uint8_t _mask; 00036 uint8_t *_buffer; 00037 00038 void init(uint8_t width, uint8_t height); 00039 public: 00040 Sprite(uint8_t width, uint8_t height); 00041 Sprite(uint8_t width, uint8_t height, uint8_t row, ...); 00042 uint8_t width() const; 00043 uint8_t height() const; 00044 void write(uint8_t x, uint8_t y, uint8_t value); 00045 uint8_t read(uint8_t x, uint8_t y) const; 00046 }; 00047 00048 #endif