Game Development Community

dev|Pro Game Development Curriculum

Custom Application Icons (TGEA)

by Quinton Delpeche · 08/07/2008 (11:17 am) · 4 comments

Introduction:
The current version of TGEA uses a default icon for the executable which you can override by copying your icon over it, however the current code does not have the facility to put in a window icon as well. This resource will allow you to do just that and ensure that your icons meet the best practices laid out by Microsoft.

Compatability:
TGEA 1.7.1
TGEA 1.8.0
TGEA 1.8.1

Assumptions:
1). You know how to create an icon file (.ico) with some or other graphics program. I used The GiMP.
2). You are using Visual Studio or very similar IDE (Integrated Development Environment).


Step 1:
Firsty you will need two icons one sized 48x48 pixels and one sized 16x16 pixels. The 48x48 pixel icon is used for the standard executable where as the 16x16 pixel icon is used for the minimised view and the application window icon. Furthermore Windows Explorer will use either icon when displaying the executable.

Once you have created these icons, copy them to you buildFiles directory that you are using (i.e. buildFiles/VisualStudio 2005/projects/ or buildFiles/VisualStudio 2008/projects/). You will know that this is the correct folder if you can see another icon file in there called "torque.ico".


Step 2:
The first file you will modify is the "Torque.rc" file. Open your project in your compiler and find the "Torque.rc" file. Right-click on it and select "View Code".

Find the section of the file that reads (normally around line 31):
IDI_ICON1               ICON    DISCARDABLE     "torque.ico"

Add the lines indicated below underneath the section so your code will look as follows:
//IDI_ICON1               ICON    DISCARDABLE     "torque.ico"
IDI_ICON1               ICON    DISCARDABLE     "YOUR-ICON_48x48.ico"
IDI_ICON2               ICON    DISCARDABLE     "YOUR-ICON_16x16.ico"


Step 3:
The second file you need to modify is the "T3D/resource.h" file. Open this file in your compiler.

Find the section of the file that reads (normally around line 6):
#define IDI_ICON1                       103

Add the lines indicated below underneath the section so your code will look as follows:
#define IDI_ICON1                       103
#define IDI_ICON2                       107


Step 4:
The third and final file you need to modify is the "windowManager/win32/win32Window.cpp". Open this file in your compiler.

Find the section of the file that reads (normally around line 35-37):
#ifndef IDI_ICON1 
#define IDI_ICON1 103
#endif

Add the lines indicated below underneath the section so your code will look as follows:
#ifndef IDI_ICON1 
#define IDI_ICON1 103
#endif

#ifndef IDI_ICON2
#define IDI_ICON2 107
#endif

Find the section of the file that reads (normally around line 299):
HICON   appIcon = LoadIcon(appInstance, MAKEINTRESOURCE(IDI_ICON1));

Modify the lines indicated below underneath the section so your code will look as follows:
HICON   appIcon = LoadIcon(appInstance, MAKEINTRESOURCE(IDI_ICON1));
HICON   appSmallIcon = LoadIcon(appInstance, MAKEINTRESOURCE(IDI_ICON2));

Find the section of the file that reads (normally around line 307-308):
classInfo.hIcon         = appIcon;           // Icon name
classInfo.hIconSm       = appIcon;           // Icon name

Modify the lines indicated below underneath the section so your code will look as follows:
classInfo.hIcon         = appIcon;           // Icon name
classInfo.hIconSm       = appSmallIcon;           // Icon name


Conclusion:
Once you have made those changes to the code and saved your files, you should be able to compile the solution without any errors. Now when you start you game up you will have a nice Application Window Icon and one on your Executable.


Revisions:
12 Aug 2008 - Fixed some spelling and syntax errors in the text.
14 Aug 2008 - Updated Step 4 that wasn't 100% complete.
18 Aug 2008 - Updated Step 4 and fixed some errata.
9 Jan 2009 - Updated compatability list and tested with TGEA 1.8.0.
6 April 2009 - Updated compatability list and tested with TGEA 1.8.1.
8 April 2009 - Changed resource to use new code block formatting.

About the author

Gobbo Games is an Independent Games Development company operating from Durban in South Africa. We believe in creating high-quality cost-effective games that remain true to the belief of Independent Game Developers around the world.


#1
08/08/2008 (4:35 am)
hehe.. nice job Quinton. Thanks for your contribution. I think I shall use it in near future.
#2
08/11/2008 (9:08 pm)
Thank you for this contribution. Hope to see more :) I had the same issue forever
#3
07/23/2009 (2:19 pm)
Awesome thanks!
#4
04/08/2012 (11:42 pm)
Oftentimes, expensive tiffany and co jewelry jewelry get learned merely women of all ages that contain dads. Charm bracelets seemed to be often Cheap beats times with the toys that this little girl earns on birth records or sometimes top selling baptism. occasions True Religion Outlet because a young stumbling crazy about charm additionally, the thinking in it, they begin picking the True Religion Outlet appropriate that. Once the author grows to perhaps passes across True Religion sale the actual youth, your girl repeatedly has an big selection of them dearest valuables.