Text Placement Fix

This bundle is marked as pending. It has not been reviewed by a staff member yet.
In the good old days text went where it was supposed to. Then came widescreen and what used to be the edge of the screen became the middle, but the text was just left where it was because Blizzard doesn't find games hot anymore when they're more than ten years old. Fixing it for widescreen would cause messages to start outside the screen for users on lower resolutions.

This trigger detects screen ratios and places text and chat boxes in approximately acceptable positions.

I am submitting my basic, half-assed work because this is something that's essential for every map. Hopefully someone will do it better soon.

If you just want to copy it without downloading anything, here:
JASS:
    local framehandle m = BlzGetOriginFrame(ORIGIN_FRAME_UNIT_MSG, 0)
    local framehandle c = BlzGetOriginFrame(ORIGIN_FRAME_CHAT_MSG, 0)
    call BlzFrameClearAllPoints(m)
    call BlzFrameClearAllPoints(c)
    // -
    if ( ( I2R(BlzGetLocalClientWidth()) / I2R(BlzGetLocalClientHeight()) ) > 1.61 ) then
    call BlzFrameSetAbsPoint(m, FRAMEPOINT_BOTTOMLEFT, -0.125, 0.235)
    call BlzFrameSetAbsPoint(m, FRAMEPOINT_TOPRIGHT, 0.5, 0.435)
    call BlzFrameSetAbsPoint(c, FRAMEPOINT_BOTTOMLEFT, 0.05, 0.1625)
    call BlzFrameSetAbsPoint(c, FRAMEPOINT_TOPRIGHT, 0.6, 0.4)
    else
    if ( ( I2R(BlzGetLocalClientWidth()) / I2R(BlzGetLocalClientHeight()) ) > 1.4 ) then
    call BlzFrameSetAbsPoint(m, FRAMEPOINT_BOTTOMLEFT, -0.0625, 0.235)
    call BlzFrameSetAbsPoint(m, FRAMEPOINT_TOPRIGHT, 0.50625, 0.435)
    call BlzFrameSetAbsPoint(c, FRAMEPOINT_BOTTOMLEFT, 0.175, 0.1625)
    call BlzFrameSetAbsPoint(c, FRAMEPOINT_TOPRIGHT, 0.725, 0.4)
    else
    call BlzFrameSetAbsPoint(m, FRAMEPOINT_BOTTOMLEFT, 0.01, 0.235)
    call BlzFrameSetAbsPoint(m, FRAMEPOINT_TOPRIGHT, 0.626, 0.435)
    call BlzFrameSetAbsPoint(c, FRAMEPOINT_BOTTOMLEFT, 0.175, 0.1625)
    call BlzFrameSetAbsPoint(c, FRAMEPOINT_TOPRIGHT, 0.725, 0.4)
    endif
    endif

If you want to adjust the values yourself, here's tasyen's image showing how coordinates translate:
Previews
Contents

Text Placement Fix (Map)

Level 10
Joined
Oct 10, 2011
Messages
300
It works really well. Super easy to use.
Really a good system

vJASS:
function setMessagePlacementOnScreen takes nothing returns nothing
    local framehandle m = BlzGetOriginFrame(ORIGIN_FRAME_UNIT_MSG, 0)
    local framehandle c = BlzGetOriginFrame(ORIGIN_FRAME_CHAT_MSG, 0)
    local real screenRatio = I2R(BlzGetLocalClientWidth()) / I2R(BlzGetLocalClientHeight())

    call BlzFrameClearAllPoints(m)
    call BlzFrameClearAllPoints(c)

    if screenRatio > 1.61 then
        call BlzFrameSetAbsPoint(m, FRAMEPOINT_BOTTOMLEFT, -0.125, 0.235)
        call BlzFrameSetAbsPoint(m, FRAMEPOINT_TOPRIGHT, 0.5, 0.435)
        call BlzFrameSetAbsPoint(c, FRAMEPOINT_BOTTOMLEFT, 0.05, 0.1625)
        call BlzFrameSetAbsPoint(c, FRAMEPOINT_TOPRIGHT, 0.6, 0.4)
    elseif screenRatio  > 1.4 then
        call BlzFrameSetAbsPoint(m, FRAMEPOINT_BOTTOMLEFT, -0.0625, 0.235)
        call BlzFrameSetAbsPoint(m, FRAMEPOINT_TOPRIGHT, 0.50625, 0.435)
        call BlzFrameSetAbsPoint(c, FRAMEPOINT_BOTTOMLEFT, 0.175, 0.1625)
        call BlzFrameSetAbsPoint(c, FRAMEPOINT_TOPRIGHT, 0.725, 0.4)
    else
        call BlzFrameSetAbsPoint(m, FRAMEPOINT_BOTTOMLEFT, 0.01, 0.235)
        call BlzFrameSetAbsPoint(m, FRAMEPOINT_TOPRIGHT, 0.626, 0.435)
        call BlzFrameSetAbsPoint(c, FRAMEPOINT_BOTTOMLEFT, 0.175, 0.1625)
        call BlzFrameSetAbsPoint(c, FRAMEPOINT_TOPRIGHT, 0.725, 0.4)
    endif

    call BJDebugMsg("Thanks doom_sheep :D")

endfunction

should be good like that no? What do you think?
Do you think framehandle variables should be nullified?
 
Last edited:
Level 10
Joined
Oct 10, 2011
Messages
300
Hello man,

Your piece of code is really good
I got a bug today, on the right side. the multiboard moved when a timer window get destroyed.

I'm jut initializing the code at the beginning of the map, then I don't change it. Do you think it can reset by itself?

here is my settings
Code:
function setScreenWidth takes nothing returns nothing
    local framehandle m = BlzGetOriginFrame(ORIGIN_FRAME_UNIT_MSG, 0)
    local framehandle c = BlzGetOriginFrame(ORIGIN_FRAME_CHAT_MSG, 0)
    local real screenRatio = I2R(BlzGetLocalClientWidth()) / I2R(BlzGetLocalClientHeight())

    call BlzFrameClearAllPoints(m)
    call BlzFrameClearAllPoints(c)

    if screenRatio > 1.61 then
    call BlzFrameSetAbsPoint(m, FRAMEPOINT_BOTTOMLEFT, -0.08, 0.235)
        call BlzFrameSetAbsPoint(m, FRAMEPOINT_TOPRIGHT, 0.5, 0.435)
    call BlzFrameSetAbsPoint(c, FRAMEPOINT_BOTTOMLEFT, 0, 0.17)
        call BlzFrameSetAbsPoint(c, FRAMEPOINT_TOPRIGHT, 0.6, 0.4)
    elseif screenRatio  > 1.4 then
        call BlzFrameSetAbsPoint(m, FRAMEPOINT_BOTTOMLEFT, -0.0625, 0.235)
        call BlzFrameSetAbsPoint(m, FRAMEPOINT_TOPRIGHT, 0.50625, 0.435)
        call BlzFrameSetAbsPoint(c, FRAMEPOINT_BOTTOMLEFT, 0.175, 0.1625)
        call BlzFrameSetAbsPoint(c, FRAMEPOINT_TOPRIGHT, 0.725, 0.4)
    else
        call BlzFrameSetAbsPoint(m, FRAMEPOINT_BOTTOMLEFT, 0.01, 0.235)
        call BlzFrameSetAbsPoint(m, FRAMEPOINT_TOPRIGHT, 0.626, 0.435)
        call BlzFrameSetAbsPoint(c, FRAMEPOINT_BOTTOMLEFT, 0.175, 0.1625)
        call BlzFrameSetAbsPoint(c, FRAMEPOINT_TOPRIGHT, 0.725, 0.4)
    endif

    set m = null
    set c = null

endfunction

Do you think your piece of code did that? Do you think how I can fix it?

Thank you man
 

Attachments

  • bug.png
    bug.png
    3.6 MB · Views: 9
Top