<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="http://techbase.kde.org/skins/common/feed.css?0.2"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://techbase.kde.org/index.php?title=Development/Tutorials/Qt4_Ruby_Tutorial/Chapter_13/fi&amp;feed=atom&amp;action=history</id>
		<title>Development/Tutorials/Qt4 Ruby Tutorial/Chapter 13/fi - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://techbase.kde.org/index.php?title=Development/Tutorials/Qt4_Ruby_Tutorial/Chapter_13/fi&amp;feed=atom&amp;action=history"/>
		<link rel="alternate" type="text/html" href="http://techbase.kde.org/index.php?title=Development/Tutorials/Qt4_Ruby_Tutorial/Chapter_13/fi&amp;action=history"/>
		<updated>2013-05-23T08:57:33Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.20.2</generator>

	<entry>
		<id>http://techbase.kde.org/index.php?title=Development/Tutorials/Qt4_Ruby_Tutorial/Chapter_13/fi&amp;diff=73685&amp;oldid=prev</id>
		<title>FuzzyBot: Updating to match new version of source page</title>
		<link rel="alternate" type="text/html" href="http://techbase.kde.org/index.php?title=Development/Tutorials/Qt4_Ruby_Tutorial/Chapter_13/fi&amp;diff=73685&amp;oldid=prev"/>
				<updated>2012-07-18T14:25:59Z</updated>
		
		<summary type="html">&lt;p&gt;Updating to match new version of source page&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
			&lt;tr style='vertical-align: top;'&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 14:25, 18 July 2012&lt;/td&gt;
			&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;languages /&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;languages /&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;{{Template:I18n/Language Navigation Bar|Development/Tutorials/Qt4 Ruby Tutorial/Chapter 13}}&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;{{TutorialBrowser|&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;{{TutorialBrowser|&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>FuzzyBot</name></author>	</entry>

	<entry>
		<id>http://techbase.kde.org/index.php?title=Development/Tutorials/Qt4_Ruby_Tutorial/Chapter_13/fi&amp;diff=67160&amp;oldid=prev</id>
		<title>Centerlink: Created page with &quot;=== Harjoitukset ===&quot;</title>
		<link rel="alternate" type="text/html" href="http://techbase.kde.org/index.php?title=Development/Tutorials/Qt4_Ruby_Tutorial/Chapter_13/fi&amp;diff=67160&amp;oldid=prev"/>
				<updated>2011-11-01T17:32:11Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot;=== Harjoitukset ===&amp;quot;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
			&lt;tr style='vertical-align: top;'&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 17:32, 1 November 2011&lt;/td&gt;
			&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 275:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 275:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Hits and shots left are displayed and the program keeps track of them. The game can end, and there's a button to start a new game.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Hits and shots left are displayed and the program keeps track of them. The game can end, and there's a button to start a new game.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;=== &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Exercises &lt;/del&gt;===&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;=== &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Harjoitukset &lt;/ins&gt;===&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Add a random wind factor and show it to the user.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Add a random wind factor and show it to the user.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Centerlink</name></author>	</entry>

	<entry>
		<id>http://techbase.kde.org/index.php?title=Development/Tutorials/Qt4_Ruby_Tutorial/Chapter_13/fi&amp;diff=67158&amp;oldid=prev</id>
		<title>Centerlink: Created page with &quot;=== Sovelluksen suorittaminen ===&quot;</title>
		<link rel="alternate" type="text/html" href="http://techbase.kde.org/index.php?title=Development/Tutorials/Qt4_Ruby_Tutorial/Chapter_13/fi&amp;diff=67158&amp;oldid=prev"/>
				<updated>2011-11-01T17:32:00Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot;=== Sovelluksen suorittaminen ===&amp;quot;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
			&lt;tr style='vertical-align: top;'&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 17:32, 1 November 2011&lt;/td&gt;
			&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 269:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 269:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;This file has just been on a diet. '''&amp;lt;tt&amp;gt;MyWidget&amp;lt;/tt&amp;gt;''' is gone, and the only thing left is the '''&amp;lt;tt&amp;gt;main()&amp;lt;/tt&amp;gt;''' function, unchanged except for the name change.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;This file has just been on a diet. '''&amp;lt;tt&amp;gt;MyWidget&amp;lt;/tt&amp;gt;''' is gone, and the only thing left is the '''&amp;lt;tt&amp;gt;main()&amp;lt;/tt&amp;gt;''' function, unchanged except for the name change.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;=== &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Running the Application &lt;/del&gt;===&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;=== &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Sovelluksen suorittaminen &lt;/ins&gt;===&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;The cannon can shoot at a target; a new target is automatically created when one has been hit.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;The cannon can shoot at a target; a new target is automatically created when one has been hit.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key wwwdeveloper:diff:version:1.11a:oldid:67156:newid:67158 --&gt;
&lt;/table&gt;</summary>
		<author><name>Centerlink</name></author>	</entry>

	<entry>
		<id>http://techbase.kde.org/index.php?title=Development/Tutorials/Qt4_Ruby_Tutorial/Chapter_13/fi&amp;diff=67156&amp;oldid=prev</id>
		<title>Centerlink: Created page with &quot;=== Läpikäynti rivi riviltä ===&quot;</title>
		<link rel="alternate" type="text/html" href="http://techbase.kde.org/index.php?title=Development/Tutorials/Qt4_Ruby_Tutorial/Chapter_13/fi&amp;diff=67156&amp;oldid=prev"/>
				<updated>2011-11-01T17:31:37Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot;=== Läpikäynti rivi riviltä ===&amp;quot;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
			&lt;tr style='vertical-align: top;'&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 17:31, 1 November 2011&lt;/td&gt;
			&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 27:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 27:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;The layout problems in '''&amp;lt;tt&amp;gt;LCDRange&amp;lt;/tt&amp;gt;''' are fixed. &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;The layout problems in '''&amp;lt;tt&amp;gt;LCDRange&amp;lt;/tt&amp;gt;''' are fixed. &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;=== &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Line by Line Walkthrough &lt;/del&gt;===&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;=== &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Läpikäynti rivi riviltä &lt;/ins&gt;===&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;'''[http://www.darshancomputing.com/qt4-qtruby-tutorial/tutorial/t13/lcdrange.rb lcdrange.rb]'''&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;'''[http://www.darshancomputing.com/qt4-qtruby-tutorial/tutorial/t13/lcdrange.rb lcdrange.rb]'''&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Centerlink</name></author>	</entry>

	<entry>
		<id>http://techbase.kde.org/index.php?title=Development/Tutorials/Qt4_Ruby_Tutorial/Chapter_13/fi&amp;diff=67154&amp;oldid=prev</id>
		<title>Centerlink: Created page with &quot;=== Yleiskuva ===&quot;</title>
		<link rel="alternate" type="text/html" href="http://techbase.kde.org/index.php?title=Development/Tutorials/Qt4_Ruby_Tutorial/Chapter_13/fi&amp;diff=67154&amp;oldid=prev"/>
				<updated>2011-11-01T17:31:13Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot;=== Yleiskuva ===&amp;quot;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
			&lt;tr style='vertical-align: top;'&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 17:31, 1 November 2011&lt;/td&gt;
			&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 17:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 17:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;* [http://www.darshancomputing.com/qt4-qtruby-tutorial/tutorial/t13/cannon.rb cannon.rb]&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;* [http://www.darshancomputing.com/qt4-qtruby-tutorial/tutorial/t13/cannon.rb cannon.rb]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;=== &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Overview &lt;/del&gt;===&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;=== &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Yleiskuva &lt;/ins&gt;===&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;In this example we start to approach a real playable game with a score.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;In this example we start to approach a real playable game with a score.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key wwwdeveloper:diff:version:1.11a:oldid:67151:newid:67154 --&gt;
&lt;/table&gt;</summary>
		<author><name>Centerlink</name></author>	</entry>

	<entry>
		<id>http://techbase.kde.org/index.php?title=Development/Tutorials/Qt4_Ruby_Tutorial/Chapter_13/fi&amp;diff=67151&amp;oldid=prev</id>
		<title>Centerlink: Created page with &quot;== Peli loppui ==&quot;</title>
		<link rel="alternate" type="text/html" href="http://techbase.kde.org/index.php?title=Development/Tutorials/Qt4_Ruby_Tutorial/Chapter_13/fi&amp;diff=67151&amp;oldid=prev"/>
				<updated>2011-11-01T17:30:53Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot;== Peli loppui ==&amp;quot;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
			&lt;tr style='vertical-align: top;'&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 17:30, 1 November 2011&lt;/td&gt;
			&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 9:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 9:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;next=[[Special:myLanguage/Development/Tutorials/Qt4_Ruby_Tutorial/Chapter_14|Tutorial 14 - Facing the Wall]]&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;next=[[Special:myLanguage/Development/Tutorials/Qt4_Ruby_Tutorial/Chapter_14|Tutorial 14 - Facing the Wall]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;}}&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;}}&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Game Over &lt;/del&gt;==&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Peli loppui &lt;/ins&gt;==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;[[Image:Qt4_Ruby_Tutorial_Screenshot_13.png|center]]&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;[[Image:Qt4_Ruby_Tutorial_Screenshot_13.png|center]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Files:&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Files:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Centerlink</name></author>	</entry>

	<entry>
		<id>http://techbase.kde.org/index.php?title=Development/Tutorials/Qt4_Ruby_Tutorial/Chapter_13/fi&amp;diff=67149&amp;oldid=prev</id>
		<title>Centerlink: Created page with &quot;Peli loppui&quot;</title>
		<link rel="alternate" type="text/html" href="http://techbase.kde.org/index.php?title=Development/Tutorials/Qt4_Ruby_Tutorial/Chapter_13/fi&amp;diff=67149&amp;oldid=prev"/>
				<updated>2011-11-01T17:30:34Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot;Peli loppui&amp;quot;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
			&lt;tr style='vertical-align: top;'&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 17:30, 1 November 2011&lt;/td&gt;
			&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 5:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 5:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;{{TutorialBrowser|&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;{{TutorialBrowser|&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;series=[[Special:myLanguage/Development/Tutorials/Qt4_Ruby_Tutorial|Qt4 Ruby -oppikurssi]]|&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;series=[[Special:myLanguage/Development/Tutorials/Qt4_Ruby_Tutorial|Qt4 Ruby -oppikurssi]]|&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;name=&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Game Over&lt;/del&gt;|&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;name=&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Peli loppui&lt;/ins&gt;|&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;pre=[[Special:myLanguage/Development/Tutorials/Qt4_Ruby_Tutorial/Chapter_12|Tutorial 12 - Hanging in the Air the Way Bricks Don't]]|&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;pre=[[Special:myLanguage/Development/Tutorials/Qt4_Ruby_Tutorial/Chapter_12|Tutorial 12 - Hanging in the Air the Way Bricks Don't]]|&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;next=[[Special:myLanguage/Development/Tutorials/Qt4_Ruby_Tutorial/Chapter_14|Tutorial 14 - Facing the Wall]]&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;next=[[Special:myLanguage/Development/Tutorials/Qt4_Ruby_Tutorial/Chapter_14|Tutorial 14 - Facing the Wall]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key wwwdeveloper:diff:version:1.11a:oldid:67147:newid:67149 --&gt;
&lt;/table&gt;</summary>
		<author><name>Centerlink</name></author>	</entry>

	<entry>
		<id>http://techbase.kde.org/index.php?title=Development/Tutorials/Qt4_Ruby_Tutorial/Chapter_13/fi&amp;diff=67147&amp;oldid=prev</id>
		<title>Centerlink: Created page with &quot;Qt4 Ruby -oppikurssi&quot;</title>
		<link rel="alternate" type="text/html" href="http://techbase.kde.org/index.php?title=Development/Tutorials/Qt4_Ruby_Tutorial/Chapter_13/fi&amp;diff=67147&amp;oldid=prev"/>
				<updated>2011-11-01T17:30:23Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot;Qt4 Ruby -oppikurssi&amp;quot;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
			&lt;tr style='vertical-align: top;'&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 17:30, 1 November 2011&lt;/td&gt;
			&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 4:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 4:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;{{TutorialBrowser|&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;{{TutorialBrowser|&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;series=[[Special:myLanguage/Development/Tutorials/Qt4_Ruby_Tutorial|Qt4 Ruby &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Tutorial&lt;/del&gt;]]|&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;series=[[Special:myLanguage/Development/Tutorials/Qt4_Ruby_Tutorial|Qt4 Ruby &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;-oppikurssi&lt;/ins&gt;]]|&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;name=Game Over|&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;name=Game Over|&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;pre=[[Special:myLanguage/Development/Tutorials/Qt4_Ruby_Tutorial/Chapter_12|Tutorial 12 - Hanging in the Air the Way Bricks Don't]]|&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;pre=[[Special:myLanguage/Development/Tutorials/Qt4_Ruby_Tutorial/Chapter_12|Tutorial 12 - Hanging in the Air the Way Bricks Don't]]|&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key wwwdeveloper:diff:version:1.11a:oldid:67145:newid:67147 --&gt;
&lt;/table&gt;</summary>
		<author><name>Centerlink</name></author>	</entry>

	<entry>
		<id>http://techbase.kde.org/index.php?title=Development/Tutorials/Qt4_Ruby_Tutorial/Chapter_13/fi&amp;diff=67145&amp;oldid=prev</id>
		<title>Centerlink: Created page with &quot;TutorialBrowser&quot;</title>
		<link rel="alternate" type="text/html" href="http://techbase.kde.org/index.php?title=Development/Tutorials/Qt4_Ruby_Tutorial/Chapter_13/fi&amp;diff=67145&amp;oldid=prev"/>
				<updated>2011-11-01T17:30:10Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot;TutorialBrowser&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;languages /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Template:I18n/Language Navigation Bar|Development/Tutorials/Qt4 Ruby Tutorial/Chapter 13}}&lt;br /&gt;
&lt;br /&gt;
{{TutorialBrowser|&lt;br /&gt;
series=[[Special:myLanguage/Development/Tutorials/Qt4_Ruby_Tutorial|Qt4 Ruby Tutorial]]|&lt;br /&gt;
name=Game Over|&lt;br /&gt;
pre=[[Special:myLanguage/Development/Tutorials/Qt4_Ruby_Tutorial/Chapter_12|Tutorial 12 - Hanging in the Air the Way Bricks Don't]]|&lt;br /&gt;
next=[[Special:myLanguage/Development/Tutorials/Qt4_Ruby_Tutorial/Chapter_14|Tutorial 14 - Facing the Wall]]&lt;br /&gt;
}}&lt;br /&gt;
== Game Over ==&lt;br /&gt;
[[Image:Qt4_Ruby_Tutorial_Screenshot_13.png|center]]&lt;br /&gt;
Files:&lt;br /&gt;
* [http://www.darshancomputing.com/qt4-qtruby-tutorial/tutorial/t13/lcdrange.rb lcdrange.rb]&lt;br /&gt;
* [http://www.darshancomputing.com/qt4-qtruby-tutorial/tutorial/t13/gamebrd.rb gamebrd.rb]&lt;br /&gt;
* [http://www.darshancomputing.com/qt4-qtruby-tutorial/tutorial/t13/t13.rb t13.rb]&lt;br /&gt;
* [http://www.darshancomputing.com/qt4-qtruby-tutorial/tutorial/t13/cannon.rb cannon.rb]&lt;br /&gt;
&lt;br /&gt;
=== Overview ===&lt;br /&gt;
&lt;br /&gt;
In this example we start to approach a real playable game with a score.&lt;br /&gt;
&lt;br /&gt;
We give '''&amp;lt;tt&amp;gt;MyWidget&amp;lt;/tt&amp;gt;''' a new name ('''&amp;lt;tt&amp;gt;GameBoard&amp;lt;/tt&amp;gt;'''), add some slots, and move it to '''&amp;lt;tt&amp;gt;gamebrd.rb&amp;lt;/tt&amp;gt;'''&lt;br /&gt;
&lt;br /&gt;
The '''&amp;lt;tt&amp;gt;CannonField&amp;lt;/tt&amp;gt;''' now has a game over state.&lt;br /&gt;
&lt;br /&gt;
The layout problems in '''&amp;lt;tt&amp;gt;LCDRange&amp;lt;/tt&amp;gt;''' are fixed. &lt;br /&gt;
&lt;br /&gt;
=== Line by Line Walkthrough ===&lt;br /&gt;
'''[http://www.darshancomputing.com/qt4-qtruby-tutorial/tutorial/t13/lcdrange.rb lcdrange.rb]'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot;&amp;gt;&lt;br /&gt;
    @label.setSizePolicy(Qt::SizePolicy::Preferred, Qt::SizePolicy::Fixed)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We set the size policy of the [http://doc.qt.nokia.com/latest/qlabel.html Qt::Label] to ([http://doc.qt.nokia.com/latest/qsizepolicy.html#Policy-enum Qt::SizePolicy::Preferred], [http://doc.qt.nokia.com/latest/qsizepolicy.html#Policy-enum Qt::SizePolicy::Fixed]). The vertical component ensures that the label won't stretch or shrink vertically; it will stay at its optimal size (its [http://doc.qt.nokia.com/latest/qwidget.html#sizeHint-prop QWidget::sizeHint()]). This solves the layout problems observed in Chapter 12.&lt;br /&gt;
&lt;br /&gt;
'''[http://www.darshancomputing.com/qt4-qtruby-tutorial/tutorial/t13/cannon.rb cannon.rb]'''&lt;br /&gt;
&lt;br /&gt;
The '''&amp;lt;tt&amp;gt;CannonField&amp;lt;/tt&amp;gt;''' now has a game over state and a few new functions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot;&amp;gt;&lt;br /&gt;
  signals 'canShoot(bool)'&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This new signal indicates that the '''&amp;lt;tt&amp;gt;CannonField&amp;lt;/tt&amp;gt;''' is in a state where the '''&amp;lt;tt&amp;gt;shoot()&amp;lt;/tt&amp;gt;''' slot makes sense. We'll use it below to enable or disable the &amp;lt;strong&amp;gt;Shoot&amp;lt;/strong&amp;gt; button.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot;&amp;gt;&lt;br /&gt;
    @gameEnded = false&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This variable contains the game state; '''&amp;lt;tt&amp;gt;true&amp;lt;/tt&amp;gt;''' means that the game is over, and '''&amp;lt;tt&amp;gt;false&amp;lt;/tt&amp;gt;''' means that a game is going on. Initially, the game is not over (luckily for the player :-).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot;&amp;gt;&lt;br /&gt;
def shoot()&lt;br /&gt;
  if isShooting()&lt;br /&gt;
    return&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  @timerCount = 0&lt;br /&gt;
  @shootAngle = @currentAngle&lt;br /&gt;
  @shootForce = @currentForce&lt;br /&gt;
  @autoShootTimer.start(5)&lt;br /&gt;
  emit canShoot(false)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We added a new '''&amp;lt;tt&amp;gt;isShooting()&amp;lt;/tt&amp;gt;''' function, so '''&amp;lt;tt&amp;gt;shoot()&amp;lt;/tt&amp;gt;''' uses it instead of testing directly. Also, shoot tells the world that the '''&amp;lt;tt&amp;gt;CannonField&amp;lt;/tt&amp;gt;''' cannot shoot now.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot;&amp;gt;&lt;br /&gt;
def setGameOver()&lt;br /&gt;
  if @gameEnded&lt;br /&gt;
    return&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  if isShooting()&lt;br /&gt;
    @autoShootTimer.stop()&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  @gameEnded = true&lt;br /&gt;
  update()&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This slot ends the game. It must be called from outside '''&amp;lt;tt&amp;gt;CannonField&amp;lt;/tt&amp;gt;''', because this widget does not know when to end the game. This is an important design principle in component programming. We choose to make the component as flexible as possible to make it usable with different rules (for example, a multi-player version of this in which the first player to hit ten times wins could use the '''&amp;lt;tt&amp;gt;CannonField&amp;lt;/tt&amp;gt;''' unchanged).&lt;br /&gt;
&lt;br /&gt;
If the game has already been ended we return immediately. If a game is going on we stop the shot, set the game over flag, and repaint the entire widget.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot;&amp;gt;&lt;br /&gt;
def restartGame()&lt;br /&gt;
  if isShooting()&lt;br /&gt;
    @autoShootTimer.stop()&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  @gameEnded = false&lt;br /&gt;
&lt;br /&gt;
  update()&lt;br /&gt;
  emit canShoot(true)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This slot starts a new game. If a shot is in the air, we stop shooting. We then reset the '''&amp;lt;tt&amp;gt;gameEnded&amp;lt;/tt&amp;gt;''' variable and repaint the widget.&lt;br /&gt;
&lt;br /&gt;
'''&amp;lt;tt&amp;gt;moveShot()&amp;lt;/tt&amp;gt;''' too emits the new '''&amp;lt;tt&amp;gt;canShoot(true)&amp;lt;/tt&amp;gt;''' signal at the same time as either '''&amp;lt;tt&amp;gt;hit()&amp;lt;/tt&amp;gt;''' or '''&amp;lt;tt&amp;gt;miss()&amp;lt;/tt&amp;gt;'''.&lt;br /&gt;
&lt;br /&gt;
Modifications in CannonField::paintEvent():&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot;&amp;gt;&lt;br /&gt;
def paintEvent(event)&lt;br /&gt;
  painter = Qt::Painter.new(self)&lt;br /&gt;
&lt;br /&gt;
  if @gameEnded&lt;br /&gt;
    painter.setPen(Qt::black)&lt;br /&gt;
    painter.setFont(Qt::Font.new( &amp;quot;Courier&amp;quot;, 48, Qt::Font::Bold))&lt;br /&gt;
    painter.drawText(rect(), Qt::AlignCenter, tr(&amp;quot;Game Over&amp;quot;))&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The paint event has been enhanced to display the text &amp;quot;Game Over&amp;quot; if the game is over, i.e., '''&amp;lt;tt&amp;gt;gameEnded&amp;lt;/tt&amp;gt;''' is '''&amp;lt;tt&amp;gt;true&amp;lt;/tt&amp;gt;'''. We don't bother to check the update rectangle here because speed is not critical when the game is over.&lt;br /&gt;
&lt;br /&gt;
To draw the text we first set a black pen; the pen color is used when drawing text. Next we choose a 48 point bold font from the Courier family. Finally we draw the text centered in the widget's rectangle. Unfortunately, on some systems (especially X servers with Unicode fonts) it can take a while to load such a large font. Because Qt caches fonts, you will notice this only the first time the font is used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot;&amp;gt;&lt;br /&gt;
  paintCannon(painter)&lt;br /&gt;
&lt;br /&gt;
  if isShooting()&lt;br /&gt;
    paintShot(painter)&lt;br /&gt;
  end        &lt;br /&gt;
&lt;br /&gt;
  unless @gameEnded&lt;br /&gt;
    paintTarget(painter)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  painter.end()&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We draw the shot only when shooting and the target only when playing (that is, when the game is not ended).&lt;br /&gt;
&lt;br /&gt;
'''[http://www.darshancomputing.com/qt4-qtruby-tutorial/tutorial/t13/gamebrd.rb gamebrd.rb]'''&lt;br /&gt;
&lt;br /&gt;
This file is new. It contains the '''&amp;lt;tt&amp;gt;GameBoard&amp;lt;/tt&amp;gt;''' class, which was last seen as '''&amp;lt;tt&amp;gt;MyWidget&amp;lt;/tt&amp;gt;'''.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot;&amp;gt;&lt;br /&gt;
  slots 'fire()', 'hit()', 'missed()', 'newGame()'&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We have now added four slots.&lt;br /&gt;
&lt;br /&gt;
We have also made some changes in the '''&amp;lt;tt&amp;gt;GameBoard&amp;lt;/tt&amp;gt;''' constructor.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot;&amp;gt;&lt;br /&gt;
    @cannonField = CannonField.new()&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''&amp;lt;tt&amp;gt;@cannonField&amp;lt;/tt&amp;gt;''' is now a member variable, so we carefully change the constructor to use it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot;&amp;gt;&lt;br /&gt;
connect(@cannonField, SIGNAL('hit()'),&lt;br /&gt;
        self, SLOT('hit()'))&lt;br /&gt;
connect(@cannonField, SIGNAL('missed()'),&lt;br /&gt;
        self, SLOT('missed()'))&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This time we want to do something when the shot has hit or missed the target. Thus we connect the '''&amp;lt;tt&amp;gt;hit()&amp;lt;/tt&amp;gt;''' and '''&amp;lt;tt&amp;gt;missed()&amp;lt;/tt&amp;gt;''' signals of the '''&amp;lt;tt&amp;gt;CannonField&amp;lt;/tt&amp;gt;''' to two protected slots with the same names in this class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot;&amp;gt;&lt;br /&gt;
    connect(shoot, SIGNAL('clicked()'), self, SLOT('fire()') )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Previously we connected the &amp;lt;strong&amp;gt;Shoot&amp;lt;/strong&amp;gt; button's '''&amp;lt;tt&amp;gt;clicked()&amp;lt;/tt&amp;gt;''' signal directly to the '''&amp;lt;tt&amp;gt;CannonField&amp;lt;/tt&amp;gt;''''s '''&amp;lt;tt&amp;gt;shoot()&amp;lt;/tt&amp;gt;''' slot. This time we want to keep track of the number of shots fired, so we connect it to a slot in this class instead.&lt;br /&gt;
&lt;br /&gt;
Notice how easy it is to change the behavior of a program when you are working with self-contained components.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot;&amp;gt;&lt;br /&gt;
connect(@cannonField, SIGNAL('canShoot(bool)'),&lt;br /&gt;
        shoot, SLOT('setEnabled(bool)'))&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We also use the '''&amp;lt;tt&amp;gt;CannonField&amp;lt;/tt&amp;gt;''''s '''&amp;lt;tt&amp;gt;canShoot()&amp;lt;/tt&amp;gt;''' signal to enable or disable the &amp;lt;strong&amp;gt;Shoot&amp;lt;/strong&amp;gt; button appropriately.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot;&amp;gt;&lt;br /&gt;
restart = Qt::PushButton.new(tr('&amp;amp;New Game'))&lt;br /&gt;
restart.setFont(Qt::Font.new('Times', 18, Qt::Font::Bold))&lt;br /&gt;
&lt;br /&gt;
connect(restart, SIGNAL('clicked()'), self, SLOT('newGame()'))&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We create, set up, and connect the &amp;lt;strong&amp;gt;New Game&amp;lt;/strong&amp;gt; button as we have done with the other buttons. Clicking this button will activate the '''&amp;lt;tt&amp;gt;newGame()&amp;lt;/tt&amp;gt;''' slot in this widget.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot;&amp;gt;&lt;br /&gt;
@hits = Qt::LCDNumber.new(2)&lt;br /&gt;
@shotsLeft = Qt::LCDNumber.new(2)&lt;br /&gt;
hitsLabel = Qt::Label.new(tr('HITS'))&lt;br /&gt;
shotsLeftLabel = Qt::Label.new(tr('SHOTS LEFT'))&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We create four new widgets, to display the number of hits and shots left.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot;&amp;gt;&lt;br /&gt;
topLayout = Qt::HBoxLayout.new()&lt;br /&gt;
topLayout.addWidget(shoot)&lt;br /&gt;
topLayout.addWidget(@hits)&lt;br /&gt;
topLayout.addWidget(hitsLabel)&lt;br /&gt;
topLayout.addWidget(@shotsLeft)&lt;br /&gt;
topLayout.addWidget(shotsLeftLabel)&lt;br /&gt;
topLayout.addStretch(1)&lt;br /&gt;
topLayout.addWidget(restart)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The top-right cell of the [http://doc.qt.nokia.com/latest/qgridlayout.html Qt::GridLayout] is starting to get crowded. We put a stretch just to the left of the &amp;lt;strong&amp;gt;New Game&amp;lt;/strong&amp;gt; button to ensure that this button will always appear on the right side of the window.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot;&amp;gt;&lt;br /&gt;
    newGame()&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We're all done constructing the '''&amp;lt;tt&amp;gt;GameBoard&amp;lt;/tt&amp;gt;''', so we start it all using '''&amp;lt;tt&amp;gt;newGame()&amp;lt;/tt&amp;gt;'''. Although '''&amp;lt;tt&amp;gt;newGame()&amp;lt;/tt&amp;gt;''' is a slot, it can also be used as an ordinary function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot;&amp;gt;&lt;br /&gt;
def fire()&lt;br /&gt;
  if @cannonField.gameOver() || @cannonField.isShooting()&lt;br /&gt;
    return&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  @shotsLeft.display(@shotsLeft.intValue() - 1)&lt;br /&gt;
  @cannonField.shoot()&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This function fires a shot. If the game is over or if there is a shot in the air, we return immediately. We decrement the number of shots left and tell the cannon to shoot.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot;&amp;gt;&lt;br /&gt;
def hit()&lt;br /&gt;
  @hits.display(@hits.intValue() + 1)&lt;br /&gt;
&lt;br /&gt;
  if @shotsLeft.intValue() == 0&lt;br /&gt;
    @cannonField.setGameOver()&lt;br /&gt;
  else&lt;br /&gt;
    @cannonField.newTarget()&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This slot is activated when a shot has hit the target. We increment the number of hits. If there are no shots left, the game is over. Otherwise, we make the '''&amp;lt;tt&amp;gt;CannonField&amp;lt;/tt&amp;gt;''' generate a new target.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot;&amp;gt;&lt;br /&gt;
def missed()&lt;br /&gt;
  if @shotsLeft.intValue() == 0&lt;br /&gt;
    @cannonField.setGameOver()&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This slot is activated when a shot has missed the target. If there are no shots left, the game is over.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot;&amp;gt;&lt;br /&gt;
def newGame()&lt;br /&gt;
  @shotsLeft.display(15)&lt;br /&gt;
  @hits.display(0)&lt;br /&gt;
  @cannonField.restartGame()&lt;br /&gt;
  @cannonField.newTarget()&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This slot is activated when the user clicks the &amp;lt;strong&amp;gt;New Game&amp;lt;/strong&amp;gt; button. It is also called from the constructor. First it sets the number of shots to 15. Note that this is the only place in the program where we set the number of shots. Change it to whatever you like to change the game rules. Next we reset the number of hits, restart the game, and generate a new target.&lt;br /&gt;
&lt;br /&gt;
'''[http://www.darshancomputing.com/qt4-qtruby-tutorial/tutorial/t13/t13.rb t13.rb]'''&lt;br /&gt;
&lt;br /&gt;
This file has just been on a diet. '''&amp;lt;tt&amp;gt;MyWidget&amp;lt;/tt&amp;gt;''' is gone, and the only thing left is the '''&amp;lt;tt&amp;gt;main()&amp;lt;/tt&amp;gt;''' function, unchanged except for the name change.&lt;br /&gt;
&lt;br /&gt;
=== Running the Application ===&lt;br /&gt;
&lt;br /&gt;
The cannon can shoot at a target; a new target is automatically created when one has been hit.&lt;br /&gt;
&lt;br /&gt;
Hits and shots left are displayed and the program keeps track of them. The game can end, and there's a button to start a new game.&lt;br /&gt;
&lt;br /&gt;
=== Exercises ===&lt;br /&gt;
&lt;br /&gt;
Add a random wind factor and show it to the user.&lt;br /&gt;
&lt;br /&gt;
Make some splatter effects when the shot hits the target.&lt;br /&gt;
&lt;br /&gt;
Implement multiple targets.&lt;br /&gt;
&lt;br /&gt;
[[Category:Ruby]]&lt;/div&gt;</summary>
		<author><name>Centerlink</name></author>	</entry>

	</feed>