Author Topic: How to edit User Interfaces, and adjust their contents  (Read 702 times)

Offline TheIrishAce

  • Squaddie
  • *
  • Posts: 7
    • View Profile
How to edit User Interfaces, and adjust their contents
« on: December 31, 2018, 04:01:03 am »
Hi all, I'm new here to the forums and am wondering how you would go about locating and editing the files for the games user interface. For example is there a way to adjust the soldiers screen(Name, Rank) etc.
I want to make it so the soldier screen utilizes the majority of my monitor instead of the tiny box it currently takes up as part of the standard openxcom install, any info and input into how I'd get the 'ball' rolling would be greatly appreciated.

Thanks alot,
Irish.  ;D

Offline FeruEnzeru[RETIRED/I QUIT]

  • Colonel
  • ****
  • Posts: 430
  • retired, because of Meridian and his followers. 👎
    • View Profile
Re: How to edit User Interfaces, and adjust their contents
« Reply #1 on: December 31, 2018, 04:55:53 am »
@TheIrishAce
Hi Irish.
Welcome the OXC forums, if you need someone to do this.
If you're talking about "UI for 90s xcom on OXC",
Either ask Meridian (the YouTube LPer) or Otto ohartenstein23, Yankes, or Warboy (admin) or anybody who specializes that stuff.

Our pleasure to have you here on OXC forums.

Thank you for joining OopenXCOM and OXC forums. :)

Offline TheIrishAce

  • Squaddie
  • *
  • Posts: 7
    • View Profile
Re: How to edit User Interfaces, and adjust their contents
« Reply #2 on: December 31, 2018, 05:08:34 am »
Thank you for the warm welcome.
That's exactly what I'd like to do, I want to edit the original XCOM UI within OXC. Would you know the best way to reach out to the guys you mentioned?
« Last Edit: December 31, 2018, 05:13:18 am by TheIrishAce »

Offline FeruEnzeru[RETIRED/I QUIT]

  • Colonel
  • ****
  • Posts: 430
  • retired, because of Meridian and his followers. 👎
    • View Profile
Re: How to edit User Interfaces, and adjust their contents
« Reply #3 on: December 31, 2018, 06:00:02 am »
Thank you for the warm welcome.
That's exactly what I'd like to do, I want to edit the original XCOM UI within OXC. Would you know the best way to reach out to the guys you mentioned?
I don't know i'll ask Meridian or anyone this via PM or something else (not Discord at all, i'm not interested to Discord.
« Last Edit: December 31, 2018, 06:07:38 am by FeruEnzeru »

Offline ohartenstein23

  • Commander
  • *****
  • Posts: 1625
  • Flamethrowers fry cyberdisk circuits
    • View Profile
Re: How to edit User Interfaces, and adjust their contents
« Reply #4 on: December 31, 2018, 06:06:58 am »
What you probably want to look into has to deal with the resolution, not the files directly dealing with the soldiers interface - have you tried the option "Maximize Info Screens" under Options > Advanced > General? Without more info on what you want to do with the UI, just getting a larger screen is already in the options if you play around with them.

Offline TheIrishAce

  • Squaddie
  • *
  • Posts: 7
    • View Profile
Re: How to edit User Interfaces, and adjust their contents
« Reply #5 on: December 31, 2018, 06:13:49 am »
I don't know i'll ask Meridian or anyone this via PM or something else (not Discord at all, i'm not interested to Discord.
« Last Edit: December 31, 2018, 11:56:36 am by Solarius Scorch »

Offline ohartenstein23

  • Commander
  • *****
  • Posts: 1625
  • Flamethrowers fry cyberdisk circuits
    • View Profile
Re: How to edit User Interfaces, and adjust their contents
« Reply #6 on: December 31, 2018, 07:58:57 am »
Glad to see you're playing the 40k mod :] You'd have to be playing with "Original" Geoscape scale in video options for the black border to not be there, but that still wouldn't change the resolution of number of characters fitting on that screen. You'd think that you could just use the extra space around those borders to display more of the screen, but the game is written to stay compatible with the original 320x200 resolution and can't really just be scaled to fit more for your particular video settings.

You could create more room there if you wanted to download the source code and recompile yourself, this is the file that controls how that screen is arranged.

Offline SupSuper

  • Lazy Developer
  • Administrator
  • Commander
  • *****
  • Posts: 2108
    • View Profile
Re: How to edit User Interfaces, and adjust their contents
« Reply #7 on: December 31, 2018, 08:04:38 am »
The UI isn't moddable, you'd have to rewrite the code to do so.

Offline The_Funktasm

  • Colonel
  • ****
  • Posts: 133
  • Trust furries, not aliens
    • View Profile
    • My very curse-heavy blog.
Re: How to edit User Interfaces, and adjust their contents
« Reply #8 on: December 31, 2018, 08:40:25 am »
It's unfortunate that text scaling isn't a feature. Even if all the rest weren't really changed then high-res/scaled fonts would be a nice bonus. The text boxes feel a bit cramped and making a "page 2" of a ufopaedia article feels weird, as a modder.

Offline TheIrishAce

  • Squaddie
  • *
  • Posts: 7
    • View Profile
Re: How to edit User Interfaces, and adjust their contents
« Reply #9 on: December 31, 2018, 02:23:44 pm »
The UI isn't moddable, you'd have to rewrite the code to do so.

Would it be possible to get some help with de-compiling and re-compiling the source files then? That's the only aspect of editing the menus that I don't know how to do, is there any specific tools I'd need?

Offline Stoddard

  • Colonel
  • ****
  • Posts: 457
  • in a fey mood
    • View Profile
    • Linux builds & stuff
Re: How to edit User Interfaces, and adjust their contents
« Reply #10 on: December 31, 2018, 05:44:50 pm »
Would it be possible to get some help with de-compiling and re-compiling the source files then? That's the only aspect of editing the menus that I don't know how to do, is there any specific tools I'd need?

That depends on your operating system. Which is it?

Offline TheIrishAce

  • Squaddie
  • *
  • Posts: 7
    • View Profile
Re: How to edit User Interfaces, and adjust their contents
« Reply #11 on: December 31, 2018, 06:55:32 pm »
That depends on your operating system. Which is it?

I'm currently using Windows 10, but if I needed a certain type of OS like linux for example I'd use a virtual machine.

Offline Stoddard

  • Colonel
  • ****
  • Posts: 457
  • in a fey mood
    • View Profile
    • Linux builds & stuff
Re: How to edit User Interfaces, and adjust their contents
« Reply #12 on: December 31, 2018, 08:43:12 pm »
I'm currently using Windows 10, but if I needed a certain type of OS like linux for example I'd use a virtual machine.

This answer assumes using Linux in a VM and OpenXcom-Extended, since that's what I have experience with.

 -  Get an ubuntu VM ( I prefer xubuntu since its UI is actually sane and lightweight; use the 18.04 release )
 -  Install Git and get the source code:
Code: [Select]
sudo apt install git
git clone https://github.com/MeridianOXC/OpenXcom.git

The next steps depend on whether you would like to test/run OXCE in the VM or on the host machine.

For building windows executables:

1. install MXE and dependencies (this will take considerable time)
Code: [Select]
apt install build-essential
sudo mkdir /opt
cd /opt
sudo git clone https://github.com/mxe/mxe.git
cd mxe
sudo make gcc sdl sdl_gfx sdl_image sdl_mixer yaml-cpp

2. build the .exe
Code: [Select]
cd ~/OpenXcom/src
make -f Makefile.mxe

This will build a 32bit windows executable under ~/OpenXcom/bin


If running OXCE under VM / in linux:

1. install dependencies:
Code: [Select]
sudo apt install git build-essential libsdl*1.2*dev libyaml-cpp-dev cmake-curses-gui kdevelop
2. set up the KDevelop project: launch KDevelop, do Project->Open/Import Project, pick the OpenXcom directory; set the Project Manager to CMakeLists. Press OK in the next window.
3. Build it - just press the Build button (leftmost in the toolbar)
4. You'll have to copy the vanilla datafiles and mods into some dir in the VM, then copy the built executable alongside them, etc, to get it to start up. That's a different topic, feel free to ask.

Once either one works, read the source. Typical code that does UI element placing looks like this:

Code: [Select]
_window = new Window(this, 320, 160, 0, 20, POPUP_BOTH);
_txtTitle = new Text(320, 17, 0, 30);
_btnOk = new TextButton(136, 16, 168, 155);
_btnStop = new TextButton(136, 16, 16, 155);
_btnSell = new ToggleTextButton(60, 16, 244, 61);
_txtAvailableEngineer = new Text(160, 9, 16, 50);
_txtAvailableSpace = new Text(160, 9, 16, 60);
_txtMonthlyProfit = new Text(160, 9, 168, 50);
_txtAllocatedEngineer = new Text(112, 32, 16, 80);
_txtUnitToProduce = new Text(112, 48, 168, 64);
_txtEngineerUp = new Text(90, 9, 40, 118);
_txtEngineerDown = new Text(90, 9, 40, 138);
_txtUnitUp = new Text(90, 9, 192, 118);
_txtUnitDown = new Text(90, 9, 192, 138);
_btnEngineerUp = new ArrowButton(ARROW_BIG_UP, 13, 14, 132, 114);
_btnEngineerDown = new ArrowButton(ARROW_BIG_DOWN, 13, 14, 132, 136);
_btnUnitUp = new ArrowButton(ARROW_BIG_UP, 13, 14, 284, 114);
_btnUnitDown = new ArrowButton(ARROW_BIG_DOWN, 13, 14, 284, 136);
_txtAllocated = new Text(40, 16, 128, 88);
_txtTodo = new Text(40, 16, 280, 88);

in files named something like src/???scape/????State.cpp

The four numbers are typically width, height, x, y

Change them, rebuild the exe, launch it to take a look.






« Last Edit: December 31, 2018, 09:00:47 pm by Stoddard »

Offline TheIrishAce

  • Squaddie
  • *
  • Posts: 7
    • View Profile
Re: How to edit User Interfaces, and adjust their contents
« Reply #13 on: January 01, 2019, 07:20:18 am »
Spoiler:
This answer assumes using Linux in a VM and OpenXcom-Extended, since that's what I have experience with.

 -  Get an ubuntu VM ( I prefer xubuntu since its UI is actually sane and lightweight; use the 18.04 release )
 -  Install Git and get the source code:
Code: [Select]
sudo apt install git
git clone https://github.com/MeridianOXC/OpenXcom.git

The next steps depend on whether you would like to test/run OXCE in the VM or on the host machine.

For building windows executables:

1. install MXE and dependencies (this will take considerable time)
Code: [Select]
apt install build-essential
sudo mkdir /opt
cd /opt
sudo git clone https://github.com/mxe/mxe.git
cd mxe
sudo make gcc sdl sdl_gfx sdl_image sdl_mixer yaml-cpp

2. build the .exe
Code: [Select]
cd ~/OpenXcom/src
make -f Makefile.mxe

This will build a 32bit windows executable under ~/OpenXcom/bin


If running OXCE under VM / in linux:

1. install dependencies:
Code: [Select]
sudo apt install git build-essential libsdl*1.2*dev libyaml-cpp-dev cmake-curses-gui kdevelop
2. set up the KDevelop project: launch KDevelop, do Project->Open/Import Project, pick the OpenXcom directory; set the Project Manager to CMakeLists. Press OK in the next window.
3. Build it - just press the Build button (leftmost in the toolbar)
4. You'll have to copy the vanilla datafiles and mods into some dir in the VM, then copy the built executable alongside them, etc, to get it to start up. That's a different topic, feel free to ask.

Once either one works, read the source. Typical code that does UI element placing looks like this:

Code: [Select]
_window = new Window(this, 320, 160, 0, 20, POPUP_BOTH);
_txtTitle = new Text(320, 17, 0, 30);
_btnOk = new TextButton(136, 16, 168, 155);
_btnStop = new TextButton(136, 16, 16, 155);
_btnSell = new ToggleTextButton(60, 16, 244, 61);
_txtAvailableEngineer = new Text(160, 9, 16, 50);
_txtAvailableSpace = new Text(160, 9, 16, 60);
_txtMonthlyProfit = new Text(160, 9, 168, 50);
_txtAllocatedEngineer = new Text(112, 32, 16, 80);
_txtUnitToProduce = new Text(112, 48, 168, 64);
_txtEngineerUp = new Text(90, 9, 40, 118);
_txtEngineerDown = new Text(90, 9, 40, 138);
_txtUnitUp = new Text(90, 9, 192, 118);
_txtUnitDown = new Text(90, 9, 192, 138);
_btnEngineerUp = new ArrowButton(ARROW_BIG_UP, 13, 14, 132, 114);
_btnEngineerDown = new ArrowButton(ARROW_BIG_DOWN, 13, 14, 132, 136);
_btnUnitUp = new ArrowButton(ARROW_BIG_UP, 13, 14, 284, 114);
_btnUnitDown = new ArrowButton(ARROW_BIG_DOWN, 13, 14, 284, 136);
_txtAllocated = new Text(40, 16, 128, 88);
_txtTodo = new Text(40, 16, 280, 88);

in files named something like src/???scape/????State.cpp

The four numbers are typically width, height, x, y

Change them, rebuild the exe, launch it to take a look.

So I've gotten the source files and have gotten Microsoft Visual Studio working and compiling. Your info on the Linux process wasn't useless, it came in useful at some stages when I was lost at a few points.
Anyone interested in using the Windows process instead of Linux should head over to the UFOpaedia:https://www.ufopaedia.org/index.php/Compiling_with_Microsoft_Visual_C%2B%2B_(OpenXcom)#Setting_up and read that.


I'm having a problem where the soldier name box is larger but the soldiers entire name doesn't make use of the new space. I'm guessing there is some sort of character limit somewhere that I can't seem to find so any input on that would also be appreciated.

Like I say I'm only playing around with the UI so excuse the poor quality.

Spoiler:
« Last Edit: January 01, 2019, 07:02:41 pm by TheIrishAce »

Offline TheIrishAce

  • Squaddie
  • *
  • Posts: 7
    • View Profile
Re: How to edit User Interfaces, and adjust their contents
« Reply #14 on: January 02, 2019, 05:55:27 am »
So as a quick wrap up to this thread I just want to say thanks to everyone for your input and assistance, I've made great progress with editing the UI inside the source files so again thanks to everyone for the assistance.  ;D

Quick look at my progress using the help here, and using the documentation
Spoiler:
Spoiler:
Spoiler:
Spoiler: