Skip to content

Releases: StardustMotion/megaUI

Release list

2.0.0

Choose a tag to compare

@StardustMotion StardustMotion released this 13 Oct 00:16
8a9b8b8

Download

New

  • Added SetTextColor(str code), which sets the default text color for subsequent DrawText()/ShowText() calls
  • UI Editor: Chat messages prefixed with $ are now evaluated as LANGUAGE entries, e.g. $QUITMSG or $MGUI_EDITOR_OPEN #14

Changed

  • Maximum simultaneous mouse areas: 256 → 512 #15
  • GetMouseArea() removed; replaced by CheckMouseArea(int areaId), which checks whether the cursor is hovering over the given area.
  • Debug mode is now enabled at compile time via a constant in megaUI.acs ; removed MGUI_SetDebug()
  • Reworked the mouse event API to allow assigning different event handler scripts to each areaId and to each event type, improving code maintainability #16 :
    • StartMouseMenu() no longer takes an event handler argument
    • The event handler's arguments swapped, from (int e, int areaId) to (int areaId, int e)
    • Mouse areas must now subscribe to an event for it to fire, and can unsubscribe at anytime ; they are given below :
Susbcribe method Semantic Unsubscribe method
AddMouseEnter Mouse enters area RemoveMouseEnter
AddMouseExit Mouse leaves area RemoveMouseExit
AddMouseDown Mouse left (mainfire) button press on area RemoveMouseDown
AddMouseUp Mouse left (mainfire) button release on area RemoveMouseUp
AddMouseAltDown Mouse right (altfire) button press on area RemoveMouseAltDown
AddMouseAltUp Mouse right (altfire) button release on area RemoveMouseAltUp
AddAllMouseEvents Shorthand for all the 6 event types above RemoveAllMouseEvents
  • You can register events to the special areaId value MGUI_SCREEN_AREA ; it is an area covering the full screen

Migration guide

Given the new event architecture, the minimum to do for MegaUI 1.1.0 => 2.0.0 migration is :

  1. Replaces your megaUI.acs with the new version's
  2. Remove the argument from your StartMouseMenu() calls
  3. Change your event handler script argument order : (int e, int areaId) => (int areaId, int e)
  4. Use AddAllMouseEvents(areaId, "Your event handler script") on each of your SetMouseArea()-defined areas

Though a better approach is to start using the individual AddMouse methods.

See API for more details, or check the updated examples

1.1.0

Choose a tag to compare

@StardustMotion StardustMotion released this 26 Sep 08:40

Download

  • Added a GetMouseArea() function to get the currently hovered mouse area #11
  • Fixed an issue on megagame4 where the arrows still reacted after closing item window #12
  • Changed API to clarify you can juste set ShowText/DrawText's wrap to 0 for the default wrapping behavior of SetHudClipRect ; updated minigames with wrap = 0 for clarity

UI Editor

  • The generated code order is now back stamps => front stamps, instead of the opposite