Skip to content

NodeppOfficial/nodepp-input

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 

Repository files navigation

NodePP Input Emulation: Simulate Keyboard, Mouse, Gamepad, and Touch

This project provides a powerful and cross-platform solution for programmatically emulating various user inputs (keyboard, mouse, gamepad, and touch) on Windows, Linux, FreeBSD, and macOS, all within the NodePP asynchronous and event-driven C++ framework. Automate tasks, create interactive installations, or build testing tools by programmatically controlling user input.

Key Features

  • Cross-Platform Support: Works seamlessly on Windows, Linux, FreeBSD, and macOS.
  • Keyboard Emulation: Simulate key presses, releases, and typing.
  • Mouse Emulation: Control mouse movement, clicks (left, right, middle, etc.), and scrolling.
  • Gamepad Emulation: Simulate button presses, analog stick movements, and trigger actions for game controllers.
  • Touch Input Emulation: Simulate touch events (down, up, move) for touch-enabled devices.
  • Asynchronous Operations: Input events are triggered non-blockingly, fitting perfectly within NodePP's event-driven architecture.
  • NodePP Integration: Leverages the performance and concurrency of NodePP's C++ foundation for responsive input simulation.

Dependencies

- 🐧libx11-dev : sudo apt install libx11-dev
- 🐧libxi-dev  : sudo apt install libxi-dev

Build & Run

- 🪟: g++ -o main main.cpp -I ./include -lws2_32 ; ./main
- 🐧: g++ -o main main.cpp -I ./include lX11 -lXtst -lXi ; ./main

Example

#include <nodepp/nodepp.h>
#include <nodepp/json.h>
#include <input/mouse.h>

using namespace nodepp;

void onMain(){

    ptr_t<mouse_t> mouse = new mouse_t();

    mouse->onMotionMove([]( uint x, uint y ){
        console::log( json::stringify( object_t({
           { "x", x }, { "y", y }
        }) ));
    });

    mouse->move( 100, 100 );

    process::add([=](){ mouse->next(); return 1; });

}

About

Emulate Keyboard/Mouse Inputs in Windows, Linux and Mac, using Nodepp.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published