Doom3world

The world is yours! Doom 3 - Quake 4 - ET:QW - Prey - Rage
It is currently Wed Jun 19, 2013 10:54 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Adjustable GUI
PostPosted: Fri Jul 27, 2012 7:55 am 
Offline
did just hit his 750th monster

Joined: Mon Jan 01, 2007 5:13 am
Posts: 872
Location: TX, US
Is there something like if() or switches in the GUI scripts to adjust positioning and size of containers based on aspect ratio cvar value ?


Top
 Profile  
 
 Post subject: Re: Adjustable GUI
PostPosted: Fri Jul 27, 2012 1:01 pm 
Offline
Last man standing
User avatar

Joined: Thu Aug 19, 2004 7:22 pm
Posts: 1129
Have you bothered to look at any guis? Because there's if's all over the place. So yes, there are if's and they can be used to change size/position based on aspect ratio.


Top
 Profile E-mail  
 
 Post subject: Re: Adjustable GUI
PostPosted: Fri Jul 27, 2012 7:52 pm 
Offline
picked up the chaingun
User avatar

Joined: Mon Jul 18, 2011 5:58 am
Posts: 193
If what you want to achieve is, depending on the status of the r_aspectratio cvar, change the position (RECT for gui code) of certain windowDef's, then it's possible.
It does work for mainmenu GUI's, however I haven't tested it in 'in-game' GUIs, but it should work.
Write the following in the gui file:

Code:
choiceDef aspect_ratio {
      rect      0, 0, 0, 0
      choices      "0;1;2"
      cvar      "r_aspectratio"
      currentChoice   0
      choiceType   0
   }

// 0 = 4:3
// 1 = 16:9
// 2 = 16:10


But now you need to tell the engine what to do with that:

Code:
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//  Events
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

   onEvent {
      if ("gui::r_aspectratio" == 0) {   // here the cvar is 0 = 4:3
         set "DO ALL YOUR SETUP HERE"
      }

      if ("gui::r_aspectratio" == 1) {   // here the cvar is 1 = 16:9
         set "DO ALL YOUR SETUP HERE"
      }

      if ("gui::r_aspectratio" == 2) {   // here the cvar is 2 = 16:10
         set "DO ALL YOUR SETUP HERE"
      }
   }

This means that whenever the r_aspectratio cvar is changed, the engine does what you told it to do (hence the onEvent statement)

FOR EXAMPLE

Code:
   if ("gui::r_aspectratio" == 0) {
         set "OptionsBtnText::rect" "20 20 80 20" ;
      }
      if ("gui::r_aspectratio" == 1) {
         set "OptionsBtnText::rect" "80 60 80 20" ;
      }
      if ("gui::r_aspectratio" == 2) {
         set "OptionsBtnText::rect" "0 90 80 20" ;
      }

// Notice the rect is the position on-screen X, Y, X SIZE, Y SIZE

_________________
FFYL
------
Doom 3: S.T.A.R 1088


Last edited by chimueloeldragon2011 on Fri Jul 27, 2012 9:33 pm, edited 1 time in total.

Top
 Profile E-mail  
 
 Post subject: Re: Adjustable GUI
PostPosted: Fri Jul 27, 2012 8:02 pm 
Offline
did just hit his 750th monster

Joined: Mon Jan 01, 2007 5:13 am
Posts: 872
Location: TX, US
Thanks a bunch! Sounds like it's going to be quite a huge code ;)


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group