seed r251 - trunk/examples/lightsoff



Author: hortont
Date: Tue Nov 11 16:23:06 2008
New Revision: 251
URL: http://svn.gnome.org/viewvc/seed?rev=251&view=rev

Log:
Update score display.


Added:
   trunk/examples/lightsoff/bkg.png   (contents, props changed)
   trunk/examples/lightsoff/bkg_top.png   (contents, props changed)
Removed:
   trunk/examples/lightsoff/bg_bottom.svg
   trunk/examples/lightsoff/bg_top.svg
Modified:
   trunk/examples/lightsoff/led.svg
   trunk/examples/lightsoff/score.js

Added: trunk/examples/lightsoff/bkg.png
==============================================================================
Binary file. No diff available.

Added: trunk/examples/lightsoff/bkg_top.png
==============================================================================
Binary file. No diff available.

Modified: trunk/examples/lightsoff/led.svg
==============================================================================
--- trunk/examples/lightsoff/led.svg	(original)
+++ trunk/examples/lightsoff/led.svg	Tue Nov 11 16:23:06 2008
@@ -32,7 +32,7 @@
     <linearGradient
        id="linearGradient3169">
       <stop
-         style="stop-color:#ffffff;stop-opacity:0.25600001;"
+         style="stop-color:#ffffff;stop-opacity:0.104;"
          offset="0"
          id="stop3171" />
       <stop
@@ -164,6 +164,34 @@
          stdDeviation="2.0829568"
          id="feGaussianBlur4150" />
     </filter>
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3169"
+       id="linearGradient2534"
+       gradientUnits="userSpaceOnUse"
+       x1="89.486572"
+       y1="427.74588"
+       x2="89.486572"
+       y2="329.31064" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3155"
+       id="linearGradient2538"
+       gradientUnits="userSpaceOnUse"
+       x1="656.46228"
+       y1="324.31064"
+       x2="656.46228"
+       y2="525.81189"
+       gradientTransform="translate(9.8466947e-6,7.6000104e-7)" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3155"
+       id="linearGradient2542"
+       gradientUnits="userSpaceOnUse"
+       x1="656.46228"
+       y1="324.31064"
+       x2="656.46228"
+       y2="525.81189" />
   </defs>
   <sodipodi:namedview
      id="base"
@@ -176,7 +204,7 @@
      inkscape:pageopacity="0.0"
      inkscape:pageshadow="2"
      inkscape:zoom="0.70551067"
-     inkscape:cx="425.04883"
+     inkscape:cx="169.91449"
      inkscape:cy="517.39837"
      inkscape:document-units="px"
      inkscape:current-layer="layer1"
@@ -829,8 +857,28 @@
        d="M 111.75668,331.31064 L 629.19217,331.31064 C 640.1758,331.31064 649.01821,340.23064 649.01821,351.31064 L 649.01821,409.74588 C 596.41837,448.0432 101.20177,468.03983 91.930644,409.74588 L 91.930644,351.31064 C 91.930644,340.23064 100.77306,331.31064 111.75668,331.31064 z"
        id="rect3165"
        sodipodi:nodetypes="ccccccc"
-       inkscape:export-filename="/home/hortont/seed/examples/lightsoff/bkg.png"
+       inkscape:export-filename="/home/hortont/seed/examples/lightsoff/bkg_top.png"
        inkscape:export-xdpi="37.209068"
        inkscape:export-ydpi="37.209068" />
+    <path
+       style="opacity:0.78000004;fill:url(#linearGradient2534);fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1"
+       d="M 794.42012,274.79781 L 1311.8557,274.79781 C 1322.8393,274.79781 1331.6817,283.71781 1331.6817,294.79781 L 1331.6817,353.23305 C 1279.0819,391.53037 783.86521,411.527 774.59408,353.23305 L 774.59408,294.79781 C 774.59408,283.71781 783.4365,274.79781 794.42012,274.79781 z"
+       id="path2532"
+       sodipodi:nodetypes="ccccccc"
+       inkscape:export-filename="/home/hortont/seed/examples/lightsoff/bkg_top.png"
+       inkscape:export-xdpi="48.143238"
+       inkscape:export-ydpi="48.143238" />
+    <rect
+       style="opacity:1;fill:url(#linearGradient2542);fill-opacity:1;stroke:#5d5d5d;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       id="rect2540"
+       width="561.97571"
+       height="191.50128"
+       x="-499.26947"
+       y="329.31091"
+       rx="20"
+       ry="19.999998"
+       inkscape:export-filename="/home/hortont/seed/examples/lightsoff/bkg.png"
+       inkscape:export-xdpi="47.906658"
+       inkscape:export-ydpi="47.906658" />
   </g>
 </svg>

Modified: trunk/examples/lightsoff/score.js
==============================================================================
--- trunk/examples/lightsoff/score.js	(original)
+++ trunk/examples/lightsoff/score.js	Tue Nov 11 16:23:06 2008
@@ -9,13 +9,34 @@
     name: "Score",
     class_init: function(klass, prototype)
     {
-
+		prototype.set_value = function (val)
+		{
+			var val_s = Seed.sprintf("% 5d",val);
+		
+			for(var i = 0; i < val_s.length; i++)
+			{
+				var texture = this.num_textures[val_s[i]];
+		
+				if(val_s[i] == ' ')
+					texture = null;
+			
+				var num = new Clutter.CloneTexture({parent_texture:texture});
+				num.set_position(56*i-10,3);
+				num.set_size(97,97);
+				this.add_actor(num);
+				num.show();
+			}
+			
+			this.bkg_top.raise_top();
+		}
     },
     instance_init: function(klass)
     {
+    	this.bkg_top = Clutter.Texture.new_from_file("./bkg_top.png");
 		var bkg = Clutter.Texture.new_from_file("./bkg.png");
 		var off_svg = Clutter.Texture.new_from_file("./off.svg");
 		
+		this.bkg_top.filter_quality = Clutter.TextureQuality.high;
 		bkg.filter_quality = Clutter.TextureQuality.high;
 		off_svg.filter_quality = Clutter.TextureQuality.high;
 		
@@ -24,26 +45,36 @@
 		for(var i = 0; i < 5; i++)
 		{
 			var off_i = new Clutter.CloneTexture({parent_texture:off_svg});
-			off_i.set_position(50*i-10,0);
-			off_i.set_size(80,80);
+			off_i.set_position(56*i-10,3);
+			off_i.set_size(97,97);
 			this.add_actor(off_i);
 		}
 		
-		var seven = Clutter.Texture.new_from_file("./7.svg");
-		seven.filter_quality = Clutter.TextureQuality.high;
-		seven.set_position(-10,0);
-		seven.set_size(80,80);
-		this.add_actor(seven);
+		this.num_textures = new Array();
+		
+		for(var i = 0; i <= 9; i++)
+		{
+			this.num_textures[i] = Clutter.Texture.new_from_file("./"+i+".svg");
+			this.num_textures[i].filter_quality = Clutter.TextureQuality.high;
+		}
+		
+		this.bkg_top.opacity = 150;
+		this.bkg_top.set_position(1,1);
+		this.add_actor(this.bkg_top);
+		
+		this.set_value(5123);
     }};
 
 Score = new GType(ScoreType);
 
-var stage = new Clutter.Stage();
-stage.signal.hide.connect(Clutter.main_quit);
+var black = Clutter.Color._new();
+Clutter.color_parse("Black", black);
+
+var stage = new Clutter.Stage({color: black});stage.signal.hide.connect(Clutter.main_quit);
 stage.set_size(400,400);
 
 board = new Score();
-
+board.set_position(20,20);
 stage.add_actor(board);
 stage.show_all();
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]