Search Results for

    Show / Hide Table of Contents

    Class Mouse

    Represents a single hardware mouse device. Used by the Input to report raw mouse input events.

    The mouse device position is in screen-space (not game client window space).

    Inheritance
    Object
    ScriptingObject
    InputDevice
    Mouse
    Inherited Members
    ScriptingObject::_gcHandle
    ScriptingObject::_id
    InputDevice::_name
    InputDevice::_queue
    ScriptingObject::_type
    ScriptingObject::CanCast(const ScriptingTypeHandle& from, const ScriptingTypeHandle& to)
    ScriptingObject::CanCast(const MClass* from, const MClass* to)
    ScriptingObject::Cast(ScriptingObject* obj)
    ScriptingObject::ChangeID(const Guid& newId)
    ScriptingObject::CreateManaged()
    ScriptingObject::CreateManagedInternal()
    ScriptingObject::Deleted
    Object::DeleteObject(float timeToLive = 0.0f, bool useGameTime=false)
    Object::DeleteObjectNow()
    ScriptingObject::DestroyManaged()
    Mouse
    Mouse
    Object::Flags
    ScriptingObject::FromInterface(void* interfaceObj, const ScriptingTypeHandle& interfaceType)
    ScriptingObject::FromInterface(T* interfaceObj)
    ScriptingObject::GetClass()
    ScriptingObject::GetID()
    ScriptingObject::GetManagedInstance()
    InputDevice::GetName()
    ScriptingObject::GetOrCreateManagedInstance()
    ScriptingObject::GetType()
    ScriptingObject::GetTypeHandle()
    ScriptingObject::HasManagedInstance()
    InputDevice::InputDevice(const SpawnParams& params, const StringView& name)
    ScriptingObject::Is(const ScriptingTypeHandle& type)
    ScriptingObject::Is(const MClass* type)
    ScriptingObject::Is()
    ScriptingObject::IsRegistered()
    ScriptingObject::NewObject(const ScriptingTypeHandle& typeHandle)
    ScriptingObject::NewObject()
    ScriptingObject::OnDeleteObject()
    ScriptingObject::OnManagedInstanceDeleted()
    ScriptingObject::OnScriptingDispose()
    ScriptingObject::RegisterObject()
    ScriptingObject::ScriptingObject(const SpawnParams& params)
    ScriptingObject::SetManagedInstance(MObject* instance)
    Mouse
    ScriptingObject::ToInterface(ScriptingObject* obj, const ScriptingTypeHandle& interfaceType)
    ScriptingObject::ToInterface(ScriptingObject* obj)
    ScriptingObject::ToManaged(const ScriptingObject* obj)
    ScriptingObject::ToNative(MObject* obj)
    ScriptingObject::ToString()
    ScriptingObject::UnregisterObject()
    InputDevice::UpdateState()
    Object::~Object()
    ScriptingObject::~ScriptingObject()
    Assembly: FlaxEngine.dll
    File: Engine/Input/Mouse.h
    Syntax
    public class Mouse : public InputDevice

    Constructors

    Mouse()

    Declaration
    protected Mouse()

    Fields

    _prevState

    Declaration
    protected State _prevState
    Field Value
    State

    _state

    Declaration
    protected State _state
    Field Value
    State

    Methods

    GetButton(MouseButton button)

    Gets the mouse button state (true if being pressed during the current frame).

    Declaration
    public bool GetButton(MouseButton button) const
    Parameters
    MouseButton button

    Mouse button to check

    Returns
    bool

    True if user holds down the button, otherwise false.

    GetButtonDown(MouseButton button)

    Gets the mouse button down state (true if was pressed during the current frame).

    Declaration
    public bool GetButtonDown(MouseButton button) const
    Parameters
    MouseButton button

    Mouse button to check

    Returns
    bool

    True if user starts pressing down the button, otherwise false.

    GetButtonUp(MouseButton button)

    Gets the mouse button up state (true if was released during the current frame).

    Declaration
    public bool GetButtonUp(MouseButton button) const
    Parameters
    MouseButton button

    Mouse button to check

    Returns
    bool

    True if user releases the button, otherwise false.

    GetPosition()

    Gets the position of the mouse in the screen-space coordinates.

    Declaration
    public Float2 GetPosition() const
    Returns
    Float2

    GetPositionDelta()

    Gets the delta position of the mouse in the screen-space coordinates.

    Declaration
    public Float2 GetPositionDelta() const
    Returns
    Float2

    GetScrollDelta()

    Gets the mouse wheel change during the last frame.

    Declaration
    public float GetScrollDelta() const
    Returns
    float

    IsAnyButtonDown()

    Checks if any mouse button is currently pressed.

    Declaration
    public bool IsAnyButtonDown() const
    Returns
    bool

    OnMouseDoubleClick(const Float2& position, const MouseButton button, Window* target=nullptr)

    Called when mouse double clicks.

    Declaration
    public void OnMouseDoubleClick(const Float2& position, const MouseButton button, Window* target=nullptr)
    Parameters
    Float2 position

    The mouse position.

    MouseButton button

    The button.

    Window target

    The target window to receive this event, otherwise input system will pick the window automatically.

    OnMouseDown(const Float2& position, const MouseButton button, Window* target=nullptr)

    Called when mouse button goes down.

    Declaration
    public void OnMouseDown(const Float2& position, const MouseButton button, Window* target=nullptr)
    Parameters
    Float2 position

    The mouse position.

    MouseButton button

    The button.

    Window target

    The target window to receive this event, otherwise input system will pick the window automatically.

    OnMouseLeave(Window* target=nullptr)

    Called when mouse leaves the input source area.

    Declaration
    public void OnMouseLeave(Window* target=nullptr)
    Parameters
    Window target

    The target window to receive this event, otherwise input system will pick the window automatically.

    OnMouseMove(const Float2& position, Window* target=nullptr)

    Called when mouse moves.

    Declaration
    public void OnMouseMove(const Float2& position, Window* target=nullptr)
    Parameters
    Float2 position

    The mouse position.

    Window target

    The target window to receive this event, otherwise input system will pick the window automatically.

    OnMouseMoved(const Float2& newPosition)

    Called when mouse cursor gets moved by the application. Invalidates the previous cached mouse position to prevent mouse jitter when locking the cursor programmatically.

    Declaration
    public void OnMouseMoved(const Float2& newPosition)
    Parameters
    Float2 newPosition

    The new mouse position.

    OnMouseUp(const Float2& position, const MouseButton button, Window* target=nullptr)

    Called when mouse button goes up.

    Declaration
    public void OnMouseUp(const Float2& position, const MouseButton button, Window* target=nullptr)
    Parameters
    Float2 position

    The mouse position.

    MouseButton button

    The button.

    Window target

    The target window to receive this event, otherwise input system will pick the window automatically.

    OnMouseWheel(const Float2& position, float delta, Window* target=nullptr)

    Called when mouse wheel moves.

    Declaration
    public void OnMouseWheel(const Float2& position, float delta, Window* target=nullptr)
    Parameters
    Float2 position

    The mouse position.

    float delta

    The normalized delta (range [-1;1]).

    Window target

    The target window to receive this event, otherwise input system will pick the window automatically.

    ResetState()

    Resets the input device state. Called when application looses focus.

    Declaration
    public virtual void ResetState() override
    Overrides
    InputDevice::ResetState()

    SetMousePosition(const Float2& newPosition)

    Sets the mouse position.

    Declaration
    public virtual void SetMousePosition(const Float2& newPosition) = 0
    Parameters
    Float2 newPosition

    The new position.

    Update(EventQueue& queue)

    Captures the input since the last call and triggers the input events.

    Declaration
    public virtual bool Update(EventQueue& queue) final override
    Parameters
    EventQueue queue

    The input events queue.

    Returns
    bool

    True if device has been disconnected, otherwise false.

    Overrides
    InputDevice::Update(EventQueue& queue)
    • Improve this Doc
    • View Source
    In This Article
    Back to top Copyright © 2012-2024 Wojciech Figat