Skip to content

2.0.0

Latest

Choose a tag to compare

@StardustMotion StardustMotion released this 13 Oct 00:16
· 1 commit to main since this release
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