1
0
Fork 0

GPSmap196: a sketch of garmin196 using canvas

This commit is contained in:
Clément de l'Hamaide 2014-05-12 21:15:12 +02:00
parent 0dbba6b657
commit c08190919e
7 changed files with 15283 additions and 0 deletions

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,48 @@
print("Load Garmin GPSmap196 canvas");
var GPSmap196 = {
new: func {
m = { parents : [GPSmap196] };
m.node = props.globals.initNode("/instrumentation/gps196");
m.rockerUp = m.node.initNode("inputs/rocker-up", 0, "BOOL");
m.buttonIn = m.node.initNode("inputs/button-in", 0, "BOOL");
m.buttonDto = m.node.initNode("inputs/button-dto", 0, "BOOL");
m.buttonOut = m.node.initNode("inputs/button-out", 0, "BOOL");
m.buttonMenu = m.node.initNode("inputs/button-menu", 0, "BOOL");
m.buttonNrst = m.node.initNode("inputs/button-nrst", 0, "BOOL");
m.buttonPage = m.node.initNode("inputs/button-page", 0, "BOOL");
m.buttonQuit = m.node.initNode("inputs/button-quit", 0, "BOOL");
m.rockerDown = m.node.initNode("inputs/rocker-down", 0, "BOOL");
m.rockerLeft = m.node.initNode("inputs/rocker-left", 0, "BOOL");
m.buttonPower = m.node.initNode("inputs/button-power", 0, "BOOL");
m.rockerRight = m.node.initNode("inputs/rocker-right", 0, "BOOL");
m.buttonEnter = m.node.initNode("inputs/button-enter", 0, "BOOL");
return m;
},
update: func {
}
};
var myGPSmap196 = GPSmap196.new();
var myCanvas = canvas.new({
"name": "GPSmap196-screen", # The name is optional but allow for easier identification
"size": [512, 512], # Size of the underlying texture (should be a power of 2, required) [Resolution]
"view": [320, 240], # Virtual resolution (Defines the coordinate system of the canvas [Dimensions]
# which will be stretched the size of the texture, required)
"mipmapping": 1 # Enable mipmapping (optional)
});
myCanvas.addPlacement({"node": "gps196.screen"});
myCanvas.setColorBackground(0.6,0.64,0.545);
var group = myCanvas.createGroup();
var text = group.createChild("text", "optional-id-for element")
.setTranslation(10, 20) # The origin is in the top left corner
.setAlignment("left-center") # All values from osgText are supported (see $FG_ROOT/Docs/README.osgtext)
.setFont("LiberationFonts/LiberationSans-Regular.ttf") # Fonts are loaded either from $AIRCRAFT_DIR/Fonts or $FG_DATA/Fonts
.setFontSize(14) # Set fontsize and optionally character aspect ratio
.setColor(0,0,0) # Text color
.setText("This is a text element");
text.show();

Binary file not shown.

After

Width:  |  Height:  |  Size: 504 KiB

View file

@ -0,0 +1,117 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
version="1.1"
width="320"
height="240"
id="svg2">
<defs
id="defs4">
<linearGradient
id="linearGradient5417">
<stop
id="stop5425"
style="stop-color:#000000;stop-opacity:0.49803922"
offset="0" />
<stop
id="stop5421"
style="stop-color:#000000;stop-opacity:0"
offset="1" />
</linearGradient>
<linearGradient
id="linearGradient3975">
<stop
id="stop3977"
style="stop-color:#000000;stop-opacity:1"
offset="0" />
<stop
id="stop3979"
style="stop-color:#000000;stop-opacity:0"
offset="1" />
</linearGradient>
<filter
color-interpolation-filters="sRGB"
id="filter5629">
<feGaussianBlur
stdDeviation="1.5"
result="result6"
id="feGaussianBlur5631" />
<feComposite
in2="result6"
operator="atop"
in="SourceGraphic"
result="result8"
id="feComposite5633" />
<feComposite
in2="SourceAlpha"
operator="atop"
in="result8"
result="result9"
id="feComposite5635" />
</filter>
</defs>
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
transform="translate(0,-812.36218)"
id="layer1">
<path
d="m 6.2464404,876.96816 0,-58.41947 154.1464196,0 154.14639,0 0,58.41947 0,58.41946 -154.14639,0 -154.1464196,0 0,-58.41946 z"
id="field.warning"
style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:1;marker-mid:none" />
<path
d="m 6.0574757,1009.8253 0,-37.97967 154.1464143,0 154.14639,0 0,37.97967 0,37.9797 -154.14639,0 -154.1464143,0 0,-37.9797 z"
id="field.version"
style="fill:#ffffff;fill-opacity:1;stroke:none" />
<rect
width="308.29059"
height="0.86251581"
ry="0"
x="6.2485213"
y="818.54578"
id="rect5639"
style="fill:#666666;fill-opacity:1;stroke:none" />
<rect
width="115.98947"
height="0.86251581"
ry="0"
x="819.40631"
y="-7.1117039"
transform="matrix(0,1,-1,0,0,0)"
id="rect5639-6"
style="fill:#666666;fill-opacity:1;stroke:none" />
<rect
width="308.29059"
height="0.86251581"
ry="0"
x="6.0571151"
y="971.84656"
id="rect5669"
style="fill:#666666;fill-opacity:1;stroke:none" />
<rect
width="75.100388"
height="0.86251581"
ry="0"
x="972.70709"
y="-6.9202976"
transform="matrix(0,1,-1,0,0,0)"
id="rect5671"
style="fill:#666666;fill-opacity:1;stroke:none" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.2 KiB

View file

@ -0,0 +1,303 @@
<?xml version="1.0" encoding="UTF-8"?>
<PropertyList>
<path>gpsmap196.ac</path>
<animation>
<object-name>gps196.body</object-name>
<object-name>gps196.screen</object-name>
<object-name>gps196.antenna</object-name>
<object-name>gps196.rocker.up</object-name>
<object-name>gps196.button.in</object-name>
<object-name>gps196.button.dto</object-name>
<object-name>gps196.button.out</object-name>
<object-name>gps196.button.menu</object-name>
<object-name>gps196.button.nrst</object-name>
<object-name>gps196.button.page</object-name>
<object-name>gps196.button.quit</object-name>
<object-name>gps196.rocker.down</object-name>
<object-name>gps196.rocker.left</object-name>
<object-name>gps196.button.power</object-name>
<object-name>gps196.rocker.right</object-name>
<object-name>gps196.button.enter</object-name>
</animation>
<animation>
<type>pick</type>
<object-name>gps196.button.dto</object-name>
<action>
<button>0</button>
<binding>
<command>property-assign</command>
<property>instrumentation/gps196/inputs/button-dto</property>
<value type="bool">true</value>
</binding>
<mod-up>
<binding>
<command>property-assign</command>
<property>instrumentation/gps196/inputs/button-dto</property>
<value type="bool">false</value>
</binding>
</mod-up>
</action>
</animation>
<animation>
<type>pick</type>
<object-name>gps196.button.enter</object-name>
<action>
<button>0</button>
<binding>
<command>property-assign</command>
<property>instrumentation/gps196/inputs/button-enter</property>
<value type="bool">true</value>
</binding>
<mod-up>
<binding>
<command>property-assign</command>
<property>instrumentation/gps196/inputs/button-enter</property>
<value type="bool">false</value>
</binding>
</mod-up>
</action>
</animation>
<animation>
<type>pick</type>
<object-name>gps196.button.in</object-name>
<action>
<button>0</button>
<binding>
<command>property-assign</command>
<property>instrumentation/gps196/inputs/button-in</property>
<value type="bool">true</value>
</binding>
<mod-up>
<binding>
<command>property-assign</command>
<property>instrumentation/gps196/inputs/button-in</property>
<value type="bool">false</value>
</binding>
</mod-up>
</action>
</animation>
<animation>
<type>pick</type>
<object-name>gps196.button.menu</object-name>
<action>
<button>0</button>
<binding>
<command>property-assign</command>
<property>instrumentation/gps196/inputs/button-menu</property>
<value type="bool">true</value>
</binding>
<mod-up>
<binding>
<command>property-assign</command>
<property>instrumentation/gps196/inputs/button-menu</property>
<value type="bool">false</value>
</binding>
</mod-up>
</action>
</animation>
<animation>
<type>pick</type>
<object-name>gps196.button.nrst</object-name>
<action>
<button>0</button>
<binding>
<command>property-assign</command>
<property>instrumentation/gps196/inputs/button-nrst</property>
<value type="bool">true</value>
</binding>
<mod-up>
<binding>
<command>property-assign</command>
<property>instrumentation/gps196/inputs/button-nrst</property>
<value type="bool">false</value>
</binding>
</mod-up>
</action>
</animation>
<animation>
<type>pick</type>
<object-name>gps196.button.out</object-name>
<action>
<button>0</button>
<binding>
<command>property-assign</command>
<property>instrumentation/gps196/inputs/button-out</property>
<value type="bool">true</value>
</binding>
<mod-up>
<binding>
<command>property-assign</command>
<property>instrumentation/gps196/inputs/button-out</property>
<value type="bool">false</value>
</binding>
</mod-up>
</action>
</animation>
<animation>
<type>pick</type>
<object-name>gps196.button.page</object-name>
<action>
<button>0</button>
<binding>
<command>property-assign</command>
<property>instrumentation/gps196/inputs/button-page</property>
<value type="bool">true</value>
</binding>
<mod-up>
<binding>
<command>property-assign</command>
<property>instrumentation/gps196/inputs/button-page</property>
<value type="bool">false</value>
</binding>
</mod-up>
</action>
</animation>
<animation>
<type>pick</type>
<object-name>gps196.button.power</object-name>
<action>
<button>0</button>
<binding>
<command>property-assign</command>
<property>instrumentation/gps196/inputs/button-power</property>
<value type="bool">true</value>
</binding>
<mod-up>
<binding>
<command>property-assign</command>
<property>instrumentation/gps196/inputs/button-power</property>
<value type="bool">false</value>
</binding>
</mod-up>
</action>
</animation>
<animation>
<type>pick</type>
<object-name>gps196.button.quit</object-name>
<action>
<button>0</button>
<binding>
<command>property-assign</command>
<property>instrumentation/gps196/inputs/button-quit</property>
<value type="bool">true</value>
</binding>
<mod-up>
<binding>
<command>property-assign</command>
<property>instrumentation/gps196/inputs/button-quit</property>
<value type="bool">false</value>
</binding>
</mod-up>
</action>
</animation>
<animation>
<type>pick</type>
<object-name>gps196.rocker.down</object-name>
<action>
<button>0</button>
<binding>
<command>property-assign</command>
<property>instrumentation/gps196/inputs/rocker-down</property>
<value type="bool">true</value>
</binding>
<mod-up>
<binding>
<command>property-assign</command>
<property>instrumentation/gps196/inputs/rocker-down</property>
<value type="bool">false</value>
</binding>
</mod-up>
</action>
</animation>
<animation>
<type>pick</type>
<object-name>gps196.rocker.left</object-name>
<action>
<button>0</button>
<binding>
<command>property-assign</command>
<property>instrumentation/gps196/inputs/rocker-left</property>
<value type="bool">true</value>
</binding>
<mod-up>
<binding>
<command>property-assign</command>
<property>instrumentation/gps196/inputs/rocker-left</property>
<value type="bool">false</value>
</binding>
</mod-up>
</action>
</animation>
<animation>
<type>pick</type>
<object-name>gps196.rocker.right</object-name>
<action>
<button>0</button>
<binding>
<command>property-assign</command>
<property>instrumentation/gps196/inputs/rocker-right</property>
<value type="bool">true</value>
</binding>
<mod-up>
<binding>
<command>property-assign</command>
<property>instrumentation/gps196/inputs/rocker-right</property>
<value type="bool">false</value>
</binding>
</mod-up>
</action>
</animation>
<animation>
<type>pick</type>
<object-name>gps196.rocker.up</object-name>
<action>
<button>0</button>
<binding>
<command>property-assign</command>
<property>instrumentation/gps196/inputs/rocker-up</property>
<value type="bool">true</value>
</binding>
<mod-up>
<binding>
<command>property-assign</command>
<property>instrumentation/gps196/inputs/rocker-up</property>
<value type="bool">false</value>
</binding>
</mod-up>
</action>
</animation>
<animation>
<type>pick</type>
<object-name>gps196.screen</object-name>
<action>
<button>0</button>
<binding>
<command>nasal</command>
<script>
<![CDATA[
var dlg = canvas.Window.new([320, 240], "dialog").set("resize", 1).set("title", "Garmin GPSmap196");
dlg.setCanvas(canvas.get({name: "GPSmap196-screen"}));
]]>
</script>
</binding>
</action>
</animation>
</PropertyList>

Binary file not shown.

After

Width:  |  Height:  |  Size: 180 KiB

File diff suppressed because it is too large Load diff

After

Width:  |  Height:  |  Size: 253 KiB