Sophie

Sophie

distrib > Fedora > 15 > i386 > by-pkgid > 0e77bba279395d1c9e1f98c452d3b010 > files > 56

edje-devel-1.0.0-2.fc15.i686.rpm

<html>
<head>
    <title>Edje: embryo_custom_state.edc</title>
    <meta http-equiv="content-type" content="text/html;charset=UTF-8">
    <meta name="author" content="Andres Blanc" >
    
    <link rel="icon" href="img/favicon.png" type="image/x-icon">
    <link rel="shortcut icon" href="img/favicon.png" type="image/x-icon">
    <link rel="icon" href="img/favicon.png" type="image/ico">
    <link rel="shortcut icon" href="img/favicon.png" type="image/ico">

    <link rel="stylesheet" type="text/css" href="e.css">
    <link rel="stylesheet" type="text/css" href="edoxy.css">
</head>

<body>

<div id="container">

<div id="header">
<div class="layout">
    
    <h1><span>Enlightenment</span></h1>
    <h2><span>Beauty at your fingertips</span></h2>

    <table cellspacing="0" cellpadding="0" width="100%"><tr>
      <td id="header_logo">
        <a href="http://www.enlightenment.org"></a>
      </td>
      <td id="header_menu">
        <table cellspacing="0" cellpadding="0" align="right"><tr>
          <td class="nav_passive"><a class="nav_passive" href="http://www.enlightenment.org/p.php?p=home">Home</a></td> 
          <td class="nav_passive"><a class="nav_passive" href="http://www.enlightenment.org/p.php?p=news">News</a></td> 
          <td class="nav_passive"><a class="nav_passive" href="http://www.enlightenment.org/p.php?p=about">About</a></td> 
          <td class="nav_passive"><a class="nav_passive" href="http://www.enlightenment.org/p.php?p=download">Download</a></td> 
          <td class="nav_passive"><a class="nav_passive" href="http://www.enlightenment.org/p.php?p=support">Support</a></td> 
          <td class="nav_passive"><a class="nav_passive" href="http://www.enlightenment.org/p.php?p=contribute">Contribute</a></td> 
          <td class="nav_passive"><a class="nav_passive" href="http://www.enlightenment.org/p.php?p=contact">Contact</a></td> 
          <td class="nav_passive"><a class="nav_passive" href="http://trac.enlightenment.org/e">Tracker</a></td>
          <td class="nav_passive"><a class="nav_passive" href="http://www.enlightenment.org/p.php?p=docs">Docs</a></td> 
        </tr></table>          
      </td>
      <td id="header_last"></td>
    </tr></table>

    <div class="doxytitle">
        Edje Documentation <small>at Tue Feb 8 2011</small>
    </div>

    <div class="menu-container">
        <div class="submenu">
            <ul class="current">
                <li><a href="files.html">Files</a></li>
                <li><a href="Edje__Edit_8h.html">Edje Edit API</a></li>
                <li><a href="examples.html">Examples</a></li>
                <li><a href="luaref.html">LUA scripting</a></li>
                <li><a href="Edje_8h.html">Edje API</a></li>
                <li><a href="edcref.html">EDC Reference</a></li>
                <li class="current"><a  href="index.html">Main Page</a></li>
            </ul>
        </div>
    </div>


    <div class="clear"></div>
</div>
</div>

<div id="content">
<div class="layout">
<!-- Generated by Doxygen 1.7.3 -->
</div>
<div class="header">
  <div class="headertitle">
<h1>embryo_custom_state.edc</h1>  </div>
</div>
<div class="contents">
<p>This example show how to create a custom state from embryo. Clicking on the 3 labels will rotate the object in the given direction.</p>
<div class="fragment"><pre class="fragment">collections {
   group { <a name="a0"></a><a class="code" href="edje__data_8c.html#a8f8f80d37794cde9472343e4487ba3eb">name</a>: <span class="stringliteral">&quot;main&quot;</span>;
      script {
         <span class="comment">/* define 3 global vars to hold the rotation values */</span>
         <span class="keyword">public</span> rotx;
         <span class="keyword">public</span> roty;
         <span class="keyword">public</span> rotz;
      }
      parts {
         part { <a class="code" href="edje__data_8c.html#a8f8f80d37794cde9472343e4487ba3eb">name</a>: <span class="stringliteral">&quot;bg&quot;</span>;
            <a name="a1"></a><a class="code" href="edje__data_8c.html#a0dae2edc8bfd2bedabfa38415c35f3ec">type</a>: RECT;
            description { state: <span class="stringliteral">&quot;default&quot;</span> 0.0;
               color: 255 255 255 255;
            }
         }
         part { <a class="code" href="edje__data_8c.html#a8f8f80d37794cde9472343e4487ba3eb">name</a>: <span class="stringliteral">&quot;title&quot;</span>;
            <a class="code" href="edje__data_8c.html#a0dae2edc8bfd2bedabfa38415c35f3ec">type</a>: TEXT;
            description { state: <span class="stringliteral">&quot;default&quot;</span> 0.0;
               color: 0 0 0 255;
               text {
                  text: <span class="stringliteral">&quot;Click labels to rotate&quot;</span>;
                  font: <span class="stringliteral">&quot;Sans&quot;</span>;
                  size: 12;
                  align: 0.5 0.0;
               }
            }
         }
         part { <a class="code" href="edje__data_8c.html#a8f8f80d37794cde9472343e4487ba3eb">name</a>: <span class="stringliteral">&quot;X&quot;</span>;
            <a class="code" href="edje__data_8c.html#a0dae2edc8bfd2bedabfa38415c35f3ec">type</a>: TEXT;
            description { state: <span class="stringliteral">&quot;default&quot;</span> 0.0;
               color: 0 0 0 255;
               text {
                  text: <span class="stringliteral">&quot;Rot X (0)&quot;</span>;
                  font: <span class="stringliteral">&quot;Sans&quot;</span>;
                  size: 12;
                  align: 0.1 0.5;
               }
            }
         }
         part { <a class="code" href="edje__data_8c.html#a8f8f80d37794cde9472343e4487ba3eb">name</a>: <span class="stringliteral">&quot;Y&quot;</span>;
            <a class="code" href="edje__data_8c.html#a0dae2edc8bfd2bedabfa38415c35f3ec">type</a>: TEXT;
            description { state: <span class="stringliteral">&quot;default&quot;</span> 0.0;
               color: 0 0 0 255;
               text {
                  text: <span class="stringliteral">&quot;Rot Y (0)&quot;</span>;
                  font: <span class="stringliteral">&quot;Sans&quot;</span>;
                  size: 12;
                  align: 0.5 0.9;
               }
            }
         }
         part { <a class="code" href="edje__data_8c.html#a8f8f80d37794cde9472343e4487ba3eb">name</a>: <span class="stringliteral">&quot;Z&quot;</span>;
            <a class="code" href="edje__data_8c.html#a0dae2edc8bfd2bedabfa38415c35f3ec">type</a>: TEXT;
            description { state: <span class="stringliteral">&quot;default&quot;</span> 0.0;
               color: 0 0 0 255;
               text {
                  text: <span class="stringliteral">&quot;Rot Z (0)&quot;</span>;
                  font: <span class="stringliteral">&quot;Sans&quot;</span>;
                  size: 12;
                  align: 0.9 0.5;
               }
            }
         }
         part { <a class="code" href="edje__data_8c.html#a8f8f80d37794cde9472343e4487ba3eb">name</a>: <span class="stringliteral">&quot;rect&quot;</span>;
            <a class="code" href="edje__data_8c.html#a0dae2edc8bfd2bedabfa38415c35f3ec">type</a>: RECT;
            mouse_events: 0;
            description { state: <span class="stringliteral">&quot;default&quot;</span> 0.0;
               color: 255 0 0 150;
               max: 150 150;
               align: 0.5 0.5;
               map {
                  on: 1;
                  perspective_on: 1;
                  smooth: 1;
                  alpha: 1;
               }
            }
         }
      }
      programs {
         program {
            signal: <span class="stringliteral">&quot;mouse,down,1&quot;</span>;
            source: <span class="stringliteral">&quot;X&quot;</span>;
            script {
               <span class="comment">/* define local vars */</span>
               <span class="keyword">new</span> buf[32];
               <span class="keyword">new</span> Float:x;

               <span class="comment">/* get global var (and increment) */</span>
               x = get_int(rotx) + 10;
               <span class="comment">/* set global var */</span>
               set_int(rotx, round(x));
               <span class="comment">/* crete a new custom state (inherit from default 0.0) */</span>
               custom_state(PART:<span class="stringliteral">&quot;rect&quot;</span>, <span class="stringliteral">&quot;default&quot;</span>, 0.0);
               <span class="comment">/* change the rotation in the custom state */</span>
               set_state_val(PART:<span class="stringliteral">&quot;rect&quot;</span>, STATE_MAP_ROT_X, x);
               <span class="comment">/* apply the custom state */</span>
               set_state(PART:<span class="stringliteral">&quot;rect&quot;</span>, <span class="stringliteral">&quot;custom&quot;</span>, 0.0);
               <span class="comment">/* update the label to show the current value */</span>
               snprintf(buf, <span class="keyword">sizeof</span>(buf), <span class="stringliteral">&quot;Rot X (%d)&quot;</span>, round(x));
               set_text(PART:<span class="stringliteral">&quot;X&quot;</span>, buf);
            }
         }
         program {
            signal: <span class="stringliteral">&quot;mouse,down,1&quot;</span>;
            source: <span class="stringliteral">&quot;Y&quot;</span>;
            script {
               <span class="keyword">new</span> buf[32];
               <span class="keyword">new</span> Float:y = get_int(roty) + 10;
               set_int(roty, round(y));
               custom_state(PART:<span class="stringliteral">&quot;rect&quot;</span>, <span class="stringliteral">&quot;default&quot;</span>, 0.0);
               set_state_val(PART:<span class="stringliteral">&quot;rect&quot;</span>, STATE_MAP_ROT_Y, y);
               set_state(PART:<span class="stringliteral">&quot;rect&quot;</span>, <span class="stringliteral">&quot;custom&quot;</span>, 0.0);
               snprintf(buf, <span class="keyword">sizeof</span>(buf), <span class="stringliteral">&quot;Rot Y (%d)&quot;</span>, round(y));
               set_text(PART:<span class="stringliteral">&quot;Y&quot;</span>, buf);
            }
         }
         program {
            signal: <span class="stringliteral">&quot;mouse,down,1&quot;</span>;
            source: <span class="stringliteral">&quot;Z&quot;</span>;
            script {
               <span class="keyword">new</span> buf[32];
               <span class="keyword">new</span> Float:z = get_int(rotz) + 10;
               set_int(rotz, round(z));
               custom_state(PART:<span class="stringliteral">&quot;rect&quot;</span>, <span class="stringliteral">&quot;default&quot;</span>, 0.0);
               set_state_val(PART:<span class="stringliteral">&quot;rect&quot;</span>, STATE_MAP_ROT_Z, z);
               set_state(PART:<span class="stringliteral">&quot;rect&quot;</span>, <span class="stringliteral">&quot;custom&quot;</span>, 0.0);
               snprintf(buf, <span class="keyword">sizeof</span>(buf), <span class="stringliteral">&quot;Rot Z (%d)&quot;</span>, round(z));
               set_text(PART:<span class="stringliteral">&quot;Z&quot;</span>, buf);
            }
         }
      }
   }
}
</pre></div> </div>
</div>
 
 <div id="push"></div>
 </div> <!-- #content -->
  </div> <!-- .layout -->
 
 </div> <!-- #container -->
 
 
  <div id="footer">
    <table><tr>
      <td class="copyright">Copyright &copy;2011 Enlightenment</td>
      <td class="generated">Docs generated Tue Feb 8 2011 17:28:42</td>
    </tr></table>
  </div>


</body>
</html>