Example #1
0
void MaskBrush::BrushMove(const ImpPoint source, const ImpPoint target)
{
	ImpressionistDoc* pDoc = GetDocument();

	if (pDoc == NULL) {
		printf("MaskBrush::BrushMove  document is NULL\n");
		return;
	}

	glPushMatrix();
	glTranslatef(target.x, target.y, 0);

	int xOffset = -width / 2;
	int yOffset = -height / 2;
	for (int x = 0; x < width; x++) {
		for (int y = 0; y < height; y++) {
			int mappedX = x + xOffset;
			int mappedY = y + yOffset;
			glBegin(GL_POINTS);
			SetColor(source, atPosition(x, y));
			glVertex2d(mappedX, mappedY);
			glEnd();
		}
	}

	glPopMatrix();
}
bool CharLine::isEqual(const char string[]) const
{
    if (size != getStrSize(string))
        return false;
    for (int i = 0; i < size; i++)
        if (atPosition(i) != string[i])
            return false;
    return true;
}
bool PickupManager::CheckDirection(float _x, float _y, int _dir)
{
	switch(_dir)
	{
		case 0:
			if ( atPosition(sf::Vector2f(_x + 64.f, _y - 64.f)) != -1 )
				return true;
		break;
		case 1:
			if ( atPosition(sf::Vector2f(_x + 64.f + 128.f, _y + 64.f)) != -1 )
				return true;
		break;
		case 2:
			if ( atPosition(sf::Vector2f(_x + 64.f, _y + 64.f + 128.f)) != -1 )
				return true;
		break;
		case 3:
			if ( atPosition(sf::Vector2f(_x - 64.f, _y + 64.f)) != -1 )
				return true;
	break;
	}
	//std::cout << "WRONG?" << std::endl;
	return false;
}
int CDiagonalMatrix::getWidth(int x, int y) const {
    if (x == y)
        return atPosition(x, y).getWidth();
    else
        return 1;
}