Surface Class Loading a BMP
Re: Surface Class Loading a BMP
Luis what about my first question should i make it pointer or not ? cuz if i do pointer i dont able to read bmp anymore
Re: Surface Class Loading a BMP
the problem with the pointer is that you have to allocate it
so it's best the way you have it now
Code: Select all
class Surface
{
public:
Surface(std::string filename)
: sprite( new std::vector<Color>() )
{
LoadBMP(filename, *sprite,width,height);
}
~Surface()
{
sprite->clear();
delete sprite;
}
void Draw(int xoff ,int yoff , int tr,int tg,int tb,Graphics &gfx)
{
gfx.DrawSprite(xoff, yoff, width, height, *sprite, tr, tg, tb);
}
private:
unsigned int width;
unsigned int height;
std::vector<Color>* sprite;
};
always available, always on, about ~10 years c/c++, java[script], win32/directx api, [x]html/css/php/some asp/sql experience. (all self taught)
Knows English, Spanish and Japanese.
[url=irc://irc.freenode.net/#pchili]irc://irc.freenode.net/#pchili[/url] [url=irc://luisr14.no-ip.org/#pchili]alt[/url] -- join up if ever want real-time help or to just chat --
Knows English, Spanish and Japanese.
[url=irc://irc.freenode.net/#pchili]irc://irc.freenode.net/#pchili[/url] [url=irc://luisr14.no-ip.org/#pchili]alt[/url] -- join up if ever want real-time help or to just chat --