PDA

View Full Version : UI Modding Questions


Buffbot
09-03-2013, 02:37 PM
I haven't found any UI mods for Drox yet, so I'm currently playing around with modding it myself - namely to fix the issue with cargo and stash bays overlapping the equipment menu, among other minor quirks. Coding of any kind isn't something that comes naturally to me so I'm running into a few snags along the way.

Probably the biggest one is dealing with placement of windows. I can't seem to determine the logic behind how positions of the various UI elements are anchored with the 'position' command. Some appear to use the center of the screen for reference, others use other UI elements for anchoring, and some appear to use the screen edge.

My questions would be:

1) What determines where on the screen the anchor point for each element is place?
2) What part of an element is it's anchor point (center/top right corner/etc)?
3) Is the 'position' command measured in pixels? and if so, I assume the engine is using a specific resolution size for positioning the UI elements and then scaling it up for larger resolutions?

If anyone has any info it would be greatly appreciated to a modding noob.

Shadow
09-03-2013, 06:06 PM
The position command refers to the top left of the UI element. Everything is in pixels. The UI system uses 640x480 as the screen size (it scales appropriately if the actual resolution is bigger).

0 0 would be the top left of the screen
639 479 would be the bottom right of the screen

Parkan
09-03-2013, 06:15 PM
I have a question to modders.Is it hardcoded or not to add more component slots(heavy,medium,light,race specific) to player ship?

Buffbot
09-03-2013, 06:58 PM
The position command refers to the top left of the UI element. Everything is in pixels. The UI system uses 640x480 as the screen size (it scales appropriately if the actual resolution is bigger).

0 0 would be the top left of the screen
639 479 would be the bottom right of the screen

Thanks so much for the reply. Knowing that it's 640x480 should really help things moving forward. That alone is likely why it seemed harder than it should to make sense of the numbers.

Forevener
09-03-2013, 11:18 PM
I have a question to modders.Is it hardcoded or not to add more component slots(heavy,medium,light,race specific) to player ship?
Not hardcoded.

Parkan
09-04-2013, 01:19 AM
Not hardcoded.

Any hints how to do this?:rolleyes:

Forevener
09-04-2013, 03:13 AM
Any hints how to do this?:rolleyes:

Database/Hulls.gdb

Maybe it is hardcoded, I'm not sure. Try adding new slots to the desired ship with SlotIndex and SlotPosition (use index above 33).

Parkan
09-04-2013, 03:17 AM
this thing i tryed first and nothing work

Forevener
09-04-2013, 03:49 AM
this thing i tryed first and nothing work

Then we need Shadow's comment about that.

Shadow
09-04-2013, 10:27 AM
The total number is hardcoded, but how many command points required to get each new ship is not.

Mujik
10-10-2013, 11:22 PM
I'm also trying to make some tweaks to the ui, right now i'm trying to change the position of the text messages but i can't find the right place, is it hardcoded as the minimap?

Shadow
10-11-2013, 09:48 AM
I'm also trying to make some tweaks to the ui, right now i'm trying to change the position of the text messages but i can't find the right place, is it hardcoded as the minimap?

This is controlled by the EventsTextPosition parm in systems.gdb.

DarthNihilus
10-14-2013, 11:05 AM
I'd like to ask - is it possible to make a text to be justified in a window/button/whatever?

Shadow
10-14-2013, 11:35 AM
I'd like to ask - is it possible to make a text to be justified in a window/button/whatever?

Yes. There is a textAlignment command.

textAlignment <Alignment>

where Alignment can be:

BottomLeft (this is the default)
Center
CenterLeft (centers the vertical part, left justified)
CenterRight (centers the vertical part, right justified)
CenterX

DarthNihilus
10-14-2013, 01:06 PM
Sorry, I expressed myself wrong way.
I meant - like that
http://i59.fastpic.ru/thumb/2013/1014/c1/8ef0411ab4c91c548371519e162d57c1.jpeg (http://fastpic.ru/view/59/2013/1014/8ef0411ab4c91c548371519e162d57c1.png.html)

Shadow
10-14-2013, 03:36 PM
You mean to auto-space to fit a column. No we don't have support for that.

DarthNihilus
10-14-2013, 05:51 PM
ok. it's not that needed.

------

New question: I have a picture (1280*976). how do i put it as a background image, so it is seen whole in different resolution + windowed mode? I made a clone of the heroes.mnu.

So far it's like this

name DarthNihilus
position 0.0 -20.0
fullScreen 1
pausesGame 1

Widget
{
position 274.0 50.0
size 92.0 31.0

text "Mytext"
textAlignment center
useTextbackdrop 1
color "1.0 0.85 0.4"
font LargeDefault
draworder 9.0
textBold 1
}

Widget
{
texture Textures/ui/borders/menuBar_Left.tga
position 240.0 48.0
size 36.0 36.0
draworder 5.0
}

Widget
{
texture Textures/ui/borders/menuBar_Center.tga
position 276.0 48.0
size 90.0 36.0
draworder 5.0
}

Widget
{
texture Textures/ui/borders/menuBar_Right.tga
position 360.0 48.0
size 36.0 36.0
draworder 5.0
}


// Background for Credits ****************************************

Widget
{
position 96.0 124.0
size 32.0 128.0

texture Textures/UI/borders/m_Left01.tga
draworder 2.0
}

Widget
{
position 96.0 252.0
size 32.0 128.0

texture Textures/UI/borders/m_Left01.tga
draworder 2.0
}

Widget
{
position 512.0 124.0
size 32.0 128.0

texture Textures/UI/borders/m_Right01.tga
draworder 2.0
}

Widget
{
position 512.0 252.0
size 32.0 128.0

texture Textures/UI/borders/m_Right01.tga
draworder 2.0
}

Widget
{
position 128.0 92.0
size 128.0 32.0

texture Textures/UI/borders/m_Upper01.tga
draworder 2.0
}

Widget
{
position 256.0 92.0
size 128.0 32.0

texture Textures/UI/borders/m_Upper01.tga
draworder 2.0
}

Widget
{
position 384.0 92.0
size 128.0 32.0

texture Textures/UI/borders/m_Upper01.tga
draworder 2.0
}

Widget
{
position 96.0 92.0
size 32.0 32.0

texture Textures/UI/borders/m_UpperLeft01.tga
draworder 2.0
}

Widget
{
position 512.0 92.0
size 32.0 32.0

texture Textures/UI/borders/m_UpperRight01.tga
draworder 2.0
}

Widget
{
position 96.0 380.0
size 32.0 32.0

texture Textures/UI/borders/m_LowerLeft01.tga
draworder 2.0
}

Widget
{
position 512.0 380.0
size 32.0 32.0

texture Textures/UI/borders/m_LowerRight01.tga
draworder 2.0
}

Widget
{
position 128.0 380.0
size 256.0 32.0

texture Textures/UI/borders/m_Lower01.tga
draworder 2.0
}

Widget
{
position 384.0 380.0
size 128.0 32.0

texture Textures/UI/borders/m_Lower01.tga
draworder 2.0
}

Widget
{
position 128.0 124.0
size 384.0 256.0

texture Textures/UI/borders/m_CenterTiler02.tga
draworder 1.0
}
// text

Text
{
textSource text "blahblahblah*9000times"
position 120.0 115.0
size 390.0 280.0
scrollBarOffset 514.0 115.0
scrollBarSize 16.0 265.0
draworder 18.0
useTextBackdrop 1
onlyUpdateOnShow 1
}

// Exit

Button
{
text $$Back$$

position 270.0 435.0
size 100.0 25.0

addCommand "menuCommand hide"
hotkey Escape
drawOrder 9.0

ImportantButton
}