Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Adding Custom Setting
03-13-2013, 11:44 PM,
#1
Adding Custom Setting
Hello Again All,

I was hoping for some advice, I'm trying add my own game setting to the options, and have hit a snag, it doesn't seem to want to show my option...

I have currently done the following;

--

added this to settings.h
public...
int GetRecordData() const
{
return RecordData;
}

void SetRecordData(int value)
{
RecordData = value;
}

private...
int RecordData;

added -

RecordData(0)

to the SETTINGS::SETTINGS() in settings.cpp

added-

Param(config, write, section, "RecordData", RecordData);

to the "display" section in SETTINGS::Serialize in settings.cpp

--

I have seen within vdrift.config my param has been added, however it fails to appear in the GUI, so my question is where/how do I add the option to the GUI??

and help would be massively appreciated!

all the best

Smile
Reply
03-14-2013, 07:56 AM, (This post was last modified: 03-14-2013, 08:11 AM by NaN.)
#2
RE: Adding Custom Setting
Ah, the SETTINGS class. Need to remove it someday, and serialize options directly instead.

I assume the RecordData value is some index, which is limited to some number. This number is determined at runtime?

1. In data/settings/options.config add
Code:
[ record_data ]
cat = game
name = record_data
desc = bla...
type = int
default = 0
values = record_data

2. Write a GAME:TongueopulateRecordData function (have a look at the existing populate functions for inspiration) to init record_data option. Add it to PopulateValueLists function.

3. In data/skins/simple/menus pick the guipage you want your option to be available. The guipage config might look a bit scary at first, mostly because it is explicit. There is no layout manager and co. But in general all you have to do is copy/paste an existing option and adjust the vertical position (top) and widget calbacks.

Example of adding a record_data option to Garage guipage:
1. Copy Traction Control option widgets: widget-14a,..., widget-14d
2. Rename them to whatever names you prefer: record-lbl, record-prv, record-nxt, record-val
3. Change record-lbl text
4. Fix the onfocus/onblur callbacks to point to the renamed widgets
5. Change onselect/onmoveright/onmoveleft/text callbacks to use game.record_data option
6. Fix onmovedown/onmoveup callbacks of you new widgets, the widgets before(widget-14) and the following widgets (widget-16).
7. Adjust the vertical(top) placement of the new and the following widgets and the height of [bg-options], [bg-labels] (should be renamed to labels/options-bg).

I know it looks somewhat laborious. Ideally there would be a minimal gui editor to deal with the details.
Reply
03-14-2013, 10:26 PM, (This post was last modified: 03-14-2013, 10:48 PM by Linksblackmask.)
#3
RE: Adding Custom Setting
:O

Record Data is a predefined list, 0 1 2 3, so I've found one that looked similar Smile

Okay, Thanks NaN! - getting on it Smile
Reply
03-14-2013, 11:29 PM,
#4
RE: Adding Custom Setting
Winning! Thanks works great! Smile
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)