
Gui Tutorial
|
Copyright info |
|
All
code in this tutorial is protected by the [GPL License]. |
|
Tutorial by: Riot |
||||||||||||||||||||||||||||||||||||||||||||||||
|
Mailto: riot@planetquake.com Well, I
decided that it was so easy to integrate in the first place, I may as well
share the love. Here's a tutorial for how to integrate my mouse-driven
window/control based GUI in to Q2! First, you'll
need the UIX code package. UIX is a LGPL'ed desktop-style window/mouse driven
GUI I came up with. It's totally modular, and once the UI code is integrated,
the engine will function without UIX, but it won't allow you to use the
menus. The downloadable version even works in software mode! Unfortunately,
it doesn't appear to work in windowed mode, so until I can find the cause of
that problem, it'll have to stay unsolved. UIX can be
downloaded at http://www.planetquake.com/qxx/
Now then, on
with the tutorial... Open cl_main.c
and in CL_Init, replace the line:
with this:
Open cl_scrn.c
and in SCR_UpdateScreen, there are two lines reading:
Replace them
both with:
Open
console.c, and in Con_ToggleConsole_f, replace this block:
With this:
Then, search
for the line:
and comment it
out. Open keys.c
and in Key_Event, replace this code block:
with this:
Look for a
comment block that starts with:
Before it, add
the code:
Then, find the
line:
Replace it
with:
Open in_win.c.
Search for the line:
After it, add
these lines:
Then, find the
line:
After it, add
the line:
Go to the
IN_MouseMove function. Replace this:
With this:
Open
cl_main.c, and comment out the lines:
and
Open
vid_menu.c, and comment out the line:
And comment
out the entire contents of the CancelChanges function. Finally, open
client.h, and replace this:
with this:
Now, put ui.c
and uix.h in the "client" folder, remove menu.c from your project
and add ui.c. Drop ui.dll in the same folder as your Q2 EXE, and bam, you've
got a GUI! Unfortunately,
UIX is currently only designed to handle my in-progress game, so you'll have
to create the interface yourself. However, UIX's framework is pretty easy to
learn. The menus.cpp file houses the current interface settings, so you can
tweak them to your liking. |
Tutorial Originally found at: