Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- To add a custom properties tab to aircraft in the Mission Editor, add the following structure within the aircraft definition in the aircraft lua.
- AddPropAircraft = {
- { id = "CheckboxPlaceholder" , control = 'checkbox', label = _('Checkbox Placeholder'), defValue = false },
- { id = "MassChangePlaceholder" , control = 'checkbox', label = _('Mass Change Placeholder'), defValue = false, weight = 500},
- { id = "CombolistPlaceholder" , control = 'comboList', label = ('Combolist Placeholder'), defValue = 0,
- values = {
- { id = 0, dispName = _("ITEM1")},
- { id = 1, dispName = _("ITEM2")},
- },},
- { id = "SliderPlaceholder", control = 'slider', label = _('Slider Placeholder'), defValue = 90, min = 0, max = 100, dimension = '%'},
- },
- -- To read these properties in LUA:
- -- UNKNOWN??
- -- To read these properties in C++ (Two methods):
- -- EFM functions:
- //////////////////
- void ed_fm_set_property_numeric(const char * property_name, float value)
- {
- std::string s_property_name = std::string(property_name);
- if (s_property_name.compare("<PROPERTY_NAME>") == 0)
- {
- //use float value
- }
- }
- void ed_fm_set_property_string(const char * property_name, const char * value)
- {
- std::string s_property_name = std::string(property_name);
- if (s_property_name.compare("<PROPERTY_NAME>") == 0)
- {
- //use string value
- }
- }
- /////////////////
- -- exported dll function ed_cockpit_aircraft_get_property:
- /////////////////////////////////
- // define structure of data returned
- struct aircraft_property
- {
- const char* s_val;
- float val;
- };
- //create a typedef for the function prototype
- typedef aircraft_property (*PFN_ED_COCKPIT_AIRCRAFT_GET_PROPERTY)(const char* property_name);
- //grab the dll
- HMODULE cockpit_dll = GetModuleHandle("CockpitBase.dll");
- //get the function address
- PFN_ED_COCKPIT_AIRCRAFT_GET_PROPERTY aircraft_get_property = (PFN_ED_COCKPIT_AIRCRAFT_GET_PROPERTY)GetProcAddress(cockpit_dll, "ed_cockpit_aircraft_get_property");
- // declare property structure
- aircraft_property prop;
- // get property data
- prop = aircraft_get_property("<PROPERTY_NAME");
- // use property float data with:
- prop.val
- // or use character string data with:
- prop.s_val
- ////////////////////////////////
Add Comment
Please, Sign In to add comment