Exemple #1
0
bool ProfileWindow::handleMouseUp(Point p){
	Point screen_point = screen_to_obj(p.getX(),p.getY());
	for(int a = 0; a < 5; a++){
	  BBox currentBBox = colors[a]->getBBox();
	  if(currentBBox.containPoint(screen_point)){
	    //character->setColor(colors[a]->getColor());
	    cout << "yay" << endl;
	    delete character;
	    profile.setColor(colors[a]->getColor());
	    character = new Rectangle1(6.0, 6.0, Point(0.0, 2.0), "data/character/profilepage",profile.getColor());
	  }
	}
	BBox currentBBox = pexit->getBBox();
	if(currentBBox.containPoint(screen_point)){
	  pexit->setColor(Color(0.5, 0.0, 1.0));
	  exit(0);
	}
	currentBBox = save->getBBox();
	if(currentBBox.containPoint(screen_point)){
	  profile.setNick(nickname->getString());
	  save->setColor(Color(0.5, 0.0, 1.0));
	  saveProfile();
	  return true;
	}
	return false;
}
Exemple #2
0
bool ProfileWindow::handleMouseDown(Point p){
	Point screen_point = screen_to_obj(p.getX(),p.getY());
	for(int a = 0; a < 5; a++){
		BBox currentBBox = colors[a]->getBBox();
		if(currentBBox.containPoint(screen_point)){
			return true;
		}
	}
	BBox currentBBox = pexit->getBBox();
	if(currentBBox.containPoint(screen_point)){
	  pexit->setColor(Color(0.0,1.0, 0.0));
	  return true;
	}
	currentBBox = save->getBBox();
	if(currentBBox.containPoint(screen_point)){
		save->setColor(Color(0.0, 1.0, 0.0));
		return true;
	}
	return false;
}