Giter Site home page Giter Site logo

yal-gamemaker / display_mouse_sim Goto Github PK

View Code? Open in Web Editor NEW
3.0 2.0 0.0 49 KB

Minimalistic mouse automation functions (to go along keyboard_key_press/release) for GameMaker (GM8, GMS1, GMS2+)

Game Maker Language 20.75% C++ 50.68% C 23.17% Batchfile 5.39%
gamemaker winapi sdk-wrapper

display_mouse_sim's Introduction

display_mouse_sim

Minimalistic mouse automation functions.

Functions

  • display_mouse_button_press(button)
    Presses the given mouse button (analogous to keyboard_key_press)
  • display_mouse_button_release(button)
    Releases the given mouse button (analogous to keyboard_key_release)
  • display_mouse_button_check_direct(button)
    Checks if the given mouse button is currently held down (analogous to keyboard_check_direct)
  • display_mouse_wheel_scroll(amount)
    Sends a scroll wheel event.
    Usually, amount of 120 is one scroll up and -120 is one scroll down, but you may find that many applications don't actually care about amount at all, only the direction.

Supported mouse buttons are mb_left, mb_right, and mb_middle.

Example

Create:

left_down = 0;

Step:

var left_prev = left_down;
left_down = keyboard_check_direct(vk_shift);
if (left_down && !left_prev) display_mouse_button_press(mb_left);
if (!left_down && left_prev) display_mouse_button_release(mb_left);

if (keyboard_check_direct(vk_lalt)) display_mouse_wheel_scroll(120); // up
if (keyboard_check_direct(vk_ralt)) display_mouse_wheel_scroll(-120); // down

This would allow you to press the left mouse button by pressing Shift and scroll up/down by pressing Left Alt and Right Alt accordingly.

Installing

  • GameMaker 8.1 and older:
    Add the DLL as an included file.
    Add the scripts using menu:Scripts➜Import Scripts
  • GameMaker: Studio:
    Import the GMEZ by right-clicking Extensions folder in resource tree and picking "Import extension"
  • GameMaker Studio 2 Import the YYMP by drag and dropping it onto your workspace or picking menu:Tools➜Import Local Package

Meta

Author: YellowAfterlife
License: MIT

display_mouse_sim's People

Contributors

yellowafterlife avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.