Muto 0.0.1
Cross-Platform Application Template
GitHub Repo | Muto Updates | Muto's Author
Loading...
Searching...
No Matches
Muto::Input Class Reference

Base input class for querying input states. More...

#include <Input.h>

Public Member Functions

 Input (const Input &)=delete
 
Input & operator= (const Input &)=delete
 

Static Public Member Functions

static glm::vec2 GetMousePosition ()
 Gets the current position of the mouse cursor as a 2D vector.
 
static float GetMouseX ()
 Gets the current X position of the mouse cursor.
 
static float GetMouseY ()
 Gets the current Y position of the mouse cursor.
 
static bool IsKeyPressed (int keycode)
 Checks if the specified key is currently pressed.
 
static bool IsMouseButtonPressed (int button)
 Checks if the specified mouse button is currently pressed.
 

Protected Member Functions

 Input ()=default
 

Detailed Description

Base input class for querying input states.

Constructor & Destructor Documentation

◆ Input() [1/2]

Muto::Input::Input ( )
protecteddefault

◆ Input() [2/2]

Muto::Input::Input ( const Input &  )
delete

Member Function Documentation

◆ GetMousePosition()

glm::vec2 Muto::Input::GetMousePosition ( )
static

Gets the current position of the mouse cursor as a 2D vector.

24 {
26 double xPos, yPos;
28 return { (float)xPos, (float)yPos };
29
30 }
Window & GetWindow()
Retrieves the application window.
Definition Application.h:110
static Application & Get()
Retrieves the singleton instance of the Application.
Definition Application.h:107
virtual void * GetNativeWindow() const =0
Retrieves the native window handle.
constexpr Scope< T > CreateScope(Args &&... args)
Creates a Scope (unique_ptr) for the given type and constructor arguments.
Definition Defines_Macros.h:51

References Muto::Application::Get(), Muto::Window::GetNativeWindow(), and Muto::Application::GetWindow().

◆ GetMouseX()

float Muto::Input::GetMouseX ( )
static

Gets the current X position of the mouse cursor.

33 {
34 return GetMousePosition().x;
35 }
static glm::vec2 GetMousePosition()
Gets the current position of the mouse cursor as a 2D vector.
Definition WindowsInput.cpp:23

◆ GetMouseY()

float Muto::Input::GetMouseY ( )
static

Gets the current Y position of the mouse cursor.

37 {
38 return GetMousePosition().y;
39 }

◆ IsKeyPressed()

bool Muto::Input::IsKeyPressed ( int  keycode)
static

Checks if the specified key is currently pressed.

Parameters
keycodeThe keycode of the key to check.
Returns
True if the key is pressed, false otherwise.
10 {
13 return state == GLFW_PRESS || state == GLFW_REPEAT;
14 }

References Muto::Application::Get(), Muto::Window::GetNativeWindow(), and Muto::Application::GetWindow().

Referenced by Muto::EditorLayer::OnImGuiRender(), Muto::EditorLayer::OnKeyPressed(), Muto::EditorCamera::OnUpdate(), and Muto::OrthographicCameraController::OnUpdate().

◆ IsMouseButtonPressed()

bool Muto::Input::IsMouseButtonPressed ( int  button)
static

Checks if the specified mouse button is currently pressed.

Parameters
buttonThe mouse button to check.
Returns
True if the mouse button is pressed, false otherwise.
17 {
20 return state == GLFW_PRESS;
21 }

References Muto::Application::Get(), Muto::Window::GetNativeWindow(), and Muto::Application::GetWindow().

Referenced by Sandbox2D::OnUpdate(), and Muto::EditorCamera::OnUpdate().

◆ operator=()

Input & Muto::Input::operator= ( const Input &  )
delete

The documentation for this class was generated from the following files: