Welcome, Guest! Login | Register

UI Tutorial #3 [Print this Article]
Posted by: IoN_PuLse
Date posted: May 05 2003
User Rating: N/A
Number of views: 2128
Number of comments: 0
Description: Images for buttons
Ok to basically outline what this tutorial will entail, I will show you how to change the main menu of Quake3, specifically changing the “EXIT” button into a BFG explosion two-frame animation. Simple? Actually it is. I recommend you read my previous tutorials before attempting this one, if you want to understand absolutely everything. Here’s what you need to do first, near the top of ui_menu.c:

Add
 CODE  

#define ART_EXIT0      "models/weaphits/bfgboom/bfgboom_2"
#define ART_EXIT1      "models/weaphits/bfgboom/bfgboom_3"
// Image locations


After
 CODE  

#define ID_EXIT       16


Then right below that comment out
 CODE  

    menutext_s  exit;


And instead put
 CODE  

    menubitmap_s  exit;
// tells Quake3 that you’re using an image not text


Then scroll down and find MainMenu_Cache and add:
 CODE  

    trap_R_RegisterShaderNoMip( ART_EXIT0 );
    trap_R_RegisterShaderNoMip( ART_EXIT1 );
// caching of the images defined above


And last but not least (most important part actually) comment out the follow like I have already done:
 CODE  

    y += MAIN_MENU_VERTICAL_SPACING;
/*  s_main.exit.generic.type    = MTYPE_PTEXT;
    s_main.exit.generic.flags    = QMF_CENTER_JUSTIFY|QMF_PULSEIFFOCUS;
    s_main.exit.generic.x     = 320;
    s_main.exit.generic.y     = y;
    s_main.exit.generic.id        = ID_EXIT;
    s_main.exit.generic.callback   = Main_MenuEvent;
    s_main.exit.string      = "EXIT";
    s_main.exit.color      = color_red;
    s_main.exit.style      = style; */


And below paste:

 CODE  

    s_main.exit.generic.type  = MTYPE_BITMAP;
// image, not text
    s_main.exit.generic.name  = ART_EXIT0;
// first image to display, when the mouse isn’t on it
    s_main.exit.generic.flags  = QMF_LEFT_JUSTIFY|QMF_PULSEIFFOCUS;
// flags
    s_main.exit.generic.callback    = Main_MenuEvent;
// what menu to issue the command in
    s_main.exit.generic.id     = ID_EXIT;
// the ID for what the button does when clicked
    s_main.exit.generic.x      = 300;
// x coordinate
    s_main.exit.generic.y      = y;
// y coordinate
    s_main.exit.width    = 70;
// image width
    s_main.exit.height    = 70;
// image height
    s_main.exit.focuspic   = ART_EXIT1;
// image that it flashes to when the mouse is over it


You don’t need any extra pk3’s for this, just compile the source and run Quake with the fs_game command or selecting the folder in the MODS menu. Now you have a nifty BFG explosion for a quit button =)

Rate This Article
This article has not yet been rated.

You have to register to rate this article.
User Comments

No User Comments

You must register to post a comment. If you have already registered, you must login.

Latest Articles
3rd person View in Multiplayer
Half-Life 2 | Coding | Client Side Tutorials
How to enable it in HL2DM

By: cct | Nov 13 2006

Making a Camera
Half-Life 2 | Level Design
This camera is good for when you join a map, it gives you a view of the map before you join a team

By: slackiller | Mar 04 2006

Making a camera , Part 2
Half-Life 2 | Level Design
these cameras are working monitors that turn on when a button is pushed.

By: slackiller | Mar 04 2006

Storing weapons on ladder
Half-Life 2 | Coding | Snippets
like Raven Sheild or BF2

By: British_Bomber | Dec 24 2005

Implementation of a string lookup table
Half-Life 2 | Coding | Snippets
A string lookup table is a set of functions that is used to convert strings to pre-defined values

By: deathz0rz | Nov 13 2005


Latest Comments
Spinning Corpses Simple Fix
Half-Life | Coding | Snippets
By: darkPhoenix | Sep 05 2008
 
Where do we go from here
General | News
By: MIFUNE | Jun 09 2008
 
The Input/Output system
Half-Life 2 | Level Design
By: nazitaco | Dec 23 2007
 
Where do we go from here
General | News
By: Rob_F | Nov 22 2007
 
Rescaling Half-Life
Half-Life | Coding | Shared Tutorials
By: christoph | Nov 12 2007
 
GameUI
Half-Life 2 | Coding | Client Side Tutorials
By: Evil_j | Oct 29 2007
 
3 State Zoom For Any Weapon
Half-Life 2 | Coding | Server Side Tutorials
By: Ennuified | Oct 18 2007
 
Storing weapons on ladder
Half-Life 2 | Coding | Snippets
By: cct | Sep 07 2007
 
CTF Gameplay Part 1
Half-Life | Coding | Shared Tutorials
By: DarkNight | Aug 28 2007
 
CTF Gameplay Part 1
Half-Life | Coding | Shared Tutorials
By: deedok | Aug 20 2007
 

Site Info
296 Approved Articless
5 Pending Articles
3940 Registered Members
0 People Online (17 guests)
About - Credits - Contact Us

Wavelength version: 3.0.0.9
Valid XHTML 1.0! Valid CSS!