Instrument upgrade 2 to 3

From Sim Innovations Wiki
Revision as of 20:46, 29 May 2017 by Admin (talk | contribs)
Jump to navigation Jump to search

This page explains things to note when you upgrade an existing instrument made in Air Manager 2.1.3 to Air Manager 3.0.

Text

The biggest difference between AM 2.1.3 and AM 3.0 is the way text is rendered. This means that you have to check all text objects you use in your instrument, and make sure that you reposition them correctly.

In AM 2.1.3, a text object might be initialized using this code:

txt_load_font("digital-7-mono.ttf")
txt_id = txt_add("hello world", "-fx-font-family:"Digital 7"; -fx-font-size:11px; -fx-fill:black; -fx-font-weight:bold; -fx-text-alignment:right;", 0, 0, 800, 200)

In AM 3.0 it would become:

txt_id = txt_add("hello world", "font:digital-7-mono-bold.ttf; size:11; color:black; halign:right;", 0, 0, 800, 200)

There are 4 text style properties you can use in AM 3.0:

Argument Type Description
font String The TTF font file name (searched in the resource folder of the instrument)
size Number The font size (in px)
color String The color, can be color string like "red", "blue", "cyan", etc. etc. Can also be a hex value, "#FFFFFF"
halign String The horizontal alignment of the text within the text box. Can be "left", "center" or "right".

Dials

There is a bug in AM 2.1.3 where dials are drawn with a horizontal and vertical offset of 1 pixel. Make sure to check the x values of any dials in your instrument

In AM 2.1.3, a dial might be initialized using this code:

dial_id = dial_add("dial.png", 100, 100, 200, 200)

In AM 3.0 it would become:

dial_id = dial_add("dial.png", 99, 99, 200, 200)