<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>GameMaker.it &#187; Ruby</title>
	<atom:link href="http://www.gamemaker.it/blog/category/prog/ruby/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.gamemaker.it/blog</link>
	<description>Creazione di Videogiochi in 2D</description>
	<lastBuildDate>Sat, 16 Jan 2010 03:54:00 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Gosu: Mostrare una Immagine</title>
		<link>http://www.gamemaker.it/blog/2009/11/22/gosu-mostrare-un-immagine/</link>
		<comments>http://www.gamemaker.it/blog/2009/11/22/gosu-mostrare-un-immagine/#comments</comments>
		<pubDate>Sat, 21 Nov 2009 23:53:58 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Programmazione]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Gosu]]></category>

		<guid isPermaLink="false">http://www.gamemaker.it/blog/?p=25</guid>
		<description><![CDATA[Nella cartella del nostro progetto creaiamo una cartella di nome img ed inseriamo al suo interno un file PNG di nome sfondo.png di dimensioni 640&#215;480 (può essere quello che volete, anche uno scarabocchio in paint  )
E&#8217; molto semplice caricare e mostrare una immagine a schermo, bastano due semplici comandi!
Prendiamo ...]]></description>
			<content:encoded><![CDATA[<p>Nella cartella del nostro progetto creaiamo una cartella di nome img ed inseriamo al suo interno un file PNG di nome sfondo.png di dimensioni 640&#215;480 (può essere quello che volete, anche uno scarabocchio in paint <img src='http://www.gamemaker.it/blog/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> )<br />
E&#8217; molto semplice caricare e mostrare una immagine a schermo, bastano due semplici comandi!</p>
<p>Prendiamo Esempio1.rb creato in precedenza come base e creiamo </p>
<p><strong>Esempio2.rb</strong></p>
<div class="codecolorer-container ruby blackboard" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><div class="ruby codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color:#9966CC; font-weight:bold;">begin</span><br />
&nbsp; <span style="color:#008000; font-style:italic;"># Se hai installato Gosu da Rubygems</span><br />
&nbsp; <span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'rubygems'</span><br />
<span style="color:#9966CC; font-weight:bold;">rescue</span> <span style="color:#CC00FF; font-weight:bold;">LoadError</span><br />
&nbsp; <span style="color:#008000; font-style:italic;"># Altrimenti</span><br />
<span style="color:#9966CC; font-weight:bold;">end</span><br />
<span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'gosu'</span><br />
<br />
<span style="color:#9966CC; font-weight:bold;">class</span> GameWindow <span style="color:#006600; font-weight:bold;">&lt;</span> <span style="color:#6666ff; font-weight:bold;">Gosu::Window</span><br />
&nbsp; <span style="color:#9966CC; font-weight:bold;">def</span> initialize<br />
&nbsp; &nbsp; <span style="color:#9966CC; font-weight:bold;">super</span><span style="color:#006600; font-weight:bold;">&#40;</span>640,480,<span style="color:#0000FF; font-weight:bold;">false</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#008000; font-style:italic;">#(width,height, fullscreen)</span><br />
&nbsp; &nbsp; <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">caption</span> = <span style="color:#996600;">&quot;Gioco 1&quot;</span> <span style="color:#008000; font-style:italic;">#titolo dell'applicazione</span><br />
&nbsp; &nbsp; <span style="color:#0066ff; font-weight:bold;">@image</span> = <span style="color:#6666ff; font-weight:bold;">Gosu::Image</span>.<span style="color:#9900CC;">new</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF; font-weight:bold;">self</span>,<span style="color:#996600;">&quot;img/sfondo.png&quot;</span>,<span style="color:#0000FF; font-weight:bold;">false</span><span style="color:#006600; font-weight:bold;">&#41;</span><br />
&nbsp; <span style="color:#9966CC; font-weight:bold;">end</span><br />
&nbsp; <span style="color:#9966CC; font-weight:bold;">def</span> update<br />
&nbsp; <span style="color:#9966CC; font-weight:bold;">end</span><br />
&nbsp; <span style="color:#9966CC; font-weight:bold;">def</span> draw<br />
&nbsp; &nbsp; <span style="color:#0066ff; font-weight:bold;">@image</span>.<span style="color:#9900CC;">draw</span><span style="color:#006600; font-weight:bold;">&#40;</span>0,0,1<span style="color:#006600; font-weight:bold;">&#41;</span><br />
&nbsp; <span style="color:#9966CC; font-weight:bold;">end</span><br />
&nbsp; <span style="color:#9966CC; font-weight:bold;">def</span> button_down<span style="color:#006600; font-weight:bold;">&#40;</span>id<span style="color:#006600; font-weight:bold;">&#41;</span><br />
&nbsp; &nbsp; <span style="color:#008000; font-style:italic;">#se hai premuto Esc</span><br />
&nbsp; &nbsp; <span style="color:#9966CC; font-weight:bold;">if</span> id == <span style="color:#6666ff; font-weight:bold;">Gosu::Button::KbEscape</span> <span style="color:#9966CC; font-weight:bold;">then</span><br />
&nbsp; &nbsp; &nbsp; close <span style="color:#008000; font-style:italic;">#chiude il programma</span><br />
&nbsp; &nbsp; <span style="color:#9966CC; font-weight:bold;">end</span><br />
&nbsp; <span style="color:#9966CC; font-weight:bold;">end</span><br />
<span style="color:#9966CC; font-weight:bold;">end</span><br />
<br />
window = GameWindow.<span style="color:#9900CC;">new</span><br />
window.<span style="color:#9900CC;">show</span> <span style="color:#008000; font-style:italic;">#avvia il main loop</span></div></div>
]]></content:encoded>
			<wfw:commentRss>http://www.gamemaker.it/blog/2009/11/22/gosu-mostrare-un-immagine/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Introduzione a Ruby e Gosu</title>
		<link>http://www.gamemaker.it/blog/2009/11/21/introduzione-ruby-gosu/</link>
		<comments>http://www.gamemaker.it/blog/2009/11/21/introduzione-ruby-gosu/#comments</comments>
		<pubDate>Sat, 21 Nov 2009 13:18:23 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Programmazione]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Gosu]]></category>

		<guid isPermaLink="false">http://www.gamemaker.it/blog/?p=3</guid>
		<description><![CDATA[Inauguro il blog parlando un po&#8217; di Ruby  
Il Ruby è un linguaggio ad oggetti molto semplice ed ultimamente grazie ai progressi hardware con processori sempre più potenti, sia grazie ad ottimizzazioni software degli interpreti è diventato a tutti gli effetti un linguaggio dignitoso anche per sviluppare applicazioni desktop ...]]></description>
			<content:encoded><![CDATA[<p>Inauguro il blog parlando un po&#8217; di Ruby <img src='http://www.gamemaker.it/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Il Ruby è un linguaggio ad oggetti molto semplice ed ultimamente grazie ai progressi hardware con processori sempre più potenti, sia grazie ad ottimizzazioni software degli interpreti è diventato a tutti gli effetti un linguaggio dignitoso anche per sviluppare applicazioni desktop performanti, in particolare videogiochi 2D.</p>
<p>Quello che mostrerò saranno delle brevi applicazioni di ruby attraverso la libreria <a title="Gosu" href="http://www.libgosu.org/" target="_blank">Gosu</a>.<br />
Gosu è una libreria per creare videogiochi 2D avvalendosi delle OpenGL, utilizzabile sia tramite Ruby che C++.</p>
<p><strong>Installazione</strong></p>
<ul>
<li>Scaricare ed installare <a title="Ruby 1.86 Windows" href="http://rubyforge.org/frs/download.php/47082/ruby186-27_rc2.exe" target="_blank">Ruby 1.86 One Click Installer</a> su Windows oppure su Linux Debian-based digitare nella bash
<div class="codecolorer-container bash blackboard" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp;<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> ruby irb rdoc</div></div>
</li>
<li>Scaricare <a title="Gosu for Windows 0.7.15" href="http://gosu.googlecode.com/files/gosu-windows-ruby-0.7.15.zip" target="_blank">Gosu Windows Ruby</a> oppure i sorgenti da compilare se siete su Linux <a title="Gosu Source 0.7.15" href="http://gosu.googlecode.com/files/gosu-source-0.7.15.tar.gz" target="_blank">Gosu Source</a></li>
<li>Su Windows copia il contenuto della cartella lib nella directory del tuo progetto es. C:\ruby\giochi</li>
<li>Creare il file Esempio1.rb nella suddetta cartella, scriverci dentro il codice seguente ed avviarlo <img src='http://www.gamemaker.it/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </li>
</ul>
<p><strong>Esempio1.rb</strong></p>
<div class="codecolorer-container ruby blackboard" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><div class="ruby codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color:#9966CC; font-weight:bold;">begin</span><br />
&nbsp; <span style="color:#008000; font-style:italic;"># Se hai installato Gosu da Rubygems</span><br />
&nbsp; <span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'rubygems'</span><br />
<span style="color:#9966CC; font-weight:bold;">rescue</span> <span style="color:#CC00FF; font-weight:bold;">LoadError</span><br />
&nbsp; <span style="color:#008000; font-style:italic;"># Altrimenti</span><br />
<span style="color:#9966CC; font-weight:bold;">end</span><br />
<span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'gosu'</span><br />
<br />
<span style="color:#9966CC; font-weight:bold;">class</span> GameWindow <span style="color:#006600; font-weight:bold;">&lt;</span> <span style="color:#6666ff; font-weight:bold;">Gosu::Window</span><br />
&nbsp; <span style="color:#9966CC; font-weight:bold;">def</span> initialize<br />
&nbsp; &nbsp; <span style="color:#9966CC; font-weight:bold;">super</span><span style="color:#006600; font-weight:bold;">&#40;</span>640,480,<span style="color:#0000FF; font-weight:bold;">false</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#008000; font-style:italic;">#(width,height, fullscreen)</span><br />
&nbsp; &nbsp; <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">caption</span> = <span style="color:#996600;">&quot;Gioco 1&quot;</span> <span style="color:#008000; font-style:italic;">#titolo</span><br />
&nbsp; <span style="color:#9966CC; font-weight:bold;">end</span><br />
&nbsp; <span style="color:#9966CC; font-weight:bold;">def</span> update<br />
&nbsp; <span style="color:#9966CC; font-weight:bold;">end</span><br />
&nbsp; <span style="color:#9966CC; font-weight:bold;">def</span> draw<br />
&nbsp; <span style="color:#9966CC; font-weight:bold;">end</span><br />
&nbsp; <span style="color:#9966CC; font-weight:bold;">def</span> button_down<span style="color:#006600; font-weight:bold;">&#40;</span>id<span style="color:#006600; font-weight:bold;">&#41;</span><br />
&nbsp; &nbsp; <span style="color:#008000; font-style:italic;">#se hai premuto Esc</span><br />
&nbsp; &nbsp; <span style="color:#9966CC; font-weight:bold;">if</span> id == <span style="color:#6666ff; font-weight:bold;">Gosu::Button::KbEscape</span> <span style="color:#9966CC; font-weight:bold;">then</span><br />
&nbsp; &nbsp; &nbsp; close <span style="color:#008000; font-style:italic;">#chiude il programma</span><br />
&nbsp; &nbsp; <span style="color:#9966CC; font-weight:bold;">end</span><br />
&nbsp; <span style="color:#9966CC; font-weight:bold;">end</span><br />
<span style="color:#9966CC; font-weight:bold;">end</span><br />
<br />
window = GameWindow.<span style="color:#9900CC;">new</span><br />
window.<span style="color:#9900CC;">show</span> <span style="color:#008000; font-style:italic;">#avvia il main loop</span></div></div>
<p>Per ulteriori spiegazioni sono qui <img src='http://www.gamemaker.it/blog/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.gamemaker.it/blog/2009/11/21/introduzione-ruby-gosu/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
