GetMousePosition

This function gets the mouse position. The X and Y components of the returned values are the screen coordinates, and the Z component is the mouse wheel position.

Syntax

Returns

Returns the current mouse position.

Example

#include "Leadwerks.h"

using namespace Leadwerks;

int main(int argc, const char *argv[])
{
Leadwerks::Window* window = Leadwerks::Window::Create();
Context* context = Context::Create(window);
World* world = World::Create();
Camera* camera = Camera::Create();
camera->Move(0,0,-3);
Light* light = DirectionalLight::Create();
light->SetRotation(35,35,0);

//Create a model
model = Model::Box();
model->SetColor(0.0,0.0,1.0);

while (true)
{
if (window->Closed() || window->KeyDown(Key::Escape)) return false;

model->Turn(0,Leadwerks::Time::GetSpeed(),0);

Leadwerks::Time::Update();
world->Update();
world->Render();

context->SetBlendMode(Blend::Alpha);
context->DrawText("Mouse position: "+window->GetMousePosition().ToString(), 2, 2);
context->SetBlendMode(Blend::Solid);

context->Sync();

}
return 0;
}