Jump to content

MouseDown not working with Uak + Leadwerks example.


Vida Marcell
 Share

Recommended Posts

//Values
    Vec2 mouseRot;

    while (true)
    {
        if (mainwindow->Closed() or mainwindow->KeyDown(UltraEngine::KEY_ESCAPE)) break;
        
        mouseRot = Vec2(mainwindow->GetMousePosition().x * -1 / 1.71, mainwindow->GetMousePosition().y * -1 / 1.71);
        
        if (window->MouseDown(3))
        {
            model->SetRotation(0, mouseRot[0], mouseRot[1]);
        }

I can rotate the model but it does'nt recognize any mouse button interactions.

Link to comment
Share on other sites

Haven't really played with UAK in a while. Verify the mouse hit if statement is actually turning true with a breakpoint or a print out., also I don't recall being able to get the values of the Vec2 class like if it was an array. Try using this instead.

 model->SetRotation(0, mouseRot.x, mouseRot.y);

 

Cyclone - Ultra Game System - Component PreprocessorTex2TGA - Darkness Awaits Template (Leadwerks)

If you like my work, consider supporting me on Patreon!

Link to comment
Share on other sites

So this is my* code, vs can compile it, but i cant interact with any of my keyboard and mouse buttons

while (true)
    {
        if (mainwindow->Closed() or mainwindow->KeyDown(UltraEngine::KEY_ESCAPE)) break;

		mousedown = false;

		if (window->MouseDown(1))
		{
			m_vCamRot.y += (window->MouseX() - (window->GetWidth() / 2)) * Time::GetSpeed() * 0.2;
			m_vCamRot.x += (window->MouseY() - (window->GetHeight() / 2)) * Time::GetSpeed() * 0.2;
			mousedown = true;
		}

		m_vCamRot.z = -3 + window->GetMousePosition().z;

		if (mousedown)
		{
			window->HideMouse();
			window->SetMousePosition(window->GetWidth() / 2, window->GetHeight() / 2);
		}
		else
		{
			window->ShowMouse();
		}

		Vec3 pos = m_pCamPivot->GetPosition();
		camera->SetPosition(pos.x, pos.y + 0.5, pos.z);
		camera->SetRotation(m_vCamRot.x, m_vCamRot.y, 0);
		camera->Move(0, 0, m_vCamRot.z);

This still uses uak and leadwerks. 

*Most of the code is from reepblue!

Link to comment
Share on other sites

UAK does not have control over the window. Leadwerks does. So you would use the Leadwerks commands for the mouse and keyboard input.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...