New Addon Events

Find news and updates about the Ashita project posted here.
Post Reply
User avatar
atom0s
Site Admin
Posts: 375
Joined: Sat May 14, 2016 5:13 pm

New Addon Events

Post by atom0s » Sat Jan 20, 2018 6:27 pm

Hello everyone,

Last night I pushed a small update to Ashita and to the Addons plugin to expose two new events.
- key
- mouse

These events can be used by addons to handle input from the keyboard and mouse.

Changelog
  • Addons: Added key event for keyboard input processing.
  • Addons: Added mouse event for mouse input processing.
  • Ashita: Changed the order in which mouse events were handled internally so that addons and plugins see the mouse events before the internal handlers such as the font manager.

The key event looks like:
  1. ashita.register_event('key', function(key, down, blocked)
  2.  
  3.     return false;
  4. end);
The params are:
- key - number - The DirectInput id of the key press.
- down - boolean - The down/up state of the key. (True if down, false if up.)
- blocked - boolean - Flag if another addon has blocked the key press. (True if blocked by another addon.)

The mouse event looks like:
  1. ashita.register_event('mouse', function(id, x, y, delta, blocked)
  2.  
  3.     return false;
  4. end);
The params are:
- id - number - The windows event id of the mouse event. (See here for notification ids: https://msdn.microsoft.com/en-us/librar ... s.85).aspx)
- x - number - The x axis point of the mouse.
- y - number - The y axis point of the mouse.
- delta - number - The scroll wheel delta of the mouse when scrolling.
- blocked - boolean - Flag if another addon has blocked the mouse event. (True if blocked by another addon.)
Lead Ashita Developer

Want to donate to say thanks?
https://www.paypal.me/atom0s
Post Reply