The following warnings occurred: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Warning [2] Undefined array key "lockoutexpiry" - Line: 94 - File: global.php PHP 8.1.27 (Linux)
|
Adding Custom Setting - Printable Version +- Forums (https://www.vdrift.net/Forum) +-- Forum: Project (https://www.vdrift.net/Forum/forumdisplay.php?fid=4) +--- Forum: Development (https://www.vdrift.net/Forum/forumdisplay.php?fid=9) +--- Thread: Adding Custom Setting (/showthread.php?tid=1702) |
Adding Custom Setting - Linksblackmask - 03-13-2013 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 RE: Adding Custom Setting - NaN - 03-14-2013 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 ] 2. Write a GAME:opulateRecordData 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. RE: Adding Custom Setting - Linksblackmask - 03-14-2013 :O Record Data is a predefined list, 0 1 2 3, so I've found one that looked similar Okay, Thanks NaN! - getting on it RE: Adding Custom Setting - Linksblackmask - 03-14-2013 Winning! Thanks works great! |