Some time ago I have started doing my own local insim from scratch, meaning there is no libraries of any kind and such.
Program does part of things as standard DX overlay (because its drawing exact car shapes in radar for cars around) and mainly via insim for menus ...
It does buttons pretty efficiently IMO, I store all buttons data in buttons class, when deleting I only delete button which are actually there, as well as I only update button when its data has changed.
This simplifies code (which draw menus ...) there is no need to check each iteration if buttons should be updated, in fact it only upates changed buttons which is more efficient, as well as redrawing is way faster.
Recently I realized a lot of button IDs are often unused while on other side I actually lack button.
Current code does things as efficiently as it can, IDs are more or less static, for example couple of functions (which cannot be run simultaneously) have assigned same range of about 200 IDs.
So as possible solution for problem I thought to implement dynamic assigning of IDs, which will allow me more efficent usage of IDs, because sometimes not all static IDs are used (user can choose to not display all data, in cases like speedometer, fuel, rpm,...) or this is a bit overkill, because it complicates code, and I will have to handle all cases like when maximum number of buttons is reached, in case I choose to display even more data ...
To be honest I never even looked at any insim program code or library. I would like to hear opinions of others about this, how people handle such things, all comments are welcome.
Here is example on what I'm wasting all these IDs
Program does part of things as standard DX overlay (because its drawing exact car shapes in radar for cars around) and mainly via insim for menus ...
It does buttons pretty efficiently IMO, I store all buttons data in buttons class, when deleting I only delete button which are actually there, as well as I only update button when its data has changed.
This simplifies code (which draw menus ...) there is no need to check each iteration if buttons should be updated, in fact it only upates changed buttons which is more efficient, as well as redrawing is way faster.
Recently I realized a lot of button IDs are often unused while on other side I actually lack button.
Current code does things as efficiently as it can, IDs are more or less static, for example couple of functions (which cannot be run simultaneously) have assigned same range of about 200 IDs.
So as possible solution for problem I thought to implement dynamic assigning of IDs, which will allow me more efficent usage of IDs, because sometimes not all static IDs are used (user can choose to not display all data, in cases like speedometer, fuel, rpm,...) or this is a bit overkill, because it complicates code, and I will have to handle all cases like when maximum number of buttons is reached, in case I choose to display even more data ...
To be honest I never even looked at any insim program code or library. I would like to hear opinions of others about this, how people handle such things, all comments are welcome.
Here is example on what I'm wasting all these IDs