Author Topic: Chage in code to transparent background  (Read 2013 times)

Offline Creature

  • Squaddie
  • *
  • Posts: 6
    • View Profile
Chage in code to transparent background
« on: March 07, 2020, 11:02:04 pm »
On geoscape - Finance, Ufopedia, Settings. All of them have transparent background, other not.

How to change code?

In which place should i change the lines of code to do that the study, or soldier, or inventory window opens in the same transparent background frame

Offline The Reaver of Darkness

  • Commander
  • *****
  • Posts: 1510
    • View Profile
Re: Chage in code to transparent background
« Reply #1 on: March 13, 2020, 01:21:07 pm »
You have to use the transparent color, which is #0 on the palette. It is in the grayscale color range, though some color scripts may intentionally avoid using it. If you can put in your own image, that'll be easiest (make sure it has the correct palette); just set your transparent area to color #0. To do it with the .SPK files, you'd have to command the game to display it with the grayscale color range, and it'd have to have the brightest color where you want the transparency. I'm not sure but I think you set a color offset (in multiples of 16--one color segment) which will vary depending upon the base color of the image. It's difficult, so I recommend just adding your own images to the game. They must be .png or .gif (preferably .png) and they must have a 256-color palette. If you copy an existing similar image from a mod, you can get the correct palette that way, though keep in mind there are multiple palettes used in different parts of the game. You'll need an image editor that is able to work with 256-color palettes, such as Irfanview, ASEprite, MTpaint, or GIMP. Photoshop and MS Paint will not work.
« Last Edit: March 15, 2020, 09:22:21 am by The Reaver of Darkness »

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 8597
    • View Profile
Re: Chage in code to transparent background
« Reply #2 on: March 13, 2020, 01:36:38 pm »
this has nothing to do with palettes, it's not transparency, it's normal drawing of one surface over another

the question is rather pointless, because if you know how to change the code, you can easily find what to do...
... and if you don't know how to change the code, telling you how it is done will not help you

but I'll tell you anyway (to prevent further wrong information)
for example for Ufopedia, it's this line: https://github.com/OpenXcom/OpenXcom/blob/master/src/Ufopaedia/UfopaediaStartState.cpp#L41
for Finance: this line: https://github.com/OpenXcom/OpenXcom/blob/master/src/Geoscape/FundingState.cpp#L43
and for Settings: this line: https://github.com/OpenXcom/OpenXcom/blob/master/src/Menu/PauseState.cpp#L46