Ejemplo n.º 1
0
int BalloonManager_ns::setDialogueBalloon(const char *text, uint16 winding, TextColor textColor) {

	int16 w, h;

	_se.calc(text, MAX_BALLOON_WIDTH);
	w = _se.width() + 14;
	h = _se.height() + 20;


	int id = createBalloon(w+5, h, winding, 1);
	Balloon *balloon = &_intBalloons[id];

	_sw.write(text, MAX_BALLOON_WIDTH, _textColors[textColor], balloon->surface);

	// TODO: extract some text to make a name for obj
	balloon->obj = _vm->_gfx->registerBalloon(new SurfaceToFrames(balloon->surface), 0);
	balloon->obj->x = _dialogueBalloonX[id];
	balloon->obj->y = 10;
	balloon->obj->transparentKey = BALLOON_TRANSPARENT_COLOR_NS;

	if (id > 0) {
		balloon->obj->y += _intBalloons[id - 1].obj->y + _intBalloons[id - 1].outerBox.height();
	}


	return id;
}
Ejemplo n.º 2
0
int BalloonManager_br::setLocationBalloon(const char *text, bool endGame) {
	_se.calc(text, 240);

	int id = createBalloon(_se.width() + 20, _se.height() + 30, 2);
	Balloon *balloon = &_intBalloons[id];

	_sw.write(text, 240, kNormalColor, balloon->surface);

	balloon->obj = _vm->_gfx->registerBalloon(new SurfaceToFrames(balloon->surface), 0);
	balloon->obj->x = 5;
	balloon->obj->y = 5;
	balloon->obj->transparentKey = BALLOON_TRANSPARENT_COLOR_BR;

	return 0;
}
Ejemplo n.º 3
0
void Controller::draw(){
	clearScreen();

	switch(mControllerState){
	case RESET:
		initialize();
		mControllerState=RUN;
		break;

	case SHOW_INTRO:
		myInstructions.draw(myScreenVector);
		break;

	case RUN:
		//see if its time
		createBalloon();

		//render cosmo to screenbuffer
		cosmo.draw(myScreenVector);

		//render balloons to screenbuffer
		std::vector<Balloon>::iterator myIter = myBalloons.begin();
		while ( myIter != myBalloons.end()){
			//collisions
			COLLISION col = hasCollidedWithCosmo((*myIter));
			if (col==COSMO_POPPED || col==BALLOON_CLOBBERED_COSMO)
				myIter->setCollidedState(col);		

			if ( myIter->draw(myScreenVector))
				myIter = myBalloons.erase(myIter);
			else
				++myIter;
		}
		//show score if keeping
		renderScoresToScreenbuffer();
		break;
	}

	//output the screen buffer
	for (int i = 0; i < myScreenBufferSize.y; i ++) {
		std::cout << myScreenVector[i]<<std::endl;
	}
}
Ejemplo n.º 4
0
int BalloonManager_ns::setLocationBalloon(const char *text, bool endGame) {

	int16 w, h;

	_se.calc(text, MAX_BALLOON_WIDTH);
	w = _se.width() + 14;
	h = _se.height() + 20;

	int id = createBalloon(w+(endGame ? 5 : 10), h+5, -1, BALLOON_TRANSPARENT_COLOR_NS);
	Balloon *balloon = &_intBalloons[id];
	_sw.write(text, MAX_BALLOON_WIDTH, _textColors[kNormalColor], balloon->surface);

	// TODO: extract some text to make a name for obj
	balloon->obj = _vm->_gfx->registerBalloon(new SurfaceToFrames(balloon->surface), 0);
	balloon->obj->x = 5;
	balloon->obj->y = 5;
	balloon->obj->transparentKey = BALLOON_TRANSPARENT_COLOR_NS;

	return id;
}