// $Id: playdisplay.h,v 1.6 2006/08/28 15:23:14 matthew Exp $ // Fish Supper // Copyright (C) 2006 Matthew Clarke // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License // as published by the Free Software Foundation; either version 2 // of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA // 02111-1307, USA. #ifndef _PLAYDISPLAY_H_ #define _PLAYDISPLAY_H_ #include "SDL.h" #include "SDL_image.h" #include "enums.h" #include "Font.hpp" #include "constants.h" #include "collisions.h" namespace FS { class PlayDisplay { private: struct BlitRequest { ImageIDs id; SDL_Rect * src_rect; SDL_Rect dest_rect; }; // struct BlitRequest SDL_Surface * screen; Uint32 transparency; bool is_first_pass; SDL_Surface * my_images[NUM_IMAGES]; SDL_Rect my_erase_rects[100]; SDL_Rect dirty_rects[100]; int erase_rects_index; int dirty_rects_index; const SFont & my_font; bool draw_score; char score[7]; SDL_Rect score_dirty_rect; bool draw_lives; char lives[2]; SDL_Rect lives_dirty_rect; bool draw_level; char level[3]; SDL_Rect level_dirty_rect; // NEW! BlitRequest * my_blit_requests[NUM_LAYERS]; int blit_request_indices[NUM_LAYERS]; SDL_Rect pause_menu_dirty_rect; public: PlayDisplay(SDL_Surface * s); ~PlayDisplay(); void redraw(); void reset(); void request_erase(const SDL_Rect * er); void request_blit(ImageIDs id, SDL_Rect * isr, const SDL_Rect * idr); void request_update(SDL_Rect dr); void request_draw_score(int s); void request_draw_lives(int l); void request_draw_level(int lev); // This function checks whether the given SDL_Rect (it's actually // the cat's bounding box) intersects with score, lives or level, meaning // they need to be re-drawn. void check_redraw(const SDL_Rect & box, int score, int lives, int level); void request_draw_pause_menu(ImageIDs id); void request_erase_pause_menu(); }; // class PlayDisplay } // namespace FS #endif