Esempio n. 1
0
void Animation::drawFrame(BITMAP *dest, int frame, int x, int y, bool hflip, bool vflip)
{
	BITMAP *src = getFrame(frame);

	if (hflip && vflip) {
		draw_sprite_vh_flip(dest, src, x, y);
	} else if (hflip && !vflip) {
		draw_sprite_h_flip(dest, src, x, y);
	} else if (!hflip && vflip) {
		draw_sprite_v_flip(dest, src, x, y);
	} else {
		draw_sprite(dest, src, x, y);
	}
	return;
}
Esempio n. 2
0
void Bitmap::FlipBlt(Bitmap *src, int dst_x, int dst_y, BitmapFlip flip)
{	
	BITMAP *al_src_bmp = src->_alBitmap;
	if (flip == kBitmap_HFlip)
	{
		draw_sprite_h_flip(_alBitmap, al_src_bmp, dst_x, dst_y);
	}
	else if (flip == kBitmap_VFlip)
	{
		draw_sprite_v_flip(_alBitmap, al_src_bmp, dst_x, dst_y);
	}
	else if (flip == kBitmap_HVFlip)
	{
		draw_sprite_vh_flip(_alBitmap, al_src_bmp, dst_x, dst_y);
	}
}
Esempio n. 3
0
BITMAP* generate_bg(BITMAP *img, unsigned char r, unsigned char g, unsigned char b)
{
    bg_r = r;
    bg_g = g;
    bg_b = b;
    
    BITMAP *bg2 = create_bitmap(img->w*2, img->h*2);
    BITMAP *bg = create_bitmap(img->w*2, img->h*2);
    draw_sprite(bg, img, 0,0);
    draw_sprite_h_flip(bg, img, img->w,0);
    draw_sprite_v_flip(bg, img, 0,img->h);
    draw_sprite_vh_flip(bg, img, img->w,img->h);
    
    set_trans_blender(r,g,b,255);
    draw_lit_sprite(bg2, bg, 0,0, 96);

	destroy_bitmap(bg);
    
    return bg2;
}
Esempio n. 4
0
void apply_texture_to_map(BITMAP *tex)
{
	int tw = tex->w;
	int th = tex->h;
    int nw = (level->w / tw)+1;
    int nh = (level->h / th)+1;
	    
    // Copy texture across map
	for(int y=0; y < nh; y++)
    {
        for(int x=0; x < nw; x++)
        {
            if(x % 2 == 1 && y % 2 == 1)
                draw_sprite_vh_flip(level, tex, x*tex->w,y*tex->h);
            else if(x % 2 == 1)
                draw_sprite_h_flip(level, tex, x*tex->w,y*tex->h);
            else if(y % 2 == 1)
                draw_sprite_v_flip(level, tex, x*tex->w,y*tex->h);
            else
                draw_sprite(level, tex, x*tex->w,y*tex->h);
        }
    }
}