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: 4047
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 05 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
knock knock
General | News
By: omega | Dec 22 2016
 
knock knock
General | News
By: MIFUNE | Oct 10 2015
 
New HL HUD Message System
Half-Life | Coding | Shared Tutorials
By: chbrules | Dec 31 2011
 
knock knock
General | News
By: Whistler | Nov 05 2011
 
Particle Engine tutorial part 4
Half-Life | Coding | Client Side Tutorials
By: darkPhoenix | Feb 18 2010
 
Particle Engine tutorial part 2
Half-Life | Coding | Client Side Tutorials
By: darkPhoenix | Feb 11 2010
 
Particle Engine tutorial part 3
Half-Life | Coding | Client Side Tutorials
By: darkPhoenix | Feb 11 2010
 
Game Movement Series #2: Analog Jumping and Floating
Half-Life 2 | Coding | Shared Tutorials
By: mars3554 | Oct 26 2009
 
Particle Engine tutorial part 5
Half-Life | Coding | Client Side Tutorials
By: Deadpool | Aug 02 2009
 
Particle Engine tutorial part 5
Half-Life | Coding | Client Side Tutorials
By: Persuter | Aug 02 2009
 

Site Info
297 Approved Articless
8 Pending Articles
3940 Registered Members
0 People Online (4 guests)
About - Credits - Contact Us

Wavelength version: 3.0.0.9
Valid XHTML 1.0! Valid CSS!