example usage:
this is using the hashlist (which works well with an Emesary notification)
basically when the method is called it will call each section (in the lambda)
when the value changes by more than the amount specified as the second parameter.
It is possible to reference multiple elements from the hashlist in each FromHashList; if either
one changes then it will result in the lambda being called.
obj.update_items = [
UpdateManager.FromHashList(["VV_x","VV_y"], 0.01, func(val)
{
obj.VV.setTranslation (val.VV_x, val.VV_y + pitch_offset);
}),
UpdateManager.FromHashList(["pitch","roll"], 0.025, func(hdp)
{
obj.ladder.setTranslation (0.0, hdp.pitch * pitch_factor+pitch_offset);
obj.ladder.setCenter (118,830 - hdp.pitch * pitch_factor-pitch_offset);
obj.ladder.setRotation (-hdp.roll_rad);
obj.roll_pointer.setRotation (hdp.roll_rad);
}),
props.UpdateManager.FromProperty("velocities/airspeed-kt", 0.01, func(val)
{
obj.ias_range.setTranslation(0, val * ias_range_factor);
}),
props.UpdateManager.FromPropertyHashList(["orientation/alpha-indicated-deg", "orientation/side-slip-deg"], 0.1, func(val)
{
obj.VV_x = val.property["orientation/side-slip-deg"].getValue()*10; # adjust for view
obj.VV_y = val.property["orientation/alpha-indicated-deg"].getValue()*10; # adjust for view
obj.VV.setTranslation (obj.VV_x, obj.VV_y);
}),
]
==== the update loop then becomes ======
foreach(var update_item; me.update_items)
{
# hdp is a data provider that can be used as the hashlist for the property
# update from hash methods.
update_item.update(hdp);
}