00001 /*************************************************************************** 00002 * Copyright (C) 2007 by Mike Polan * 00003 * kanadakid@gmail.com * 00004 * * 00005 * This program is free software; you can redistribute it and/or modify * 00006 * it under the terms of the GNU General Public License as published by * 00007 * the Free Software Foundation; either version 2 of the License, or * 00008 * (at your option) any later version. * 00009 * * 00010 * This program 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 * 00013 * GNU General Public License for more details. * 00014 * * 00015 * You should have received a copy of the GNU General Public License * 00016 * along with this program; if not, write to the * 00017 * Free Software Foundation, Inc., * 00018 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 00019 ***************************************************************************/ 00020 // texture.h: SDL texture functions 00021 00022 #ifndef TEXTURE_H 00023 #define TEXTURE_H 00024 00025 #include <iostream> 00026 #include <map> 00027 #include "SDL.h" 00028 00029 #include "common.h" 00030 00032 namespace Textures { 00033 00035 struct _Texture { 00036 int w; 00037 int h; 00038 short bpp; 00039 char *pixels; 00040 SDL_Surface *surface; 00041 }; 00042 typedef struct _Texture Texture; 00043 00045 extern std::map<ustring, SDL_Surface*> g_TextureMap; 00046 00051 SDL_Surface* queryTexture(const ustring &id); 00052 00057 void pushTexture(const ustring &id, SDL_Surface *texture); 00058 00062 void popTexture(const ustring &id); 00063 00065 void clearStack(); 00066 00072 SDL_Surface* createTexture(const ustring &id, const ustring &file); 00073 00079 SDL_Surface* createTexture(const ustring &id, const Texture &tex); 00080 00081 }; // namespace Textures 00082 00083 #endif