Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //This works just fine
- SDL_Texture* BMF::getCharTexture(unsigned char character) const {
- SDL_Surface* surf_char = this->chars.find(character)->second->getSurf();
- SDL_Texture* text = SDL_CreateTextureFromSurface(Engine::Instance()->getRenderer(), surf_char);
- return text;
- }
- //This doesn't render anything
- SDL_Texture* BMF::getCharTexture(unsigned char character) const {
- BMF_Char* bmf_char = this->chars.find(character)->second;
- SDL_Surface* final_surf = NULL;
- int width = bmf_char->getWidth(); //tested it's non zero
- int height = bmf_char->getHeight(); //tested its' non zero
- Uint32 rmask, gmask, bmask, amask;
- #if SDL_BYTEORDER == SDL_BIG_ENDIAN
- rmask = 0xff000000;
- gmask = 0x00ff0000;
- bmask = 0x0000ff00;
- amask = 0x000000ff;
- #else
- rmask = 0x000000ff;
- gmask = 0x0000ff00;
- bmask = 0x00ff0000;
- amask = 0xff000000;
- #endif
- final_surf = SDL_CreateRGBSurface(0, width, height, 32, rmask, gmask, bmask, amask);//this will pass with no errors
- SDL_Rect dest;
- dest.x = 0;
- dest.y = 0;
- dest.h = height;
- dest.w = width;
- SDL_BlitSurface(bmf_char->getSurf(), NULL, final_surf, &dest);//same, pass
- with no errors
- SDL_Texture* text = SDL_CreateTextureFromSurface(Engine::Instance()->getRenderer(), final_surf);
- return text; //not even single pixel in text
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement