コード例 #1
0
ファイル: bitmap.cpp プロジェクト: marstau/shinsango
void Bitmap::drawShadow(Bitmap & where, int x, int y, int intensity, Color color, double scale, bool facingRight) const {
    const double newheight = getHeight() * scale;
    Bitmap shade(getWidth(), (int) fabs(newheight));
    Stretch(shade);

    /* Could be slow, but meh, lets do it for now to make it look like a real shadow */
    for (int h = 0; h < shade.getHeight(); ++h){
        for (int w = 0; w < shade.getWidth(); ++w){
            Color pix = shade.getPixel(w, h);
            if (pix != MaskColor()){
                shade.putPixel(w, h, color);
            }
        }
    }

    transBlender(0, 0, 0, intensity);

    if (scale > 0){
        if (facingRight){
            shade.translucent().drawVFlip(x, y, where);
        } else { 
            shade.translucent().drawHVFlip(x, y, where);
        }
    } else if (scale < 0){
        y -= fabs(newheight);
        if (facingRight){
            shade.translucent().draw(x + 3, y, where);
        } else { 
            shade.translucent().drawHFlip(x - 3, y, where);
        }
    }
}
コード例 #2
0
ファイル: SDLFramework.cpp プロジェクト: ZealousV/ART
Surface::Surface(SDL_Surface* surface):BaseSurface(surface){_texture=0;MaskColor();};//Surface ctor, calls the ctor of BaseSurface
コード例 #3
0
ファイル: SDLFramework.cpp プロジェクト: ZealousV/ART
Surface::Surface():BaseSurface(){_texture=0;MaskColor();};//Default ctor, calls the ctor of BaseSurface