seed r260 - trunk/examples/lightsoff
- From: hortont svn gnome org
- To: svn-commits-list gnome org
- Subject: seed r260 - trunk/examples/lightsoff
- Date: Wed, 12 Nov 2008 11:36:45 +0000 (UTC)
Author: hortont
Date: Wed Nov 12 11:36:45 2008
New Revision: 260
URL: http://svn.gnome.org/viewvc/seed?rev=260&view=rev
Log:
Ensure you can't make the buttons
go insane by clicking many times;
embed in Gtk so we can get menus
once things are less broken
upstream.
Modified:
trunk/examples/lightsoff/board.js
trunk/examples/lightsoff/main.js
Modified: trunk/examples/lightsoff/board.js
==============================================================================
--- trunk/examples/lightsoff/board.js (original)
+++ trunk/examples/lightsoff/board.js Wed Nov 12 11:36:45 2008
@@ -56,6 +56,8 @@
function check_won (timeline, light)
{
+ in_fade = false;
+
if(light.get_parent().cleared() && !in_setup)
{
score.increment_value(100);
@@ -65,6 +67,9 @@
function flip_region (act, evt, light)
{
+ if(!in_setup && in_fade)
+ return true;
+
var x = light.light_x;
var y = light.light_y;
@@ -82,6 +87,7 @@
light.get_parent().lights[x][y - 1].flip(fadeline);
fadeline.start();
+ in_fade = true;
fadeline.signal.completed.connect(check_won, null, light);
@@ -133,6 +139,8 @@
},
instance_init: function(klass)
{
+ in_fade = false;
+
this.lights = new Array();
for(var x = 0; x < tiles; x++)
Modified: trunk/examples/lightsoff/main.js
==============================================================================
--- trunk/examples/lightsoff/main.js (original)
+++ trunk/examples/lightsoff/main.js Wed Nov 12 11:36:45 2008
@@ -7,38 +7,48 @@
var tile_size = 75;
var board_size = (tile_size + margin) * tiles + margin;
-
+Seed.import_namespace("Gtk");
Seed.import_namespace("Clutter");
Seed.import_namespace("GtkClutter");
Seed.import_namespace("GdkPixbuf");
-Clutter.init(null, null);
+GtkClutter.init(null, null);
Seed.include("score.js");
Seed.include("light.js");
Seed.include("board.js");
+Seed.include("menu.js");
var black = Clutter.Color._new();
Clutter.color_parse("Black", black);
-var stage = new Clutter.Stage({color: black});
-stage.signal.hide.connect(Clutter.main_quit);
+var window = new Gtk.Window({title:"Lights Off"});
+window.signal.hide.connect(Gtk.main_quit);
+
+var clutter_embed = new GtkClutter.Embed();
+var stage = clutter_embed.get_stage();
+stage.color = black;
+menu = create_menu();
board = new Board();
score = new Score();
rect = new Clutter.Rectangle({color:black});
score.set_position((board_size / 2) - (score.width / 2), board_size + margin);
+stage.set_size(board_size, board_size + score.height + margin * 3);
+window.resize(stage.width, stage.height);
+
rect.set_position(0, board_size);
rect.set_size(stage.width, stage.height);
-stage.set_size(board_size, board_size + score.height + margin * 3);
-
stage.add_actor(board);
stage.add_actor(rect);
stage.add_actor(score);
stage.show_all();
-Clutter.main();
+window.add(clutter_embed);
+window.show_all();
+
+Gtk.main();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]