Howdy, Stranger!

It looks like you're new here. Sign in or register to get started.

Categories

Dark Dreams of Furiae - a new module for NWN:EE! Buy now
Attention, new and old users! Please read the new rules of conduct for the forums, and we hope you enjoy your stay!

How to add a background to the IDW:EE UI?

AxwindAxwind Member Posts: 21
edited March 2019 in UI Modding
I was just trying to figure out how to add a background to the UI for IWD:EE as some mods have done for the BG:EE and BG2:EE UIs. Something like this:
back1.jpg
back2.jpg

Any help would be greatly appreciated. Thanks!

Comments

  • lefreutlefreut Member Posts: 1,462
    You can use Infinity_SetBackground('BACKGROUND') and then you can use a menu named 'BACKGROUND' to display your MOS file.

  • AxwindAxwind Member Posts: 21
    edited March 2019
    Ok, thanks. Would that cause all the other elements to offset, though? I found a way to do it by placing the main window graphic onto the background, saving that as a png with the same name as the window graphic (START, for example), and then in menu.ui, adjusting the area to 1920 1080 so it displays correctly. However, doing so also shifts all the other elements up and to the left from where they were, so I have to go in and change all of them to put them back in their former positions.

    EDIT: Forgot to mention I don't have a lot of experience with this kind of code. How exactly do you do what you said to do?

  • lefreutlefreut Member Posts: 1,462
    @Axwind It's much easier to use Infinity_SetBackground because it won't interact with other elements and can be used for multiple screens.

    You need a dedicated menu section. For example, you have this in the default UI:
    menu
    {
    	name 'BACKGROUND'
    	align center center
    	label
    	{
    		area 0 0 3840 2160 
    		mosaic 'GUIBG'
    	}
    }
    

    You can edit this to match the name and size of your file.

    Here the one I use in LeUI.
    menu
    {
    	name 'BACKGROUND'
    	align center center
    	label
    	{
    		area 0 0 2550 1800
    		mosaic BCKGRND
    	}
    }
    

    And then you add Infinity_SetBackground('BACKGROUND') in the onOpen of the menu you want to have a background.

  • AxwindAxwind Member Posts: 21
    I can't figure out where to put Infinity_SetBackground('BACKGROUND') in the onOpen. What part of it? Here's an example from the IWD:EE LeUI:
    menu
    {
    name 'START'
    align center center
    ignoreesc
    onOpen
    "
    e:CheckGUISong()
    local state = startEngine:GetEngineState()
    if lastStartMenu then
    if lastStartMenu ~= 'START' then
    Infinity_PushMenu(lastStartMenu)
    end
    lastStartMenu = nil
    elseif state == 1 then
    Infinity_PushMenu('START_SP')
    elseif state == 2 then
    Infinity_PushMenu('START_MP')
    elseif state == 0 then
    Infinity_PushMenu('START_MAIN')
    end
    -- Infinity_SetBackground('BACKGROUND')
    Infinity_SetHighlightColors(0x14, 0x6b, 0x66, 0xcc, 0x14, 0x6b, 0x66, 0x88, 0x14, 0x6b, 0x66, 0x00)
    "

    Infinity_SetBackground('BACKGROUND') is already there near the bottom so in this case it didn't seem to need to be added, but no background shows even though I put a BACKGROUND.PNG in the override folder. What am I missing?

  • lefreutlefreut Member Posts: 1,462
    The code inside UI.menu is based on Lua. And in Lua '--' is a comment. Everything after on the same line is ignored.

    Delete these two - and it should work :)

  • AxwindAxwind Member Posts: 21
    I tried that but the background still didn't show up. Does BACKGROUND have to be defined for each menu or only once?

  • lefreutlefreut Member Posts: 1,462
    Axwind wrote: »
    Infinity_SetBackground('BACKGROUND') is already there near the bottom so in this case it didn't seem to need to be added, but no background shows even though I put a BACKGROUND.PNG in the override folder. What am I missing?

    The name of the file should match the mosaic name so BCKGRND.png not BACKGROUND.png.

  • AxwindAxwind Member Posts: 21
    I had already renamed the mosiac to BACKGROUND, like so:
    menu
    {
    name 'BACKGROUND'
    align center center
    label
    {
    area 0 0 1920 1080
    mosaic 'BACKGROUND'
    }
    }

    That bit of code was already present at line 19636 way farther down than the bit I posted above, I just changed the dimensions and the name and the mosaic name. Does it apply to all menus or I have to use it again near the menu I want to have a background? Or does the mosiac name have to be BCKGRND no matter what and can't be changed?

  • lefreutlefreut Member Posts: 1,462
    edited March 2019
    It apply to all menu, you must have only one menu section named BACKGROUND.

    For the mosaic name, you can change it but I think it has a max length (7 or 8) so go for BCKGRND :p

  • AxwindAxwind Member Posts: 21
    It worked, thanks! I made two different backgrounds, here are a couple screens of them:
    Icewn013.png

    Icewn014.png

    Icewn015.png

    Icewn016.png

    And here they are, each bundled with menu.ui, so all that needs to be done is drop them in the override folder. They go with your UI, so feel free to add either one to it or both if you know how to give people the option to choose.

    Gusindalefreut
Sign In or Register to comment.