Repository navigation
Download
New
- Added
SetTextColor(str code), which sets the default text color for subsequentDrawText()/ShowText()calls - UI Editor: Chat messages prefixed with
$are now evaluated as LANGUAGE entries, e.g.$QUITMSGor$MGUI_EDITOR_OPEN#14
Changed
- Maximum simultaneous mouse areas: 256 → 512 #15
GetMouseArea()removed; replaced byCheckMouseArea(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; removedMGUI_SetDebug() - Reworked the mouse event API to allow assigning different event handler scripts to each
areaIdand 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
areaIdvalueMGUI_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 :
- Replaces your
megaUI.acswith the new version's - Remove the argument from your
StartMouseMenu()calls - Change your event handler script argument order :
(int e, int areaId)=>(int areaId, int e) - Use
AddAllMouseEvents(areaId, "Your event handler script")on each of yourSetMouseArea()-defined areas
Though a better approach is to start using the individual AddMouse methods.
See API for more details, or check the updated examples