示例#1
0
void ChangeParams(void)
{
	RECT rect;

	ChangeBrush();
	GetClientRect(hWnd, &rect);
	Rectangle(hDC, rect.left-1, rect.top-1, rect.right+5, rect.bottom+5);
	ChangeBrush();
	RandomizeABC();
}
示例#2
0
Editor::Editor(Map *map)
{
	engine = Engine::GetInstance();

	r = 255;
	g = b = 0;

	buttons.clear();

	buttons.push_back(new Button("save", Point(engine->GetDisplayWidth() - 120, 30), this, true));
	buttons.push_back(new Button("close", Point(engine->GetDisplayWidth() - 120, 70), this, true));

	buttonsDictionary[ObjectType::EWall] = new Button("wall", Point(engine->GetDisplayWidth() - 110, 150), this, false);
	buttonsDictionary[ObjectType::EBox] = new Button("box", Point(engine->GetDisplayWidth() - 65, 150), this, false);
	buttonsDictionary[ObjectType::EDestination] = new Button("destination", Point(engine->GetDisplayWidth() - 110, 190), this, false);
	buttonsDictionary[ObjectType::EFloor] = new Button("floor", Point(engine->GetDisplayWidth() - 65, 190), this, false);
	buttonsDictionary[ObjectType::EPlayer] = new Button("player", Point(engine->GetDisplayWidth() - 85, 230), this, false);
	buttonsDictionary[ObjectType::EEmpty] = new Button("empty", Point(engine->GetDisplayWidth() - 85, 110), this, false);

	bitmap = engine->GetBMP("menu/game2.bmp");

	this->isEnded = false;
	this->player = NULL;
	this->gameWindow = NULL;

	ChangeBrush(ObjectType::EEmpty);
}
示例#3
0
void Editor::ButtonClicked(std::string name)
{
	if (name == "save")
	{
		if (player == NULL)
		{
			this->gameWindow = new GameWindow(this, "needplayer", "ok", "", false);
		}
		else
		{
			this->gameWindow = new GameWindow(this, "savemap", "ok", "cancel", true);
		}
	}
	if (name == "close")
	{
		this->isEnded = true;
	}
	else if (name == "wall")
	{
		ChangeBrush(ObjectType::EWall);
	}
	else if (name == "box")
	{
		ChangeBrush(ObjectType::EBox);
	}
	else if (name == "destination")
	{
		ChangeBrush(ObjectType::EDestination);
	}
	else if (name == "floor")
	{
		ChangeBrush(ObjectType::EFloor);
	}
	else if (name == "player")
	{
		ChangeBrush(ObjectType::EPlayer);
	}
	else if (name == "empty")
	{
		ChangeBrush(ObjectType::EEmpty);
	}
	else if (name == "windows/ok")
	{
		if (this->gameWindow != NULL)
		{
			if (this->gameWindow->GetName() == "savemap")
			{
				std::string filename = this->gameWindow->GetText();
				delete this->gameWindow;
				this->gameWindow = NULL;

				if (!SaveMap(filename))
				{
					this->gameWindow = new GameWindow(this, "fileexists", "ok", "", false);
				}
			}
			else
			{
				delete this->gameWindow;
				this->gameWindow = NULL;
			}
		}
	}
	else if (name == "windows/cancel")
	{
		if (this->gameWindow != NULL)
		{
			delete this->gameWindow;
			this->gameWindow = NULL;
		}
	}
}