HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

[Bug] Multiboard Width Tells Lies

01-06-2009, 02:32 AM#1
Ammorth
I searched the forums before posting this, so if this is already known, disregard this post.

While messing with my TextParse System I noticed that a word didn't fit on the multiboard. I began to analyze the code and came to the conclusion that the char width database would need a revision. So, I went ahead and devised a testmap to do just that.

This is where I noticed the error.

I was planning to use a multiboard which encompassed 50% of the the screen (0.50 in multiboard width terms) and then would calculate how many chars could fit on that and could therefore calculate the width of each char on screen. When I started up the map, I noticed the multi board was considerably larger than 50% (since the time globe of the UI is roughly at 50%). I thought I screwed something up, so I checked my code and realized I was not in error, Blizzard was yet again.

It turns out, the REAL max width of a multiboard is 0.78 or 78%. So, when you pass 78% to the function (both Jass and GUI, it will completely cover the screen).

Collapse JASS:
function Trig_Untitled_Trigger_001_Actions takes nothing returns nothing
    call CreateMultiboardBJ( 1, 1, "TRIGSTR_004" )
    call MultiboardSetItemStyleBJ( GetLastCreatedMultiboard(), 1, 1, true, false )
    call MultiboardSetItemWidthBJ( GetLastCreatedMultiboard(), 1, 1, 78.00 )
    call MultiboardDisplayBJ( true, GetLastCreatedMultiboard() )
endfunction

//===========================================================================
function InitTrig_Untitled_Trigger_001 takes nothing returns nothing
    set gg_trg_Untitled_Trigger_001 = CreateTrigger(  )
    call TriggerRegisterTimerEventSingle( gg_trg_Untitled_Trigger_001, 0.00 )
    call TriggerAddAction( gg_trg_Untitled_Trigger_001, function Trig_Untitled_Trigger_001_Actions )
endfunction
This will cover the entire screen (GUI, so 0 - 100 is the acceptable range for width).

Anyways, I am now rebuilding the width table to compensate for this weird happening. I don't remember it before, but both 1.21 and 1.22 experience the same issue.

And for shits and giggles, this nifty function will convert your widths to the true width (GUI and JASS friendly):
Collapse JASS:
function WidthToMultiboardWidth takes real width returns real
    return width*.78
endfunction

Note: real 50% is not actually at 50% since real 0% is not 0 pixels.

Have a nice day!
01-06-2009, 12:55 PM#2
SanKakU
i think 50 percent is about 50 capitalized letters. i did 15 percent and 15 capitalized letters. and it fit.
01-08-2009, 06:31 AM#3
Ammorth
Quote:
Originally Posted by SanKakU
i think 50 percent is about 50 capitalized letters. i did 15 percent and 15 capitalized letters. and it fit.

A capital W and a capital I are completely different in width.

I have updated my version of the text parse but haven't gotten the chance to throughly test the new database before releasing. Expect it over the weekend.

Also, I didn't test this for widescreen, but since I think it stretches the actual resolution, it would be the same story (if someone could confirm this).
01-08-2009, 06:49 AM#4
Jazradel
That would make so much sense. I knew the distances couldn't have been correct.