Sophie

Sophie

distrib > Mageia > 7 > armv7hl > media > core-updates > by-pkgid > 6ed78e842caa17fd5c94d65d685685e0 > files > 164

qtscxml5-doc-5.12.6-1.mga7.noarch.rpm

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <title>pinball.scxml Example File | Qt SCXML 5.12.6</title>
  <link rel="stylesheet" type="text/css" href="style/offline-simple.css" />
  <script type="text/javascript">
    document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css");
    // loading style sheet breaks anchors that were jumped to before
    // so force jumping to anchor again
    setTimeout(function() {
        var anchor = location.hash;
        // need to jump to different anchor first (e.g. none)
        location.hash = "#";
        setTimeout(function() {
            location.hash = anchor;
        }, 0);
    }, 0);
  </script>
</head>
<body>
<div class="header" id="qtdocheader">
  <div class="main">
    <div class="main-rounded">
      <div class="navigationbar">
        <table><tr>
<td >Qt 5.12</td><td ><a href="qtscxml-index.html">Qt SCXML</a></td><td ><a href="qtscxml-pinball-example.html">Qt SCXML Pinball Example</a></td><td >pinball.scxml Example File</td></tr></table><table class="buildversion"><tr>
<td id="buildversion" width="100%" align="right"><a href="qtscxml-index.html">Qt 5.12.6 Reference Documentation</a></td>
        </tr></table>
      </div>
    </div>
<div class="content">
<div class="line">
<div class="content mainContent">
<div class="sidebar"><div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title">pinball.scxml Example File</h1>
<span class="subtitle">pinball/pinball.scxml</span>
<!-- $$$pinball/pinball.scxml-description -->
<div class="descr"> <a name="details"></a>
<pre class="cpp">

  &lt;?xml version=&quot;1.0&quot; ?&gt;
  &lt;!--
  /****************************************************************************
  **
  ** Copyright (C) 2016 The Qt Company Ltd.
  ** Contact: https://www.qt.io/licensing/
  **
  ** This file is part of the QtScxml module of the Qt Toolkit.
  **
  ** $QT_BEGIN_LICENSE:BSD$
  ** Commercial License Usage
  ** Licensees holding valid commercial Qt licenses may use this file in
  ** accordance with the commercial license agreement provided with the
  ** Software or, alternatively, in accordance with the terms contained in
  ** a written agreement between you and The Qt Company. For licensing terms
  ** and conditions see https://www.qt.io/terms-conditions. For further
  ** information use the contact form at https://www.qt.io/contact-us.
  **
  ** BSD License Usage
  ** Alternatively, you may use this file under the terms of the BSD license
  ** as follows:
  **
  ** &quot;Redistribution and use in source and binary forms, with or without
  ** modification, are permitted provided that the following conditions are
  ** met:
  **   * Redistributions of source code must retain the above copyright
  **     notice, this list of conditions and the following disclaimer.
  **   * Redistributions in binary form must reproduce the above copyright
  **     notice, this list of conditions and the following disclaimer in
  **     the documentation and/or other materials provided with the
  **     distribution.
  **   * Neither the name of The Qt Company Ltd nor the names of its
  **     contributors may be used to endorse or promote products derived
  **     from this software without specific prior written permission.
  **
  **
  ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  ** &quot;AS IS&quot; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.&quot;
  **
  ** $QT_END_LICENSE$
  **
  ****************************************************************************/
  --&gt;
  &lt;scxml xmlns=&quot;http://www.w3.org/2005/07/scxml&quot; version=&quot;1.0&quot;
         name=&quot;Pinball&quot; datamodel=&quot;ecmascript&quot;&gt;
      &lt;datamodel&gt;
          &lt;data id=&quot;highScore&quot; expr=&quot;0&quot;/&gt;
          &lt;data id=&quot;score&quot; expr=&quot;0&quot;/&gt;
      &lt;/datamodel&gt;
      &lt;parallel id=&quot;global&quot;&gt;
          &lt;parallel id=&quot;guiControl&quot;&gt;
              &lt;state id=&quot;cLight&quot;&gt;
                  &lt;state id=&quot;cLightOn&quot;&gt;
                      &lt;transition event=&quot;turnOffC&quot; target=&quot;cLightOff&quot;/&gt;
                  &lt;/state&gt;
                  &lt;state id=&quot;cLightOff&quot;&gt;
                      &lt;transition event=&quot;turnOnC&quot; target=&quot;cLightOn&quot;/&gt;
                  &lt;/state&gt;
              &lt;/state&gt;
              &lt;state id=&quot;rLight&quot;&gt;
                  &lt;state id=&quot;rLightOn&quot;&gt;
                      &lt;transition event=&quot;turnOffR&quot; target=&quot;rLightOff&quot;/&gt;
                  &lt;/state&gt;
                  &lt;state id=&quot;rLightOff&quot;&gt;
                      &lt;transition event=&quot;turnOnR&quot; target=&quot;rLightOn&quot;/&gt;
                  &lt;/state&gt;
              &lt;/state&gt;
              &lt;state id=&quot;aLight&quot;&gt;
                  &lt;state id=&quot;aLightOn&quot;&gt;
                      &lt;transition event=&quot;turnOffA&quot; target=&quot;aLightOff&quot;/&gt;
                  &lt;/state&gt;
                  &lt;state id=&quot;aLightOff&quot;&gt;
                      &lt;transition event=&quot;turnOnA&quot; target=&quot;aLightOn&quot;/&gt;
                  &lt;/state&gt;
              &lt;/state&gt;
              &lt;state id=&quot;zLight&quot;&gt;
                  &lt;state id=&quot;zLightOn&quot;&gt;
                      &lt;transition event=&quot;turnOffZ&quot; target=&quot;zLightOff&quot;/&gt;
                  &lt;/state&gt;
                  &lt;state id=&quot;zLightOff&quot;&gt;
                      &lt;transition event=&quot;turnOnZ&quot; target=&quot;zLightOn&quot;/&gt;
                  &lt;/state&gt;
              &lt;/state&gt;
              &lt;state id=&quot;yLight&quot;&gt;
                  &lt;state id=&quot;yLightOn&quot;&gt;
                      &lt;transition event=&quot;turnOffY&quot; target=&quot;yLightOff&quot;/&gt;
                  &lt;/state&gt;
                  &lt;state id=&quot;yLightOff&quot;&gt;
                      &lt;transition event=&quot;turnOnY&quot; target=&quot;yLightOn&quot;/&gt;
                  &lt;/state&gt;
              &lt;/state&gt;
              &lt;state id=&quot;hurryLight&quot;&gt;
                  &lt;state id=&quot;hurryLightOn&quot;&gt;
                      &lt;transition event=&quot;turnOffHurry&quot; target=&quot;hurryLightOff&quot;/&gt;
                  &lt;/state&gt;
                  &lt;state id=&quot;hurryLightOff&quot;&gt;
                      &lt;transition event=&quot;turnOnHurry&quot; target=&quot;hurryLightOn&quot;/&gt;
                  &lt;/state&gt;
              &lt;/state&gt;
              &lt;state id=&quot;jackpotLight&quot;&gt;
                  &lt;state id=&quot;jackpotLightOn&quot;&gt;
                      &lt;transition event=&quot;turnOffJackpot&quot; target=&quot;jackpotLightOff&quot;/&gt;
                  &lt;/state&gt;
                  &lt;state id=&quot;jackpotLightOff&quot;&gt;
                      &lt;transition event=&quot;turnOnJackpot&quot; target=&quot;jackpotLightOn&quot;/&gt;
                  &lt;/state&gt;
              &lt;/state&gt;
              &lt;state id=&quot;gameOverLight&quot;&gt;
                  &lt;state id=&quot;gameOverLightOn&quot;&gt;
                      &lt;transition event=&quot;turnOffGameOver&quot; target=&quot;gameOverLightOff&quot;/&gt;
                  &lt;/state&gt;
                  &lt;state id=&quot;gameOverLightOff&quot;&gt;
                      &lt;transition event=&quot;turnOnGameOver&quot; target=&quot;gameOverLightOn&quot;/&gt;
                  &lt;/state&gt;
              &lt;/state&gt;
          &lt;/parallel&gt;

          &lt;parallel id=&quot;internalState&quot;&gt;
              &lt;parallel id=&quot;logicalState&quot;&gt;
                  &lt;state id=&quot;letterState&quot;&gt;
                      &lt;parallel id=&quot;lettersState&quot;&gt;
                          &lt;state id=&quot;letter.C&quot;&gt;
                              &lt;state id=&quot;cLetterOff&quot;&gt;
                                  &lt;transition event=&quot;cLetterTriggered&quot; cond=&quot;In('onState')&quot; target=&quot;cLetterOn&quot;/&gt;
                              &lt;/state&gt;
                              &lt;final id=&quot;cLetterOn&quot;/&gt;
                          &lt;/state&gt;
                          &lt;state id=&quot;letter.R&quot;&gt;
                              &lt;state id=&quot;rLetterOff&quot;&gt;
                                  &lt;transition event=&quot;rLetterTriggered&quot; cond=&quot;In('onState')&quot; target=&quot;rLetterOn&quot;/&gt;
                              &lt;/state&gt;
                              &lt;final id=&quot;rLetterOn&quot;/&gt;
                          &lt;/state&gt;
                          &lt;state id=&quot;letter.A&quot;&gt;
                              &lt;state id=&quot;aLetterOff&quot;&gt;
                                  &lt;transition event=&quot;aLetterTriggered&quot; cond=&quot;In('onState')&quot; target=&quot;aLetterOn&quot;/&gt;
                              &lt;/state&gt;
                              &lt;final id=&quot;aLetterOn&quot;/&gt;
                          &lt;/state&gt;
                          &lt;state id=&quot;letter.Z&quot;&gt;
                              &lt;state id=&quot;zLetterOff&quot;&gt;
                                  &lt;transition event=&quot;zLetterTriggered&quot; cond=&quot;In('onState')&quot; target=&quot;zLetterOn&quot;/&gt;
                              &lt;/state&gt;
                              &lt;final id=&quot;zLetterOn&quot;/&gt;
                          &lt;/state&gt;
                          &lt;state id=&quot;letter.Y&quot;&gt;
                              &lt;state id=&quot;yLetterOff&quot;&gt;
                                  &lt;transition event=&quot;yLetterTriggered&quot; cond=&quot;In('onState')&quot; target=&quot;yLetterOn&quot;/&gt;
                              &lt;/state&gt;
                              &lt;final id=&quot;yLetterOn&quot;/&gt;
                          &lt;/state&gt;
                          &lt;transition event=&quot;resetLetters&quot; target=&quot;lettersState&quot;/&gt;
                      &lt;/parallel&gt;
                  &lt;/state&gt;
                  &lt;state id=&quot;modeState&quot;&gt;
                      &lt;state id=&quot;offState&quot;&gt;
                          &lt;onentry&gt;
                              &lt;if cond=&quot;highScore &amp;lt; score&quot;&gt;
                                  &lt;assign location=&quot;highScore&quot; expr=&quot;score&quot;/&gt;
                              &lt;/if&gt;
                              &lt;raise event=&quot;resetLetters&quot;/&gt;
                              &lt;raise event=&quot;update&quot;/&gt;
                          &lt;/onentry&gt;
                          &lt;transition event=&quot;startTriggered&quot; target=&quot;onState&quot;/&gt;
                      &lt;/state&gt;
                      &lt;parallel id=&quot;onState&quot;&gt;
                          &lt;onentry&gt;
                              &lt;assign location=&quot;score&quot; expr=&quot;0&quot;/&gt;
                          &lt;/onentry&gt;
                          &lt;state id=&quot;hurryState&quot;&gt;
                              &lt;state id=&quot;hurryStateOff&quot;&gt;
                                  &lt;onentry&gt;
                                      &lt;raise event=&quot;resetLetters&quot;/&gt;
                                      &lt;raise event=&quot;update&quot;/&gt;
                                  &lt;/onentry&gt;
                                  &lt;transition event=&quot;goToHurryOn&quot; target=&quot;hurryStateOn&quot;/&gt;
                              &lt;/state&gt;
                              &lt;state id=&quot;hurryStateOn&quot;&gt;
                                  &lt;onentry&gt;
                                      &lt;send event=&quot;goToHurryOff&quot; id=&quot;hurryId&quot; delay=&quot;5s&quot;/&gt;
                                      &lt;raise event=&quot;resetLetters&quot;/&gt;
                                      &lt;raise event=&quot;update&quot;/&gt;
                                  &lt;/onentry&gt;
                                  &lt;transition event=&quot;goToHurryOff&quot; target=&quot;hurryStateOff&quot;/&gt;
                                  &lt;onexit&gt;
                                      &lt;cancel sendid=&quot;hurryId&quot;/&gt;
                                  &lt;/onexit&gt;
                              &lt;/state&gt;
                          &lt;/state&gt;
                          &lt;state id=&quot;jackpotState&quot;&gt;
                              &lt;state id=&quot;jackpotStateOff&quot;&gt;
                                  &lt;onentry&gt;
                                      &lt;raise event=&quot;update&quot;/&gt;
                                  &lt;/onentry&gt;
                                  &lt;transition event=&quot;goForJackpot&quot; target=&quot;jackpotStateOn&quot;/&gt;
                              &lt;/state&gt;
                              &lt;state id=&quot;jackpotStateOn&quot;&gt;
                                  &lt;onentry&gt;
                                      &lt;raise event=&quot;update&quot;/&gt;
                                  &lt;/onentry&gt;
                              &lt;/state&gt;
                          &lt;/state&gt;
                          &lt;transition event=&quot;ballOutTriggered&quot; target=&quot;offState&quot;/&gt;
                      &lt;/parallel&gt;
                  &lt;/state&gt;
              &lt;/parallel&gt;

              &lt;state id=&quot;workflow&quot;&gt;
                  &lt;state id=&quot;lightImpulseGenerator&quot;&gt;
                      &lt;state id=&quot;lightImpulseOn&quot;/&gt;
                      &lt;state id=&quot;lightImpulseOff&quot;/&gt;

                      &lt;onentry&gt;
                          &lt;raise event=&quot;update&quot;/&gt;
                      &lt;/onentry&gt;

                      &lt;transition event=&quot;scheduleNewImpulse&quot;&gt;
                          &lt;cancel sendid=&quot;lightId&quot;/&gt;
                          &lt;if cond=&quot;In('offState')&quot;&gt;
                              &lt;send event=&quot;lightImpulse&quot; id=&quot;lightId&quot; delay=&quot;1s&quot;/&gt;
                          &lt;elseif cond=&quot;In('hurryStateOff')&quot;/&gt;
                              &lt;send event=&quot;lightImpulse&quot; id=&quot;lightId&quot; delay=&quot;500ms&quot;/&gt;
                          &lt;else/&gt;
                              &lt;send event=&quot;lightImpulse&quot; id=&quot;lightId&quot; delay=&quot;200ms&quot;/&gt;
                          &lt;/if&gt;
                      &lt;/transition&gt;

                      &lt;transition event=&quot;update&quot;&gt;
                          &lt;raise event=&quot;scheduleNewImpulse&quot;/&gt;
                          &lt;raise event=&quot;updateLights&quot;/&gt;
                      &lt;/transition&gt;

                      &lt;transition event=&quot;lightImpulse&quot; cond=&quot;In('lightImpulseOn')&quot; target=&quot;lightImpulseOff&quot;/&gt;
                      &lt;transition event=&quot;lightImpulse&quot; cond=&quot;In('lightImpulseOff')&quot; target=&quot;lightImpulseOn&quot;/&gt;
                  &lt;/state&gt;

                  &lt;transition event=&quot;done.state.letter.*&quot;&gt;
                      &lt;if cond=&quot;In('hurryStateOff')&quot;&gt;
                          &lt;assign location=&quot;score&quot; expr=&quot;score + 1000&quot;/&gt;
                      &lt;elseif cond=&quot;In('hurryStateOn')&quot;/&gt;
                          &lt;assign location=&quot;score&quot; expr=&quot;score + 10000&quot;/&gt;
                      &lt;/if&gt;
                      &lt;raise event=&quot;updateLights&quot;/&gt;
                  &lt;/transition&gt;

                  &lt;transition event=&quot;done.state.lettersState&quot;&gt;
                      &lt;if cond=&quot;In('hurryStateOff')&quot;&gt;
                          &lt;assign location=&quot;score&quot; expr=&quot;score + 100000&quot;/&gt;
                          &lt;raise event=&quot;goToHurryOn&quot;/&gt;
                      &lt;elseif cond=&quot;In('hurryStateOn')&quot;/&gt;
                          &lt;assign location=&quot;score&quot; expr=&quot;score + 1000000&quot;/&gt;
                          &lt;raise event=&quot;goToHurryOff&quot;/&gt;
                          &lt;raise event=&quot;goForJackpot&quot;/&gt;
                      &lt;/if&gt;
                  &lt;/transition&gt;

                  &lt;transition event=&quot;updateLights&quot;&gt;
                      &lt;send event=&quot;updateScore&quot;&gt;
                          &lt;param name=&quot;highScore&quot; expr=&quot;highScore&quot;/&gt;
                          &lt;param name=&quot;score&quot; expr=&quot;score&quot;/&gt;
                      &lt;/send&gt;
                      &lt;if cond=&quot;In('jackpotStateOn')&quot;&gt;
                          &lt;raise event=&quot;turnOnJackpot&quot;/&gt;
                      &lt;else/&gt;
                          &lt;raise event=&quot;turnOffJackpot&quot;/&gt;
                      &lt;/if&gt;

                      &lt;if cond=&quot;In('lightImpulseOn')&quot;&gt;
                          &lt;if cond=&quot;In('offState')&quot;&gt;
                              &lt;raise event=&quot;turnOnLights&quot;/&gt;
                              &lt;raise event=&quot;turnOnHurry&quot;/&gt;
                              &lt;raise event=&quot;turnOnJackpot&quot;/&gt;
                              &lt;raise event=&quot;turnOnGameOver&quot;/&gt;
                          &lt;elseif cond=&quot;In('hurryStateOff')&quot;/&gt;
                              &lt;raise event=&quot;updateLightsAccordingToLettersState&quot;/&gt;
                              &lt;raise event=&quot;turnOffHurry&quot;/&gt;
                              &lt;raise event=&quot;turnOffGameOver&quot;/&gt;
                          &lt;else/&gt;
                              &lt;raise event=&quot;turnOnLights&quot;/&gt;
                              &lt;raise event=&quot;turnOnHurry&quot;/&gt;
                              &lt;raise event=&quot;turnOffGameOver&quot;/&gt;
                          &lt;/if&gt;
                      &lt;else/&gt;
                          &lt;if cond=&quot;In('offState')&quot;&gt;
                              &lt;raise event=&quot;turnOffLights&quot;/&gt;
                              &lt;raise event=&quot;turnOffHurry&quot;/&gt;
                              &lt;raise event=&quot;turnOffJackpot&quot;/&gt;
                          &lt;elseif cond=&quot;In('hurryStateOff')&quot;/&gt;
                              &lt;raise event=&quot;turnOffLights&quot;/&gt;
                          &lt;else/&gt;
                              &lt;raise event=&quot;updateLightsAccordingToLettersState&quot;/&gt;
                          &lt;/if&gt;
                          &lt;raise event=&quot;turnOffHurry&quot;/&gt;
                          &lt;raise event=&quot;turnOffGameOver&quot;/&gt;
                      &lt;/if&gt;
                  &lt;/transition&gt;

                  &lt;transition event=&quot;updateLightsAccordingToLettersState&quot;&gt;
                      &lt;if cond=&quot;In('cLetterOn')&quot;&gt;
                          &lt;raise event=&quot;turnOnC&quot;/&gt;
                      &lt;else/&gt;
                          &lt;raise event=&quot;turnOffC&quot;/&gt;
                      &lt;/if&gt;
                      &lt;if cond=&quot;In('rLetterOn')&quot;&gt;
                          &lt;raise event=&quot;turnOnR&quot;/&gt;
                      &lt;else/&gt;
                          &lt;raise event=&quot;turnOffR&quot;/&gt;
                      &lt;/if&gt;
                      &lt;if cond=&quot;In('aLetterOn')&quot;&gt;
                          &lt;raise event=&quot;turnOnA&quot;/&gt;
                      &lt;else/&gt;
                          &lt;raise event=&quot;turnOffA&quot;/&gt;
                      &lt;/if&gt;
                      &lt;if cond=&quot;In('zLetterOn')&quot;&gt;
                          &lt;raise event=&quot;turnOnZ&quot;/&gt;
                      &lt;else/&gt;
                          &lt;raise event=&quot;turnOffZ&quot;/&gt;
                      &lt;/if&gt;
                      &lt;if cond=&quot;In('yLetterOn')&quot;&gt;
                          &lt;raise event=&quot;turnOnY&quot;/&gt;
                      &lt;else/&gt;
                          &lt;raise event=&quot;turnOffY&quot;/&gt;
                      &lt;/if&gt;
                  &lt;/transition&gt;

                  &lt;transition event=&quot;turnOnLights&quot;&gt;
                      &lt;raise event=&quot;turnOnC&quot;/&gt;
                      &lt;raise event=&quot;turnOnR&quot;/&gt;
                      &lt;raise event=&quot;turnOnA&quot;/&gt;
                      &lt;raise event=&quot;turnOnZ&quot;/&gt;
                      &lt;raise event=&quot;turnOnY&quot;/&gt;
                  &lt;/transition&gt;

                  &lt;transition event=&quot;turnOffLights&quot;&gt;
                      &lt;raise event=&quot;turnOffC&quot;/&gt;
                      &lt;raise event=&quot;turnOffR&quot;/&gt;
                      &lt;raise event=&quot;turnOffA&quot;/&gt;
                      &lt;raise event=&quot;turnOffZ&quot;/&gt;
                      &lt;raise event=&quot;turnOffY&quot;/&gt;
                  &lt;/transition&gt;
              &lt;/state&gt;
          &lt;/parallel&gt;
      &lt;/parallel&gt;
  &lt;/scxml&gt;

</pre>
</div>
<!-- @@@pinball/pinball.scxml -->
        </div>
       </div>
   </div>
   </div>
</div>
<div class="footer">
   <p>
   <acronym title="Copyright">&copy;</acronym> 2019 The Qt Company Ltd.
   Documentation contributions included herein are the copyrights of
   their respective owners.<br/>    The documentation provided herein is licensed under the terms of the    <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation    License version 1.3</a> as published by the Free Software Foundation.<br/>    Qt and respective logos are trademarks of The Qt Company Ltd.     in Finland and/or other countries worldwide. All other trademarks are property
   of their respective owners. </p>
</div>
</body>
</html>