Esempio n. 1
0
TEST(UtilsTest, str2color)
{
  std::string s = "0910FF";

  TCODColor col = strToColor(s);

  EXPECT_EQ((int)col.r, (int)0x09);
  EXPECT_EQ((int)col.g, (int)0x10);
  EXPECT_EQ((int)col.b, (int)0xFF);
}
Esempio n. 2
0
TileDescription* TileParser::parseTileDsc()
{
  TileDescription* tileDsc = nullptr;

  if ( _xml != nullptr)
  {
    tileDsc = new TileDescription;

    tileDsc->type =  static_cast<TileType>(getAttribute<int>(_xml, "id"));
    tileDsc->character = getAttribute<std::string>(_xml, "character").front();
    tileDsc->color = strToColor( getAttribute<std::string>(_xml, "color") );
    tileDsc->walkable = getAttribute<bool>(_xml, "walkable");
    tileDsc->transparent = getAttribute<bool>(_xml, "transparent");
  }

  return tileDsc;
}
Esempio n. 3
0
int getColor()
{
	int color;

	char msg[20];

	if (game_state.player == HUMAN)
	{
		change_color = 1;
		color = strToColor(getInput());
	}
	else
		color = chooseColor(CARDS[game_state.player]);

	strcpy(msg, "颜色变为: ");
	int length = strlen(msg);
	strcpy(msg + length, colorToStr(color));
	length = strlen(msg);
	strcpy(msg + length, "\0");  
	addMsg(msg);

	return color;
}
Esempio n. 4
0
int setColor3(String command) {
	c3 = strToColor(command);
	return 1;
}
Esempio n. 5
0
int setColor2(String command) {
	c2 = strToColor(command);
	return 1;
}
Esempio n. 6
0
int setColor1(String command) {
	c1 = strToColor(command);
	return 1;
}
Esempio n. 7
0
int GUI_TextField::pset_FontFocusedColor(Variant value)
{
    SetFontFocusedColor(strToColor(value));
    return 0;
}
Esempio n. 8
0
int GUI_TextField::pset_FontColor(Variant value)
{
    SetFontNormalColor(strToColor(value));
    return 0;
}