void Font::draw( BITMAP* aBuffer, const std::string& aText, int aX, int aY, Blending aBlending) { int x = aX; int y = aY; bool addBlend = aBlending == Blending_Add; setBlending(aBlending); for(unsigned int i = 0; i < aText.size(); i++) { BITMAP* bitmap = getBitmapForGlyph(aText[i]); if (aBlending == Blending_None) { draw_sprite(aBuffer, bitmap, x, y); } else if (addBlend) { draw_trans_sprite(aBuffer, bitmap, x, y); } else { draw_lit_sprite(aBuffer, bitmap, x, y, 0); } x += bitmap->w; } }
void Sprite::loadFromFile(string path, bool blending) { SDL_Surface* surface = IMG_Load(path.c_str()); if (surface == NULL) { cout << "ERROR: " << IMG_GetError() << endl; return; } texture = SDL_CreateTextureFromSurface(renderer, surface); if (texture == NULL) cout << "ERROR: " << SDL_GetError() << endl; SDL_QueryTexture(texture, NULL, NULL, &w, &h); scale.w = w; scale.h = h; clip.x = 0; clip.y = 0; clip.h = h; clip.w = w; angle = 0; center.x = w / 2; center.y = h / 2; SDL_SetTextureColorMod(texture, r, g, b); setBlending(blending); SDL_FreeSurface(surface); }
void Decal::setToDefaults( void ) { MultiAttribute::setToDefaults(); setTexture( vgd::node::Texture2DShp() ); setShape( vgd::node::VertexShapeShp() ); setAlphaTest( (true) ); setBlending( (false) ); }
void MdpCtrl::setSource(const utils::PipeArgs& args) { setSrcWhf(args.whf); //TODO These are hardcoded. Can be moved out of setSource. mOVInfo.transp_mask = 0xffffffff; //TODO These calls should ideally be a part of setPipeParams API setFlags(args.mdpFlags); setZ(args.zorder); setPlaneAlpha(args.planeAlpha); setBlending(args.blending); }