Skip to content

Async Social Events

Nikita Krapivin edited this page May 7, 2021 · 2 revisions

libmulti Async Social Events

Some stuff is better told to you via the Social event.

Most of the official extensions by YoYo which use this event have an event_type key in the async_load.

So I'm using it too.

And that's how I'm going to label them, by the event_type key's value.

libmulti_size

Keys:

  • window - window index associated with this event.
  • new_width - new width of the window
  • new_height - new height of the window

Happens when the size of the window is changed.

libmulti_close

Keys:

  • window - window index associated with this event.

Happens when either you closed the window, or pressed Alt-F4, or something had asked the window to close itself.

This event usually means that a libmulti_destroy event will happen on the next frame.

libmulti_destroy

Keys:

  • window - window index associated with this event.

When you get this event, the window is already gone, it's useless to call any libmulti_ functions with that window.

It only exists to tell you that you shouldn't reference that window anymore.

libmulti_mouseenter

Keys:

  • window - window index associated with this event.
  • x - x position of the mouse, relative to your window's client area.
  • y - y position of the mouse, relative to your window's client area.

Happens when the mouse had just entered the window's client area.

Usually after 300ms or so, a libmulti_mousehover event will occur.

Remember when you hover your mouse over a button, the Tip Text above the button shows only after a second? Well the hover event is that thing.

And this event happens asap.

libmulti_mousehover

Keys:

  • window - window index associated with this event.
  • x - x position of the mouse, relative to your window's client area.
  • y - y position of the mouse, relative to your window's client area.

Happens when Windows thinks your mouse is 'hovering' over a window, it is not the same as libmulti_mouseenter.

This one happens only after 300 miliseconds or so, depending on your Windows version.

If you're fast enough, you may not get this event at all.

libmulti_mouseleave

Keys:

  • window - window index associated with this event.

Happens as soon as the mouse leaves the window's client area.

You can't access the mouse's position here, since it is already outside of the window's bounds.

Feel free to use GameMaker's functions to try to get it, I don't care.

libmulti_pastetext

Keys:

  • window - window index associated with this event.
  • contents - the text as a string, or 0 as a number if an error has occurred.

Happens when the user tries to paste some text into a window.

If, for some reason, the clipboard cannot be accessed, contents will be a number 0 and not a string.

You can use the is_string function to check if the contents value is really a string.

libmulti_leftdown/libmulti_leftup/libmulti_rightdown/libmulti_rightup/libmulti_middledown/libmulti_middleup

Keys:

  • window - window index associated with this event.
  • x - x position of the mouse, relative to your window's client area.
  • y - y position of the mouse, relative to your window's client area.

Analogue of the GameMaker's mouse events.

leftdown - Left Pressed

leftup - Left Released

and so on...

libmulti_input

Keys:

  • window - window index associated with this event.
  • character - raw UTF-16 character code as a number.
  • as_string - character converted from a UTF-16 character into a UTF-8/GM:S string.
  • repeat_count - see MSDN and WM_CHAR event in particular.
  • scan_code - see MSDN and WM_CHAR event in particular.
  • is_extended_key - see MSDN and WM_CHAR event in particular.
  • reserved - see MSDN and WM_CHAR event in particular.
  • context_code - see MSDN and WM_CHAR event in particular.
  • previous_state - see MSDN and WM_CHAR event in particular.
  • transition_state - see MSDN and WM_CHAR event in particular.

Happens when the user presses a keyboard key while some libmulti window is active.

Enter key is $0D (carriage return). You may want to replace that with $0A (actual newline) when appending to a string. Backspace is $08, you may want to simply delete the last character of the string instead of appending that character. and so on, see the ASCII character table for more info about special characters.