| 05-04-2009, 09:47 PM | #1 |
Do you know that little button at the top right corner of multiboards used to minimize/maximize its display? Messing around with the multiboard API, we can achieve news functions to this tiny button by detecting when its pressed. There is no event that register when this happen, IsMultiboardMinimized() is the only alternative. The first thing I did when looked to this native was verify if it is synchronous or not, because the same multiboard can be at the same time minimized for a player, but maximized for another. The result was what I expected, IsMultiboardMinimized() can return different values, according to the mini/maxi state of the mboard for the local player. So the same caution when using GetLocalPlayer() if-block must be taken when using IsMultiboardMinimized() if-block. To complete the system of detecting the button press event, we just need to put IsMultiboardMinimized() inside a timer with fast periodic execution One application is let the player use this button to toggle the display of the multiboard, so a multiboard can have more than a single view. When the user click it, its not minimized, but changes the mboard appearence. There are two ways to accomplish this feature: 1. For each different view, you setup a multiboard object with CreateMultiboard(), and toggle the view being displayed using MultiboardDisplay() 2. Rather than creating many multiboards, you create only one, and changes it's appearence at run-time, whenever the user toggles its display. However, this is an option only in single player game, because using any of the multiboard visual API function for only the local player can cause desyncs Check the attached sample map. Notice that it: doesn't leak; the 0.001 periodic timer didn't cause any noticeable fps drop; the multiboard changes its title when toggled; flickering ocurring =( Play with mb API is not very user-friendly, and also hard to ellaborate any explanation about this subject, sorry if I wasn't clear in my words. |
| 05-04-2009, 11:44 PM | #2 | |
Quote:
|
| 05-04-2009, 11:57 PM | #3 |
There's no reason for the timer to execute so quickly. Use the average human response time of .25. |
| 05-05-2009, 12:30 AM | #4 | ||
Quote:
Quote:
JASS:// asynchronous if-block if IsMultiboardMinimized( mboard ) then call MultiboardSetRowCount( mboard, 8 ) call MultiboardSetItemValueBJ( mboard, 2, 2, "whatever" ) call MultiboardSetItemColorBJ( mboard, 2, 2, 50.0, 50.0, 50.0, 50.0 ) .. endif MultiboardSetRowCount() is probably safe, but functions that mess with individual itens link those BJ's, need to call MultiboardGetItem/MultiboardReleaseItem which are creating/destroying handles. I tested it, and can confirme that it cause desyncs |
| 05-05-2009, 01:44 AM | #5 |
You realy dont need to redraw board, just keep many multiboards active and display them on demand, |
| 06-08-2009, 07:25 PM | #6 |
why don't create many multiboards and hide/show when minimize, i think it can be faster than resize multiboard. |
