• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[JASS] FRAMES UI - need help!

Status
Not open for further replies.
Level 7
Joined
Oct 20, 2010
Messages
184
I'm creating my first UI for the game and I'm having problems correctly layering multiple ui elements. Is it possible to have status bars appear above backdrops?
 
Yes, here is my code for putting a "SIMPLESTATUSBAR" on top of a backdrop. My "SIMPLESTATUSBAR" also have a text on it.
The "ui_mainBackDrop" is the... Big thing in the background.
The hp SIMPLESTATUSBAR is the upper one of the 2 bars.

Basically I setup the main background, and add the emptybar in the backdrop, and the full bar on "on top of" the empty bar. I put the text in the main backdrop at the same location as the bar.

1680517858635.png


JASS:
    set ui_mainBackDrop = BlzCreateFrameByType("BACKDROP", "ui_mainBackDrop", BlzGetOriginFrame(ORIGIN_FRAME_WORLD_FRAME, 0), "", 0)
    call BlzFrameSetAbsPoint(ui_mainBackDrop, FRAMEPOINT_TOPLEFT, UI_MAIN_LEFT, UI_MAIN_TOP)
    call BlzFrameSetAbsPoint(ui_mainBackDrop, FRAMEPOINT_BOTTOMRIGHT, UI_MAIN_RIGHT, UI_MAIN_BOT)
    call BlzFrameSetTexture(ui_mainBackDrop, "UI\\ScifiCardX2RotCut.blp", 0, true)
    call BlzFrameSetVisible(ui_mainBackDrop, false)

//HP BAR
    set ui_hpBarEmpty = BlzCreateFrameByType("BACKDROP", "hpEmpty", ui_mainBackDrop, "", 0)
    call BlzFrameSetAbsPoint(ui_hpBarEmpty, FRAMEPOINT_TOPLEFT, UI_BAR_LEFT, UI_BAR_HP_TOP)
    call BlzFrameSetAbsPoint(ui_hpBarEmpty, FRAMEPOINT_BOTTOMRIGHT, UI_BAR_RIGHT, UI_BAR_HP_BOT)
    call BlzFrameSetTexture(ui_hpBarEmpty, "UI\\ScifiBarEmpty.blp", 0, true)
    set ui_hpBarFull = BlzCreateFrameByType("SIMPLESTATUSBAR", "hpFull", ui_hpBarEmpty, "", 0)
    call BlzFrameSetTexture(ui_hpBarFull, "UI\\ScifiBarFull.blp", 0, true)
    call BlzFrameSetAbsPoint(ui_hpBarFull, FRAMEPOINT_TOPLEFT, UI_BAR_LEFT, UI_BAR_HP_TOP)
    call BlzFrameSetAbsPoint(ui_hpBarFull, FRAMEPOINT_BOTTOMRIGHT, UI_BAR_RIGHT, UI_BAR_HP_BOT)
    call BlzFrameSetValue(ui_hpBarFull, 0)
    set ui_hpBarText = BlzCreateFrameByType("TEXT", "hpBarText", ui_mainBackDrop, "", 0)
    call BlzFrameSetAbsPoint(ui_hpBarText, FRAMEPOINT_TOPLEFT, UI_BAR_LEFT, UI_BAR_HP_TOP)
    call BlzFrameSetAbsPoint(ui_hpBarText, FRAMEPOINT_BOTTOMRIGHT, UI_BAR_RIGHT, UI_BAR_HP_BOT)
    call BlzFrameSetText(ui_hpBarText, "|cffffffff100/100|r")
    //call BlzFrameSetEnable(ui_hpBarText, false)
    call BlzFrameSetScale(ui_hpBarText, 1.00)
    call BlzFrameSetTextAlignment(ui_hpBarText, TEXT_JUSTIFY_MIDDLE, TEXT_JUSTIFY_CENTER)
    call BlzTriggerRegisterFrameEvent(ui_show_ui_tooltip_trig, ui_hpBarText, FRAMEEVENT_MOUSE_ENTER)
    call BlzTriggerRegisterFrameEvent(ui_hide_tooltip_trig, ui_hpBarText, FRAMEEVENT_MOUSE_LEAVE)
    set tmp = BlzCreateFrameByType("BACKDROP", "ui_hpIcon", ui_mainBackDrop, "", 1)
    call BlzFrameSetAbsPoint(tmp, FRAMEPOINT_TOPLEFT, UI_BAR_ICON_LEFT, UI_BAR_HP_TOP)
    call BlzFrameSetAbsPoint(tmp, FRAMEPOINT_BOTTOMRIGHT, UI_BAR_ICON_RIGHT, UI_BAR_HP_BOT)
    call BlzFrameSetTexture(tmp, "UI\\ScifiHexHp.blp", 0, true)

Feel free to checkout the UI trigger in Mecha Protectors for full code.
The trigger is in "CustomSystems/UI".
 
Status
Not open for further replies.
Top