Esempio n. 1
0
// Initialize
int PuzzleTV::start(Utils* utils, int width, int height)
{
	LOGI("%s(L=%d): w=%d, h=%d", __func__, __LINE__, width, height);
	if (super::start(utils, width, height) != 0) {
		return -1;
	}

	if (setBlockNum(4) != 0) {
		return -1;
	}

	return 0;
}
Esempio n. 2
0
void CBlockType2::reBuild()
{
	for (int i = 0; i < getBlockNum(); i++)
	{
		delete getRectArr()[i];
	}
	setBlockNum(rand() % 3 + 4);
	for (int i = 0; i < getBlockNum(); i++)
	{
		CRectangle *temp = new CRectangle(getX(), getY() + ((i * 2) * 16), 16);
		temp->setColor(getColor());
		setRectArr(i, temp);
	}
}
Esempio n. 3
0
// Key functions
const char* PuzzleTV::event(int key_code)
{
	LOGI("%s(L=%d): k=%d", __func__, __LINE__, key_code);
	switch(key_code) {
	case 0: // 4x4
	case 1: // 5x5
	case 2: // 6x6
		setBlockNum(key_code+4);
		break;
	case 3: // Hint On/Off
		hint = 1 - hint;
		break;
	}
	return NULL;
}