HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

IsMultiboardMinimized() abuse = multiboard with multiple views

05-04-2009, 09:47 PM#1
midiway
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.
Attached Files
File type: w3xMultiViewsBoard.w3x (41.5 KB)
05-04-2009, 11:44 PM#2
Pyrogasm
Quote:
Originally Posted by midiway
using any of the multiboard visual API function for only the local player can cause desyncs
Why so? That doesn't make any sense.
05-04-2009, 11:57 PM#3
Blackroot
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
midiway
Quote:
Originally Posted by Blackroot
There's no reason for the timer to execute so quickly. Use the average human response time of .25.
it's up of how much you want the flickering to be noticiable, unfortunately, even a 0.0 timer doesn't eliminate this glitch

Quote:
Originally Posted by Pyrogasm
Why so? That doesn't make any sense.
The first time I implemented this kind of multiboard, I used the first way described, redraw the entire mboard whenever it is toggled, something like this:
Collapse 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
DioD
You realy dont need to redraw board, just keep many multiboards active and display them on demand,
06-08-2009, 07:25 PM#6
youkaiz
why don't create many multiboards and hide/show when minimize, i think it can be faster than resize multiboard.