HeroEngine Forums
Welcome, Guest. Please login or Register for HeroCloud Account.

Author Topic: Question about rounded corners  (Read 3430 times)

Arborlon

  • World Owners
  • ****
  • Posts: 10
    • View Profile
Question about rounded corners
« on: Feb 16, 14, 06:37:32 PM »

I was working on creating some tooltips for my GUI today and I came across this thread:

https://community.heroengine.com/forums/index.php/topic,1743.0.html

(which was enormously helpful by the way, thanks), and I noticed how the author had rounded corners on the tooltip and I wanted to try and recreate something similar.  I am curious how this was done.  I didn't see any way to do it using the built in border GUI controls, I was able to create borders but wasn't able to create anything rounded so I tried creating an image in GIMP with transparency and using it as a texture on the background of my panel, but the transparency just showed the white instead of the game.

From reading other posts it seems I might need to create an alpha mask but I am not quite sure how to go about doing that.  I see a field called alphamask but I am at a loss on how to use it.

« Last Edit: Feb 16, 14, 06:42:22 PM by Arborlon »
Logged
Mornroc
Arborlon Online

FI-ScottZ

  • General Accounts
  • *
  • Posts: 1407
    • View Profile
    • Forever Interactive, Inc.
Re: Question about rounded corners
« Reply #1 on: Feb 16, 14, 07:00:44 PM »

What image format are you using?  Personally, I always use the PNG format for gui images.  The files take up less space than dds since we don't need any mipmaps for them.  With png I have never had any issues with setting parts of them to be transparent and then having it appear as such in the game.
Logged
Scott Zarnke
Lead Programmer, Visions of Zosimos
CTO, Forever Interactive, Inc.

Arborlon

  • World Owners
  • ****
  • Posts: 10
    • View Profile
Re: Question about rounded corners
« Reply #2 on: Feb 16, 14, 11:03:13 PM »

I tried DDS and PNG.  Neither worked.  I verified in Windows with another image program that there was indeed a transparent area at the corners, so I know the image is good.

Is there any way to do this without a texture?  Just using the built in color tools?
Logged
Mornroc
Arborlon Online

WorldWideZ

  • World Owners
  • ****
  • Posts: 524
    • View Profile
    • World Wide Zed
Re: Question about rounded corners
« Reply #3 on: Feb 17, 14, 12:35:50 AM »

I am assuming your using photoshop , but making a alpha channel is easy. open your image , and on the right side of the screen look for the "layers control" and change the tab to "channels" select one of the Red , blue or green channels that has the highest contrast between the object and the background. right click the channel and select duplicate. in the pop up box set the channel name to Alpha , and invert the image. Now just black out the transparent area of your image and white out the visible area , and your alpha mask is ready.
Logged

Arborlon

  • World Owners
  • ****
  • Posts: 10
    • View Profile
Re: Question about rounded corners
« Reply #4 on: Feb 17, 14, 03:25:31 PM »

I am using GIMP, and I did follow the process for adding an alpha channel, but as I said in my previous post my image definitely contains a transparent area, as I can see it in other image programs.

I wonder if maybe the white corners I am seeing are another panel below it showing through.  My GUI control looks like this:

ARB_MainMenuToolTips (using _panel)
-tooltipsWindow (using _panel)
--background (using _panel)
---ExitGame (using _label)
---Settings(using _label)
---ChracterSheet (using _label)

So I added the texture with the transparency to the background label.  I even tried setting the defaultPresentation on the _tooltipsWindow panel to use a transparent color #1,1,1,0.1 but no joy...
Logged
Mornroc
Arborlon Online

FI-ScottZ

  • General Accounts
  • *
  • Posts: 1407
    • View Profile
    • Forever Interactive, Inc.
Re: Question about rounded corners
« Reply #5 on: Feb 17, 14, 04:16:45 PM »

What is the defaultPresentation.color of the ARB_MainMenuToolTips itself?  It should have alpha of 0, otherwise it will show a color in back of the entire control.
Logged
Scott Zarnke
Lead Programmer, Visions of Zosimos
CTO, Forever Interactive, Inc.

Thazager

  • General Accounts
  • *
  • Posts: 1160
  • Never stop learning
    • View Profile
Re: Question about rounded corners
« Reply #6 on: Feb 17, 14, 07:20:10 PM »

I had a few things that showed through others at times, and sometimes you could not see any change.

Since then, I set the alpha of the GUI to 0.5 in order to see if they are stacking. I also set the colors slight diff (they could even be drastically different) but enough that you can see which is which. You can also set the visibility of each GUI to true and false to see if that was the one blocking others.

I also found in some places, where windows were stacking on top of others without removing the old. This is seen when the alpha becomes darker and darker with each new window. Many of these things can be done through code so you are not always remaking the GUI.
Logged
Lead scripter for EO, Repop helper.
HSL Video tutorials:
https://community.heroengine.com/forums/index.php/topic,1719.msg36858.html#msg3685

Arborlon

  • World Owners
  • ****
  • Posts: 10
    • View Profile
Re: Question about rounded corners
« Reply #7 on: Feb 17, 14, 10:18:01 PM »

Thanks Scott, that was it.  My control looks perfect now.  Apparently, I still had the alpha on the top layer to be 1.

@Thazager, I tried setting the top layers to not visible initially before playing with defaultpresentation, but when I did the entire control disappeared.  I never tried to continue playing with that because I assumed that visibility must be an inherited property from parent to child, since the whole thing vanished.  Is that not the case?

If it is possible to set a parent to invisible but a child to visible, that would certainly be another way to get there.

« Last Edit: Feb 17, 14, 10:28:41 PM by Arborlon »
Logged
Mornroc
Arborlon Online

Thazager

  • General Accounts
  • *
  • Posts: 1160
  • Never stop learning
    • View Profile
Re: Question about rounded corners
« Reply #8 on: Feb 17, 14, 11:44:06 PM »

Yes, its inherited property from parent to child. Of course with the inheritance, you can blank the whole GUI out with 1 line.

Using the defaultpresentation, you can set the alpha for 0, to make it unseen. That is how most background controls are set to hidden, with max transparency. When setting the visible = false, that would be for those that are on top (front to back on screen). Then you could see what is behind them. In the case of stacked panels.
Logged
Lead scripter for EO, Repop helper.
HSL Video tutorials:
https://community.heroengine.com/forums/index.php/topic,1719.msg36858.html#msg3685