[gnome-games] [lightsoff] Fix offscreen texture usage (hidden-but-added works, too)



commit f53e96b6c01823cb762747210f9ff409da9e41b2
Author: Tim Horton <hortont svn gnome org>
Date:   Sun Jul 5 17:02:24 2009 -0400

    [lightsoff] Fix offscreen texture usage (hidden-but-added works, too)

 lightsoff/data/themes/tango/theme.js.in |   21 ++++++---------------
 lightsoff/data/themes/up/theme.js.in    |   19 +++++--------------
 lightsoff/src/Settings.js               |    2 +-
 lightsoff/src/main.js.in                |    2 +-
 4 files changed, 13 insertions(+), 31 deletions(-)
---
diff --git a/lightsoff/data/themes/tango/theme.js.in b/lightsoff/data/themes/tango/theme.js.in
index 0922369..6b2e821 100644
--- a/lightsoff/data/themes/tango/theme.js.in
+++ b/lightsoff/data/themes/tango/theme.js.in
@@ -3,35 +3,25 @@ file_prefix = '@prefix@' + "/share/gnome-games/lightsoff/";
 Clutter = imports.gi.Clutter;
 
 var name = "Tango";
-var mapped = false;
+var setup_done = false;
 var light = [ load_svg("off.svg"), load_svg("on.svg") ];
 var arrow = load_svg("arrow.svg");
 var backing = load_svg("backing.svg");
 var led_back = load_svg("led-back.svg");
 var highlight = load_svg("highlight.svg");
 
-// TODO: figure out how to fix this new offscreen cloning thing. this is a hack.
-
-function map_stuff(a)
+function setup(a)
 {
-	if(mapped)
+	if(setup_done)
 		return;
-	mapped = true;
-	
+	setup_done = true;
+
 	a.add_actor(light[0]);
 	a.add_actor(light[1]);
 	a.add_actor(arrow);
 	a.add_actor(backing);
 	a.add_actor(led_back);
 	a.add_actor(highlight);
-	a.show_all();
-	
-	light[0].set_position(-500, -500);
-	light[1].set_position(-500, -500);
-	arrow.set_position(-500, -500);
-	backing.set_position(-500, -500);
-	led_back.set_position(-500, -500);
-	highlight.set_position(-500, -500);
 }
 
 // helper functions should be put somewhere global
@@ -43,5 +33,6 @@ function load_svg(file)
 	
 	var tx = new Clutter.Texture({filename: file_prefix + "themes/tango/" + file});
 	tx.filter_quality = Clutter.TextureQuality.HIGH;
+	tx.hide();
 	return tx;
 }
diff --git a/lightsoff/data/themes/up/theme.js.in b/lightsoff/data/themes/up/theme.js.in
index 63ea95f..3091fa5 100644
--- a/lightsoff/data/themes/up/theme.js.in
+++ b/lightsoff/data/themes/up/theme.js.in
@@ -3,20 +3,18 @@ file_prefix = '@prefix@' + "/share/gnome-games/lightsoff/";
 Clutter = imports.gi.Clutter;
 
 var name = "Shine";
-var mapped = false;
+var setup_done = false;
 var light = [ load_svg("off.svg"), load_svg("on.svg") ];
 var arrow = load_svg("arrow.svg");
 var backing = load_svg("backing.svg");
 var led_back = load_svg("led-back.svg");
 var highlight = load_svg("highlight.svg");
 
-// TODO: figure out how to fix this new offscreen cloning thing. this is a hack.
-
-function map_stuff(a)
+function setup(a)
 {
-	if(mapped)
+	if(setup_done)
 		return;
-	mapped = true;
+	setup_done = true;
 
 	a.add_actor(light[0]);
 	a.add_actor(light[1]);
@@ -24,14 +22,6 @@ function map_stuff(a)
 	a.add_actor(backing);
 	a.add_actor(led_back);
 	a.add_actor(highlight);
-	a.show_all();
-	
-	light[0].set_position(-500, -500);
-	light[1].set_position(-500, -500);
-	arrow.set_position(-500, -500);
-	backing.set_position(-500, -500);
-	led_back.set_position(-500, -500);
-	highlight.set_position(-500, -500);
 }
 
 // helper functions should be put somewhere global
@@ -43,5 +33,6 @@ function load_svg(file)
 	
 	var tx = new Clutter.Texture({filename: file_prefix + "themes/up/" + file});
 	tx.filter_quality = Clutter.TextureQuality.HIGH;
+	tx.hide();
 	return tx;
 }
diff --git a/lightsoff/src/Settings.js b/lightsoff/src/Settings.js
index defb7db..70f863e 100644
--- a/lightsoff/src/Settings.js
+++ b/lightsoff/src/Settings.js
@@ -68,7 +68,7 @@ handlers = {
 			return;
 		
 		theme = new_theme;
-		theme.map_stuff(main.stage);
+		theme.setup(main.stage);
 		
 		try
 		{
diff --git a/lightsoff/src/main.js.in b/lightsoff/src/main.js.in
index 8831963..77bf9e3 100755
--- a/lightsoff/src/main.js.in
+++ b/lightsoff/src/main.js.in
@@ -52,7 +52,7 @@ stage.color = {alpha:255};
 window.show_all();
 stage.show_all();
 
-Settings.theme.map_stuff(stage);
+Settings.theme.setup(stage);
 
 var game = new Game.GameView();
 stage.add_actor(game);



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