Touch animation: Difference between revisions

From FlightGear wiki
Jump to navigation Jump to search
(Created page with "{{Stub}} Designed for 2d objects, such as a canvas placements, this permits the receipt of touch (mouse click) events to enable the simulation of avionics with a touchscreen....")
 
(+related: Howto:Animate models; +cat: Aircraft enhancement, Modeling; etc)
 
(7 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Stub}}
{{Stub}}
Richard implemented a <code>SGTouchAnimation</code> using arguments (no Emesary) and it works great. <ref>{{cite web
  |url    =  https://sourceforge.net/p/flightgear/mailman/message/36094580/
  |title  =  <nowiki> Re: [Flightgear-devel] Coordinates from pick </nowiki>
  |author =  <nowiki> Richard Harrison </nowiki>
  |date  =  Oct 28th, 2017
  |added  =  Oct 28th, 2017
  |script_version = 0.40
  }}</ref>


Designed for 2d objects, such as a canvas placements, this permits the receipt of touch (mouse click) events to enable the simulation of avionics with a touchscreen.
Designed for 2d objects, such as a canvas placements, this permits the receipt of touch (mouse click) events to enable the simulation of avionics with a touchscreen.


The coordinates are passed in as arguments to the action; these can be accessed with Nasal via the cmdarg() method.
The coordinates are passed in as arguments to the action; these can be accessed with Nasal via the <code>cmdarg()</code> method <ref>https://sourceforge.net/p/flightgear/simgear/ci/2a60e5e338528f9431c0c27e59610a7a54f4432e/</ref>.


example:
Example:


<syntaxhighlight lang="xml">
<syntaxhighlight lang="xml">
Line 17: Line 27:
<binding>
<binding>
<command>nasal</command>
<command>nasal</command>
<script>print("touch input
<script><![CDATA[
(",cmdarg().getNode("x").getValue(),",",cmdarg().getNode("y").getValue())</script>
var values = cmdarg().getValues();
print("touch input:");
foreach(var field; keys(values)) {
debug.dump( field, "=>", values[field] );
}
]]></script>
</binding>
</binding>
</action>
</action>
Line 25: Line 40:




== Related ==
== References ==
{{Appendix}}
{{Appendix}}
== Related content ==
* [[Howto:Animate models]]
[[Category:Aircraft enhancement]]
[[Category:Modeling]]

Latest revision as of 13:01, 11 October 2020

This article is a stub. You can help the wiki by expanding it.

Richard implemented a SGTouchAnimation using arguments (no Emesary) and it works great. [1]


Designed for 2d objects, such as a canvas placements, this permits the receipt of touch (mouse click) events to enable the simulation of avionics with a touchscreen.

The coordinates are passed in as arguments to the action; these can be accessed with Nasal via the cmdarg() method [2].

Example:

<animation>
<type>touch</type>
<visible>true</visible>
<object-name>VSDImage</object-name>
<action>
<touch>0</touch>
<repeatable>false</repeatable>
<binding>
<command>nasal</command>
<script><![CDATA[
var values = cmdarg().getValues();
print("touch input:");
foreach(var field; keys(values)) { 
 debug.dump( field, "=>", values[field] );
}
]]></script>
</binding>
</action>
</animation>


References

References

Related content