Game Development Community

Button Borders

by Neil Marshall · in Torque Game Engine · 08/26/2002 (6:49 pm) · 15 replies

I'm changing the UI of my game and I can't seem to figure out where the standard button's border is controlled from. I'm trying to make it a solid colour instead of the 3D look and that's normally done by setting the border = 1 but for some reason I can't get buttons to change.

Does anyone know how to do it?

#1
08/26/2002 (8:11 pm)
hhmm... there's several files it could be. Do a search for 'window' (might say darkwindow, macwindow or whatever) and for 'button'. Probably they are in /common/ui
#2
08/27/2002 (3:36 am)
you might also want to try some of the "bitmap-button" code in the resources section, so you can use (guess what) bitmaps as buttons with mouseover and stuff.
#3
08/27/2002 (7:20 am)
Yeah I've already changed the Button and Window code to death. I can get rid of the borders on most of the objects, just not buttons for some reason. I was hoping I didn't have to resort to changing the bitmap buttons, but it's looking like I won't have a choice.
#4
08/27/2002 (6:52 pm)
Is it just me or do the existing bitmap buttons not have a disabled state?

Plus there are a couple of them, which one should I use?
#5
08/27/2002 (8:04 pm)
I think Alex was saying to create your own bitmaps and then use different gui controls to display them. I don't have any experience in that area.

Some borders are defined in the gui code, and some are from those files in the common/ui/ directory.

What are you trying to change? Have you tried those two files I told you?
#6
08/27/2002 (8:12 pm)
In the third post I said, I already tried changing those files. I've changed the look of all controls (by using those files and images) except for the border on the buttons.

Quote:I think Alex was saying to create your own bitmaps and then use different gui controls to display them. I don't have any experience in that area.

I believe he said that there were bitmap buttons in the code section of this site available for download... the problem is there are about 3 different ones and they don't seem to have a disabled state (at least as far as I could tell). I'm sure they will do the job, but they appear to be incomplete. :(
#7
08/27/2002 (8:29 pm)
Actually, you said changed the button code... not the buttons themselves. :-P lol

And, as I also said, there are two main possibilties: Some change via the the picture files and others through code.

look in defaultProfiles.cs or in the .gui of whatever gui's you are creating. DefaultProfiles.cs is commented, so it should help you find the correct border.
#8
08/27/2002 (8:36 pm)
Why do I feel this is going in circles?
#9
08/27/2002 (8:48 pm)
Because, you're frustrated and don't understand gui. Keep in mind that no one here is forced to help.

These are the possibilities:

* You changed the .gui code, but not the .png files.
* You changed the .png files, but not the .gui files.
* You changed the wrong .png AND/OR .gui files.
* You haven't deleted the appropriate .gui.dso file.
* You are doing something beyond the scope of the default gui (such as loading a custom bitmap).
#10
08/27/2002 (8:59 pm)
Quote:Keep in mind that no one here is forced to help.
I understand that. I didn't mean to sound that way. What I'm trying to say is I think we are saying the exact same thing.


Quote:* You changed the .gui code, but not the .png files.
mainMenuGui.gui doesn't appear to have anything in it to control the border. I have modified both defaultProfiles.cs defaultGameProfiles.cs files. I have been able to change the button face to bright yellow. I've been able to change the text colour to red. I've also been able to change some of the button border to magenta, but the border width is still 2 (or higher).

www.eightlines.com/neil/window.png
Quote:* You changed the .png files, but not the .gui files.
I have changed the png's for checkboxes, radio buttons, scrollbars, and windows. There currently isn't one for buttons.

Quote:* You haven't deleted the appropriate .gui.dso file.
I do del /s *.dso

Quote:* You are doing something beyond the scope of the default gui (such as loading a custom bitmap).
No custom bitmaps yet. I'm only changing existing information.

For now I've just let it go. I'll figure it out some other time. I've got lots of other stuff I can work on.
#11
08/27/2002 (9:23 pm)
No prob...



I have to go at the moment.. will check later. :-)
#12
08/27/2002 (11:19 pm)
OK...

I don't know how I missed that big yellow picture, but I did..lol. I know what you are looking for, now.
I don't know your setup, but ours uses themes--which you should be able to find in resources. The thing that should fix your problem, in particular is this change in defaultprofiles.cs:
if(!isObject(GuiButtonProfile)) new GuiControlProfile (GuiButtonProfile)
{
   opaque = true;
   border = true;
   fontColor = "0 0 0";
   fontColorHL = "32 100 100";
   fixedExtent = true;
   justify = "center";
	canKeyFocus = false;
   hasBitmapArray = true;
   bitmap = "./torqueButton";

};
The bitmap info is the key change. Try to find that theme in resources (sorry, I don't have the link). If you can't find it, let me know.

hehe... so now we see the source of the confusion. ;-) lol


Edit: Instead of that, another route might be to put
borderThickness = 1;
borderColor = "255 255 255";
in YOUR guibuttonprofile (not the one above). I would think that would cure your problem without going the themes route
#13
08/28/2002 (12:56 am)
Quote:
Is it just me or do the existing bitmap buttons not have a disabled state?
Plus there are a couple of them, which one should I use?

1. do regular buttons have a disabled state?
2. sorry, it's been a while since "we" implemented the bitmapbutton-code in our game and it looks like we just can't remember which one it was (sorry)! ;}

btw, wouldn't the buttons look "silly" without borders??
#14
08/28/2002 (7:08 am)
It still looks the same. I'll look into the themes code. That's probably what I want anyways.

if(!isObject(GuiButtonProfile)) new GuiControlProfile (GuiButtonProfile)
{
   // Yes this is the button section.
   opaque = true;
   border = 1; //true; // Unknown

   borderThickness = 1;
   borderColor = "255 204 0";
   
   fontColor = "0 0 0";
   fontColorHL = "0 0 0"; // "32 100 100"; // Hilighted button text
   fixedExtent = true;
   justify = "center";
	canKeyFocus = false;
};

Quote:
1. do regular buttons have a disabled state?

I'm not 100% sure, but I think they do. It looks like they rely on the GuiDefaultProfile which has a fillColorNA defined.

Quote:btw, wouldn't the buttons look "silly" without borders??

I'm not trying to remove the border outright. I'm trying to remove the 3d effect, which is normally done by setting the border = 1; (That is what I did on all the other controls some of which can be seen in the screenshot)
#15
08/28/2002 (7:18 am)
aye, that's what i meant: don't buttons look "silly" when they have no 3d-effect?

i'm not at all a coder but:
i'm not sure if you can just disable the 3d-effect by removing the borders since the buttons have a "press"-state when you click on them where the 3d-effect-borders are "inverse" (hope you know what i mean) ;)

sorry for not being able to help ...