Jump to content

mouse crosshair


aiaf
 Share

Recommended Posts

Hello

 

Wanted to replace the mouse cursor with something else, so i draw a * character.

When i look around with the camera the * character it wobbles around, leaving some drawing marks.

 

I need the crosshair to stay put at the center of screen and move smoothly,

any ideea how to solve this ?

 

if(!console->isMainMenuMode()) {

context->SetBlendMode(Blend::Alpha);

context->DrawText("*", player->currentMousePosition.x, player->currentMousePosition.y);

context->SetBlendMode(Blend::Solid);

}

 

 

Camera is setup as below:

 

camera->Move(camMovement);

currentMousePosition = window->GetMousePosition();

mouseDifference.x = currentMousePosition.x - centerMouse.x;

mouseDifference.y = currentMousePosition.y - centerMouse.y;

camRotation.x += mouseDifference.y / mouseSensitivity;

camRotation.y += mouseDifference.x / mouseSensitivity;

camera->SetRotation(camRotation);

window->SetMousePosition(centerMouse.x, centerMouse.y)

I made this with Leadwerks/UAK:

Structura Stacky Desktop Edition

Website:

Binary Station

Link to comment
Share on other sites

Instead of drawing on the mouse you can try to draw it on the center of the window width and height. This way it will be drawn from the center. Simply use window->GetWidth() / 2 and window->GetHeight() / 2

Using Leadwerks Professional Edition (Beta), mainly using C++.

Windows 10 / Linux Mint, Visual Studio 2017. GPU: NVidia GeForce GTX970, CPU: Intel i7 7700K @ 4.20 GHz

Previously known as Evayr.

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...