Esempio n. 1
0
void Room::Update(float dt)
{
	UpdateLamp(dt);
	static MouseState prevState;
	MouseState currentState;
	if (m_mouse->GetState(currentState))
	{
		bool change = true;
		if (prevState.isButtonDown(0))
		{
			auto d = currentState.getMousePositionChange();
			m_camera.Rotate(d.y/300.f, d.x/300.f);
		}
		else if (prevState.isButtonDown(1))
		{
			auto d = currentState.getMousePositionChange();
			m_camera.Zoom(d.y/10.0f);
		}
		else
			change = false;
		prevState = currentState;
		if (change)
			UpdateCamera();
	}
	m_particles->Update(m_context, dt, m_camera.GetPosition());
}
Esempio n. 2
0
    void InputField::mouseClickListener() {
        MouseState* mouseState = getDriver()->getInput()->getMouseState();
        Box3 bb = getBoundingBox();
        Vector3 campos;
        if(getDriver()->getActiveCameras()->at(0) == nullptr)
            campos = Vector3();
        else
            campos = getDriver()->getActiveCameras()->at(0)->getPosition();

        if(bb.contains(mouseState->getPosition() + campos) && mouseState->isButtonDown(Buttons::LEFT_MOUSE)) {
            onClick(mouseState);
            mouseState->handleEvent(Buttons::LEFT_MOUSE, 0);
        } else if(mouseState->isButtonDown(Buttons::LEFT_MOUSE)) {
            onUnClicked(mouseState);
        }
    }
Esempio n. 3
0
void BrushTool::mouseMoveEvent(MouseState mouse, QImage *layer, QImage *hud, QImage *selection, bool *useSelection)
{
    if(mouse.isButtonDown(Qt::LeftButton)){
        hud->fill(Qt::transparent);

        QImage temp(layer->size(), layer->format());
        temp.fill(Qt::transparent);

        QPainter *painter = this->getPainter(&temp);

        if(m_brushSize->value() == 1)
            Tool::drawPerfectLine(painter, mouse.getPos(), m_last);
        else
            painter->drawLine(mouse.getPos(), m_last);

        delete painter;

        if(QVector2D(mouse.getPos() - m_last).lengthSquared() >= (m_brushSize->value() + 2) * m_brushSize->value()){
            m_last = mouse.getPos();

            this->drawInSelection(layer, &temp, selection, useSelection);
        }
        else{
            this->drawInSelection(hud, &temp, selection, useSelection);
        }
    }
}
void GradientTool::mouseMoveEvent(MouseState mouse, QImage *layer, QImage *hud, QImage *selection, bool *useSelection)
{
    if(mouse.isButtonDown(Qt::LeftButton)){
        hud->fill(Qt::transparent);

        QImage temp(layer->size(), layer->format());
        temp.fill(Qt::transparent);

        this->drawGradient(mouse, &temp, this->getColor(m_from->currentText()), this->getColor(m_to->currentText()));
        this->drawInSelection(hud, &temp, selection, useSelection);
    }
}
Esempio n. 5
0
void Scene::Update(float dt)
{
	MoveSheldersMatrix();
	static MouseState prevState;
	MouseState currentState;
	if (m_mouse->GetState(currentState))
	{
		if (prevState.isButtonDown(0))
			ReadKeyboard(true);
		else
			ReadKeyboard(false);
		prevState = currentState;
	}
	UpdateCamera(XMMatrixIdentity());
	m_particles->Update(m_context, dt, m_camera.GetPosition());
}
Esempio n. 6
0
void Scene::Update(float dt)
{
	UpdateInput();
	static MouseState prevState;
	MouseState currentState;
	if (!m_mouse->GetState(currentState))
		return;
	bool change = true;
	if (prevState.isButtonDown(0))
	{
		POINT d = currentState.getMousePositionChange();
		m_camera.Rotate(d.x / 300.f, d.y / 300.f);
	}
	else
		change = false;
	prevState = currentState;
	//if (change)
	UpdateCamera(m_camera.GetViewMatrix());
	//UpdateScene(dt);
	if (m_menu->animationPending)
		UpdateCube(dt);

	//m_particles->Update(m_context, dt, m_camera.GetPosition());
}