File: explode_animate.cpp

package info (click to toggle)
rafkill 1.2.2-3.3
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 13,268 kB
  • sloc: cpp: 13,508; makefile: 64; sh: 14
file content (34 lines) | stat: -rw-r--r-- 840 bytes parent folder | download | duplicates (12)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include "defs.h"
#include "explode.h"
#include "explode_animate.h"
#include "raptor.h"
#include "bitmap.h"

ExplosionAnimate::ExplosionAnimate( int cx, int cy, double dx, double dy, int _first_pic, int _last_pic ):
ExplosionClass( cx, cy, dx, dy, 99 ) {
	first_pic = _first_pic;
	radius = first_pic;
	last_pic = _last_pic;
}


bool ExplosionAnimate::update() {
	vx += wx;
	vy += wy;
	x = (int)vx;
	y = (int)vy;

	if ( ++radius > last_pic ) return true;
	return false;
}


void ExplosionAnimate::Draw( Bitmap * who, int offset ) {
	Bitmap frame = Util::getDataSprite( radius );
	int mx = frame.getWidth() / 2;
	int my = frame.getHeight() / 2;
	// draw_sprite( who, (BITMAP *)global_data[ radius ].dat, x-mx, y-my+offset );
	// Bitmap c( (BITMAP *)Util::global_data[ radius ].dat );
	// who->draw( 
	frame.draw( x-mx, y-my+offset, *who );
}