Forum

CSQC GUI for DarkPlaces

Discuss programming in the QuakeC language.

Moderator: InsideQC Admins

CSQC GUI for DarkPlaces

Postby metalbeast » Sun Aug 29, 2010 10:19 am

Hi!
I made a structured GUI for DarkPlaces, that can handle windows/buttons/editfields/ect...
All objects are placed in a tree structure, so it can handle child objects (like a button in the window) and you can add custom events to all object (at onMousePressed/Released).
I tried to make the whole "GUI object" creation/customization simple as I can. For example this creates a window:

void() createWindow = {
entity window, button;
window = createGuiObj(world/*this is the parent*/,"window1"/*this is the ID*/ );
window.text = "Your First Window"; //The title
window.position = '10 10 0';
window.size = '120 80 0 ';
window.onMousePressed = dragMove_Start;
window.onMouseReleased = dragMove_Finish;
//it's now "draggable"... Yeah :)

button = createGuiObj(window, "Button1"); //spawns Button1 as the child of Window
button.text = "BuTtOn";
button.position = '10 10 0'; //Relative to the window... :)
button.size = '50 20 0';
button.onMouseReleased = yourFunctionThatDoWhatYouWant;
}

The whole thing is available to download with source at:
http://gprograms.co.cc/

There's also a video:
http://www.youtube.com/watch?v=RVgPOkGL0u0

I think this stuff can be useful for somebody who want handle a little bit more advanced GUI, but send me a feedback.

Btw, it's in an early stage, it's not well documented, and far from complete...
(and sorry for the bad english)
metalbeast
 
Posts: 4
Joined: Tue Jul 06, 2010 7:27 am

Postby Downsider » Sun Aug 29, 2010 4:01 pm

Looks great! Would love to see it bound to a texture ala Doom 3.
User avatar
Downsider
 
Posts: 621
Joined: Tue Sep 16, 2008 1:35 am

Postby Swift » Sun Aug 29, 2010 4:02 pm

This is really good.
Swift
 
Posts: 60
Joined: Tue Jan 26, 2010 11:02 am

Postby jim » Sun Aug 29, 2010 4:33 pm

Looks good so far :)
zbang!
User avatar
jim
 
Posts: 599
Joined: Fri Aug 05, 2005 2:35 pm
Location: In The Sun

Postby Julius » Sun Aug 29, 2010 4:35 pm

Ahh, this is the new panel hud from Xonotic right?

Do you think it would be feasible to replace the entire menu with this system also?

How would one go about making a fixed set of "windows" that can not (so easily) switched around by the users?
Julius
 
Posts: 93
Joined: Sun Aug 29, 2010 4:32 pm

Postby dreadlorde » Sun Aug 29, 2010 8:50 pm

Looks complicated. I don't see the point of customizing the HUD. Design a simple, aesthetically pleasing HUD; like the hud from borderlands, but a wee bit smaller, and leave it be.
Ken Thompson wrote:One of my most productive days was throwing away 1000 lines of code.

Get off my lawn!
User avatar
dreadlorde
 
Posts: 268
Joined: Tue Nov 24, 2009 2:20 am

Postby leileilol » Sun Aug 29, 2010 11:43 pm

holy crap you're making a working gui system for the people how is this even possible this is something we've been waiting years for!

by the way what license is this in? if you make it a public domain one it might actually be adopted by modders here as well as the gpl folk. I ask because it's not specified
i should not be here
leileilol
 
Posts: 2783
Joined: Fri Oct 15, 2004 3:23 am

Postby metalbeast » Mon Aug 30, 2010 6:26 am

Downsider: I read that rendering to world polygons is impossible via CSQC... If it's correct, than I can't make "Doom3-style" screens... :cry:
http://qexpo.tastyspleen.net/booth.php?id=165&page=308

Julius: I'm not working on Xonotic. Just for fun :)

dreadlorde: You make a custom HUD with it. I don't played Borderlands yet, but it's possible to make a custom HUD. There is a GUI flag "GUIFLG_ALWAYSDRAW" witch means the object is always rendered, even the input type is switched back to the game, not the GUI. Look at the video (the HP bar). It's possible to do it with all stats like ammo, armor, etc...

Julius: The same way (with GUIFLG_ALWAYSDRAW) it's possible to create an object wich can't be so easily switched off, like an alert window.
For example, the ssqc prints to the client "Alertwindow I will kick you!\n", and in CSQC you can create an alert window in CSQC_Parse_Print with GUIFLG_ALWAYSDRAWN.
I think it can be implemented to MenuQC, but the input is quite different. I can't figure out how can MenuQC handle released keys or mouse buttons :(

leileilol:
From now it's in LGPL license. I hope it will helps a lot for other modders. I think QC still rocks, just take a look at Twig Physics Lib.

BTW i updated the stuff... Now it fades in and out on createing and destroying elements...
http://gprograms.co.cc/project/159/csqcgui

Now, I'm working on an edit field, witch can contain a multi-line text, and more advanced string handling in the edit/password fields .

And Thanks for the feedbacks!
metalbeast
 
Posts: 4
Joined: Tue Jul 06, 2010 7:27 am

Postby Spike » Mon Aug 30, 2010 8:47 am

While you can't currently render to world polygons right now, what you can do is render polygons that are visible in the world just like world polys are.
Render to texture would be nice though.
Spike
 
Posts: 2892
Joined: Fri Nov 05, 2004 3:12 am
Location: UK


Return to QuakeC Programming

Who is online

Users browsing this forum: No registered users and 1 guest