project-navigation
Personal tools

Author Topic: UI Adjustments.  (Read 28385 times)

Offline mor2

  • Squad Leader
  • ****
  • Posts: 145
    • View Profile
UI Adjustments.
« on: October 20, 2010, 10:41:45 pm »
i decided to see what does it take to make UI Adjustments, i think it will be more productive if i know what we work with.

i have found and extracted  0pics.pk3 file, few questions:
1. hud vs althud?  and besides those two and UI is there any other relevant folders?
3. if i want to try new textures all i have to do is replace the originals? is there some kind of mod mechanic that i can place my file with different textures that will be loaded instead. (easier than working with 170MB file)
3. scripts? where they are located? C++? do i need to compile the game if i change them? if so anyway to compile only that section because compiling the whole game will send my laptop to early retirement  ::)

EDIT:
4. is there any documentation?
« Last Edit: October 20, 2010, 11:06:31 pm by mor2 »

Offline H-Hour

  • Administrator
  • PHALANX Commander
  • *****
  • Posts: 1923
    • View Profile
Re: UI Adjustments.
« Reply #1 on: October 20, 2010, 11:39:39 pm »
For new graphics, simply slot new image files over the existing image files you find in /base/pics.

Hud or Alt Hud depends on which configuration you want to deal with. The Hud is only the battlescape UI.

Documentation of the menu system is in the wiki.

Offline mor2

  • Squad Leader
  • ****
  • Posts: 145
    • View Profile
Re: UI Adjustments.
« Reply #2 on: October 21, 2010, 12:08:24 am »
Quote
Create the images for this menu (in base/pics)
Create the script files for this menu (in base/ufos/ui)

so if i understand to overwrite an existing menu i need to place it in base/pic
which is where the game will look for it by default otherwise it will load the 0pics.pk3

and i assume the 0ufos.pk3 hides the current ui?

Offline mor2

  • Squad Leader
  • ****
  • Posts: 145
    • View Profile
Re: UI Adjustments.
« Reply #3 on: October 21, 2010, 02:11:36 am »
i would also like to know the answers to the below questions:

I have a couple questions for Bayo to start:

1) We can do horizontal bars for health/etc, but is it possible to do vertical bars as well?

2) Is it possible to insert a button onto the edge of a container, as the attached image shows, and would this break with the existing UI style too much?

3) Is it possible to have a box that collapses when not in use? I'm thinking of the left-hand weapon. If there is no weapon, can you change the size of the box or is this not changable based on such parameters?

1. i dont think so unless there is some hidden property for vertical or there is bar2 class? ( but i assume its really easy to add)
Code: [Select]
pos "130 21"
size "298 6"

2. why not, you can place the button where ever you want or is it limited by the floor object initial pos,size ?
3. you should be able to disable the whole left panel or at least all of its individual elements?
after checking the appropriate var, where is the question... i assume in the hudinv? or something through ahud? (didnt watched further than the hud class)


another few:
a. is there a more technical documentation of the properties, for exmaple excluderect? ghost? mousefx? etc
b. can i do:

Code: [Select]
onMouseClick( *floor.bt1@disabled = false
             *floor.bt2@disabled = true

EDIT: and last, i tired and going to sleep but a quick thought, all of the controls defined by position size, which makes a squre but we have none square controls, so the capture are determined by the image? so no invisible buttons? 
« Last Edit: October 21, 2010, 02:25:05 am by mor2 »

Offline DarkRain

  • Project Coder
  • Captain
  • ***
  • Posts: 746
    • View Profile
Re: UI Adjustments.
« Reply #4 on: October 21, 2010, 04:52:41 am »
1. i dont think so unless there is some hidden property for vertical or there is bar2 class? ( but i assume its really easy to add)
Code: [Select]
            pos    "130 21"
            size    "298 6"
Bar has a direction property:
Code: [Select]
direction      V_UI_ALIGN      Orientation of the bar. Default value "cr". Other available values are "uc", "lc", "cr", "cl"
I understand that ALING_UC (up-center) and ALING_LC (low-center) will give horizontal bars (from bottom to top, and from top to bottom)
And of course you'd need to give it a sensible size (taller than wide)



Quote
a. is there a more technical documentation of the properties, for exmaple excluderect? ghost? mousefx? etc
UI node behaviours



Quote
EDIT: and last, i tired and going to sleep but a quick thought, all of the controls defined by position size, which makes a squre but we have none square controls, so the capture are determined by the image? so no invisible buttons? 
Node has an invis property. Maybe this could help?
Code: [Select]
invis      V_BOOL      If true, the node is not displayed nor or activatable.
« Last Edit: October 21, 2010, 05:02:15 am by DarkRain »

Offline mor2

  • Squad Leader
  • ****
  • Posts: 145
    • View Profile
Re: UI Adjustments.
« Reply #5 on: October 21, 2010, 11:35:59 am »
its called nodes not classes  :-\ i assumed it was c++ with "widget" like classes used to make it easier for none programmers like me(thus the little wired sintax at places) but i guess its not, what language is it? its look very much alike.

and so can you access a node from another node callback event, i didnt see any variable declaration but i assume that any node can call any other node? or its something todo with confunc?

so can i do this:
onMouseClick( *nodename.invis = true

Offline Kildor

  • Project Artist
  • Captain
  • ***
  • Posts: 757
  • Project mapper and some other stuff`er
    • View Profile
    • http://ufoai.nx0.ru
Re: UI Adjustments.
« Reply #6 on: October 21, 2010, 04:16:10 pm »
there is something-like C syntax, but it is not C. It is just declarative language. Also, confuncs look like mix of xpath and some other language.

Offline bayo

  • Professional loser
  • Project Coder
  • Captain
  • ***
  • Posts: 733
    • View Profile
Re: UI Adjustments.
« Reply #7 on: October 21, 2010, 08:26:11 pm »
Quote
...and so can you access a node from another node callback event, i didnt see any variable declaration but i assume that any node can call any other node? or its something todo with confunc?

so can i do this:
onMouseClick( *nodename.invis = true

I dont read before this message cause i am tired (but i will do it), anyway:
* We can access any nodes
* There is no variable declaration, but i am working on
* confunc or anyother work the same.

onMouseClick( *node:pathofthenode@invis = true

Please check http://ufoai.ninex.info/wiki/index.php/UFO-Scripts/ui/*.ufo and if the doc is not helpful, feed back or fix is welcome. The first entry of http://ufoai.ninex.info/wiki/index.php/How_to_script_UI show an example of node edition from another node.

Offline mor2

  • Squad Leader
  • ****
  • Posts: 145
    • View Profile
Re: UI Adjustments.
« Reply #8 on: October 21, 2010, 10:13:26 pm »
what about my initial question, will placing a picture or script in base/folder/script.ufo
will make the game load it instead if the script.ufo  in base/0folder.pk3   ?
« Last Edit: October 21, 2010, 10:37:12 pm by mor2 »

Offline bayo

  • Professional loser
  • Project Coder
  • Captain
  • ***
  • Posts: 733
    • View Profile
Re: UI Adjustments.
« Reply #9 on: October 21, 2010, 10:32:53 pm »
file from "homedir /base" overwrite file from "gamedir /base" which overwrite file from "gamedir .pk3".

Offline bayo

  • Professional loser
  • Project Coder
  • Captain
  • ***
  • Posts: 733
    • View Profile
Re: UI Adjustments.
« Reply #10 on: October 21, 2010, 10:38:56 pm »
/contrib/scripts/ui/examples/unittest_bar.ufo contain example of bar

Offline mor2

  • Squad Leader
  • ****
  • Posts: 145
    • View Profile
Re: UI Adjustments.
« Reply #11 on: October 21, 2010, 10:40:18 pm »
and since its better to mess around with game dir, where is homedir?

p.s.
Quote
* We can access any nodes
*node:pathofthenode@invis = true
what i meant is that it looked like if i go high enough, i'll find that every node constructor creates a global variable with the same name holding a pointer to it, which is why i can basically access everything...
« Last Edit: October 21, 2010, 11:11:45 pm by mor2 »

Offline bayo

  • Professional loser
  • Project Coder
  • Captain
  • ***
  • Posts: 733
    • View Profile
Re: UI Adjustments.
« Reply #12 on: October 21, 2010, 11:08:46 pm »
For dir, run the game and check the logs below "---- filesystem initialization -----".

Quote
what i meant is that it looked like if i go high enough, i'll find that every node constructor creates a global variable with the same name holding a pointer to it, which is why i can basically access everything...
I am not sure i understand the image. Each nodes have an unique identifier called "path" (constructed with names of all parents), and we can use this path to access to the node.

Offline mor2

  • Squad Leader
  • ****
  • Posts: 145
    • View Profile
Re: UI Adjustments.
« Reply #13 on: October 21, 2010, 11:21:16 pm »

ok, then speaking of node path, how does call function works? for example here when called from hud?

Code: [Select]
    onClick {
if (*path??:hudinv@visiblewhen) {
call *node:root.showinventory
} else {
call *path??:hudinv.hideinventory
}
}

what is the path?

Offline geever

  • Project Coder
  • PHALANX Commander
  • ***
  • Posts: 2560
    • View Profile
Re: UI Adjustments.
« Reply #14 on: October 21, 2010, 11:40:01 pm »
what is the path?

UI path: *node:windowname.nodename or *node:windowname.panelname.nodename, you can use root and parent tokens as reference like *node:parent.nodename.

You should really check our current UI scripts. they're very informative and easy to understand IMHO.

Basedefence UI is a good example IMHO, it's quite new so uses the newest features


-geever