I'm trying to make a brake lever using the switch_add function but the graphic keeps getting bunched up. The image is 208x778 but that does not seam to work.
The the X and Y settings have a limit?
Here is the code to add the images
switch_add("Parking_off.png", "Parking_on.png" , 0, 0, 208, 778, new_park_brake).
Once I getting it working I will trim the background out of the image.
I'm also including one of the images and the results.
Does switch_add have a size limit
Re: Does switch_add have a size limit
No, there are no limits. But I think we'll need more information, because I have no clue about what I'm looking at. Maybe someone else understands.
Re: Does switch_add have a size limit
Let me try to explain more. I'm using the code from one of the generic parking brakes and just want to change the image to the Piper parking brake handle. So I created 2 images, 1 for brake on and 1 for brake off. Changed the image names in the code and adjusted the size. When the image is displayed by air manager is it compressed and messed up as in the sample above.
Here is the code and an export of the instrument. The code is only 18 lines long including blank lines and comments.
Sorry I do not know how to make the code box so just pasting it here
--PARKING BRAKE
function new_park_brake(position)
xpl_command("sim/flight_controls/brakes_toggle_max")
fsx_event("PARKING_BRAKES")
fs2020_event("PARKING_BRAKES")
end
park_brake_sw = switch_add("Parking_off.png", "Parking_on.png" , 0, 0, 208, 778, new_park_brake)
function park_brake_switch(position)
sw_on = fif( position > 0 , 1, 0 )
switch_set_position(park_brake_sw, position)
end
xpl_dataref_subscribe("sim/cockpit2/controls/parking_brake_ratio","FLOAT",park_brake_switch)
fsx_variable_subscribe("BRAKE PARKING POSITION", "Position", park_brake_switch )
fs2020_variable_subscribe("BRAKE PARKING POSITION", "Position", park_brake_switch )
--end PARKING BRAKE
Here is the code and an export of the instrument. The code is only 18 lines long including blank lines and comments.
Sorry I do not know how to make the code box so just pasting it here
--PARKING BRAKE
function new_park_brake(position)
xpl_command("sim/flight_controls/brakes_toggle_max")
fsx_event("PARKING_BRAKES")
fs2020_event("PARKING_BRAKES")
end
park_brake_sw = switch_add("Parking_off.png", "Parking_on.png" , 0, 0, 208, 778, new_park_brake)
function park_brake_switch(position)
sw_on = fif( position > 0 , 1, 0 )
switch_set_position(park_brake_sw, position)
end
xpl_dataref_subscribe("sim/cockpit2/controls/parking_brake_ratio","FLOAT",park_brake_switch)
fsx_variable_subscribe("BRAKE PARKING POSITION", "Position", park_brake_switch )
fs2020_variable_subscribe("BRAKE PARKING POSITION", "Position", park_brake_switch )
--end PARKING BRAKE
Re: Does switch_add have a size limit
2 things to check.
Did you adjust the instrument size to compensate for the larger images. I suspect the parking brake you are basing this on is quite small. These can be adjusted by clicking the Info button along the top ribbon.
Are both the images the same size 208 width by 778 height. If one of them is say the other way round with 208 as the height and 778 as the width then that will not work. Post the images here if you are not sure.
Tony
Did you adjust the instrument size to compensate for the larger images. I suspect the parking brake you are basing this on is quite small. These can be adjusted by clicking the Info button along the top ribbon.
Are both the images the same size 208 width by 778 height. If one of them is say the other way round with 208 as the height and 778 as the width then that will not work. Post the images here if you are not sure.
Tony
Air Manager panels at https://www.experimentalsimavionics.com
Youtube Channel https://www.youtube.com/channel/UC8ZqXX ... kfZMq5BKig
Air Manager API Tutorial Video Series https://youtube.com/playlist?list=PLNr0 ... baT4gJKg5D
Youtube Channel https://www.youtube.com/channel/UC8ZqXX ... kfZMq5BKig
Air Manager API Tutorial Video Series https://youtube.com/playlist?list=PLNr0 ... baT4gJKg5D
Re: Does switch_add have a size limit
Thank you Tony that was it.
I did not know or forgot that was there as I have never changed an instrument that much.
Now to clean it up a bit
I did not know or forgot that was there as I have never changed an instrument that much.
Now to clean it up a bit