<?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>CubaGames &#187; SDL</title>
	<atom:link href="http://www.cubagames.com.br/category/sdl/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.cubagames.com.br</link>
	<description>Notícias sobre o mundo dos games, artigos sobre gamedev, reflexões, tutoriais, games e jogos online</description>
	<lastBuildDate>Wed, 01 Feb 2012 16:40:11 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.3</generator>
		<item>
		<title>Tutorial SDL &#8211; Regulando o Processamento e Calculando o Frame Rate</title>
		<link>http://www.cubagames.com.br/tutorial-sdl-regulando-o-processamento-e-calculando-o-frame-rate/</link>
		<comments>http://www.cubagames.com.br/tutorial-sdl-regulando-o-processamento-e-calculando-o-frame-rate/#comments</comments>
		<pubDate>Thu, 08 Feb 2007 01:42:13 +0000</pubDate>
		<dc:creator>Romulo De Lazzari</dc:creator>
				<category><![CDATA[Desenvolvimento]]></category>
		<category><![CDATA[SDL]]></category>

		<guid isPermaLink="false">http://www.cubagames.com.br/tutorial-sdl-regulando-o-processamento-e-calculando-o-frame-rate/</guid>
		<description><![CDATA[<p>Você que tem acompanhado os tutoriais de SDL da CubaGames deve ter notado que quando roda alguma aplicação o processador vai a 100% e fica lá em cima enquanto o programa está rodando. "Nooossa ele roda algum 3D pesadíssimo?!" você pode pensar. Não, um jogo é simplesmente um loop infinito esperando que você entre com algum comando para ser executado.</p>
<p><img src="http://www.cubagames.com.br/wp-content/uploads/2007/02/tuto_sdl.JPG" alt="tuto_sdl.JPG" id="image204" /><br />
Nesse tópico do tutorial, eu vou corrigir isso calculando o "Frame Rate" (quadros por segundo), ou seja, quantas vezes por segundo o programa executa alguma coisa. Vou pegar de exemplo o <a href="http://www.cubagames.com.br/wp-content/uploads/2006/12/parte5.zip">programinha de Timers do último post de SDL</a>.</p>
<p>Usaremos o mesmo código, mas adicionaremos uma variável que contém o número de frames por segundo que o jogo terá:</p>
<div class="igBar"><span id="lcpp-1"><a href="#" onclick="javascript:showPlainTxt('cpp-1'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">C++:</span>
<div id="cpp-1">
<div class="cpp">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #ff0000;">//A estrutura que usaremos para capturarmos os eventos</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">SDL_Event evento;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #ff0000;">//A fonte que será usada</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">TTF_Font *fonte = <span style="color: #0000ff;">NULL</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #ff0000;">//A cor da fonte</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">SDL_Color cor = <span style="color: #000000;">&#123;</span> <span style="color: #0000dd;color:#800000;">255</span>, <span style="color: #0000dd;color:#800000;">255</span>, <span style="color: #0000dd;color:#800000;">255</span> <span style="color: #000000;">&#125;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #ff0000;">//frames por segundo</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">int</span> framesPorSegundo = <span style="color: #0000dd;color:#800000;">20</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>No final do nosso loop principal vamos adicionar a função SDL_Delay(), essa função faz o programa "dormir" e libera o processamento para outros programas que estejam rodando concorrentemente, ela tem como parâmetro o número de milissegundos que você deseja que ele durma.</p>
<p>No nosso caso usaremos:</p>
<div class="igBar"><span id="lcpp-2"><a href="#" onclick="javascript:showPlainTxt('cpp-2'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">C++:</span>
<div id="cpp-2">
<div class="cpp">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #ff0000;">//dorme o tempo necessário, 1000 milissegundos = 1 segundo (err ;D) divididos pelo numero de frames</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #ff0000;">//que nós desejamos para o nosso programa</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">SDL_Delay<span style="color: #000000;">&#40;</span> <span style="color: #0000dd;color:#800000;">1000</span> / framesPorSegundo <span style="color: #000000;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Assim o programa diminuirá drásticamente a porcentagem de uso do processador.</p>
<p><img src="http://www.cubagames.com.br/wp-content/uploads/2007/02/tuto_sdl2.JPG" alt="tuto_sdl2.JPG" id="image202" /><br />
Segue o link com o <a href="http://www.cubagames.com.br/wp-content/uploads/2007/02/parte5_2_temporizador.zip">fonte do programa</a>. Alguma Dúvida, crítica ou sugestão?</p>
]]></description>
		<wfw:commentRss>http://www.cubagames.com.br/tutorial-sdl-regulando-o-processamento-e-calculando-o-frame-rate/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tutorial SDL &#8211; Timers</title>
		<link>http://www.cubagames.com.br/tutorial-sdl-timers/</link>
		<comments>http://www.cubagames.com.br/tutorial-sdl-timers/#comments</comments>
		<pubDate>Fri, 22 Dec 2006 03:24:10 +0000</pubDate>
		<dc:creator>Romulo De Lazzari</dc:creator>
				<category><![CDATA[Desenvolvimento]]></category>
		<category><![CDATA[SDL]]></category>

		<guid isPermaLink="false">http://www.cubagames.com.br/tutorial-sdl-timers/</guid>
		<description><![CDATA[<p>Saber gerenciar o tempo em um jogo é fundamental. Essa parte não é lá muito legal, mas é essencial para qualquer jogo!</p>
<p><a href="http://www.cubagames.com.br/tutorial-sdl-parte-5-timers/">Link aqui</a>!</p>
<p>Bom, espero que o papai noel seja bondoso com todos nesse Natal!</p>
<p>Eu quero meu Wii <img src='http://www.cubagames.com.br/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> !</p>
]]></description>
		<wfw:commentRss>http://www.cubagames.com.br/tutorial-sdl-timers/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Tutorial SDL &#8211; Fontes True Type</title>
		<link>http://www.cubagames.com.br/tutorial-sdl-fontes-true-type/</link>
		<comments>http://www.cubagames.com.br/tutorial-sdl-fontes-true-type/#comments</comments>
		<pubDate>Tue, 19 Dec 2006 04:08:53 +0000</pubDate>
		<dc:creator>Romulo De Lazzari</dc:creator>
				<category><![CDATA[Desenvolvimento]]></category>
		<category><![CDATA[SDL]]></category>

		<guid isPermaLink="false">http://www.cubagames.com.br/tutorial-sdl-fontes-true-type/</guid>
		<description><![CDATA[<p>Depois de um tempo sem postar aqui, aqui está mais uma parte do tutorial SDL, muito fácil e gostoso de fazer.</p>
<p>Acesse o tutorial <a href="http://www.cubagames.com.br/tutorial-sdl-parte-4-fontes-true-type/">através deste link</a>.</p>
<p>Qualquer dúvida, crítica ou sugestão mandem um comentário.</p>
<p>Abraços <img src='http://www.cubagames.com.br/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></description>
		<wfw:commentRss>http://www.cubagames.com.br/tutorial-sdl-fontes-true-type/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SDL &#8211; parte 3,5 &#8211; Eventos, detectar quando as teclas forem pressionadas</title>
		<link>http://www.cubagames.com.br/sdl-parte-35-eventos-detectar-quando-as-teclas-forem-pressionadas/</link>
		<comments>http://www.cubagames.com.br/sdl-parte-35-eventos-detectar-quando-as-teclas-forem-pressionadas/#comments</comments>
		<pubDate>Fri, 01 Dec 2006 14:27:09 +0000</pubDate>
		<dc:creator>Romulo De Lazzari</dc:creator>
				<category><![CDATA[Desenvolvimento]]></category>
		<category><![CDATA[SDL]]></category>

		<guid isPermaLink="false">http://www.cubagames.com.br/sdl-parte-35-eventos-detectar-quando-as-teclas-forem-pressionadas/</guid>
		<description><![CDATA[<p>Agora vamos ver como a SDL detecta as entradas do teclado. Pessoalmente, essa é a parte mais legal de se fazer jogos! Ver funcionar o que você faz é muito legal <img src='http://www.cubagames.com.br/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> !</p>
<p><a href="http://www.cubagames.com.br/tutorial-sdl-parte-35-eventos-detectar-quando-as-teclas-forem-pressionadas/">Aqui está o link para esse tutorial!</a></p>
<p>Abraços a todos!</p>
]]></description>
		<wfw:commentRss>http://www.cubagames.com.br/sdl-parte-35-eventos-detectar-quando-as-teclas-forem-pressionadas/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>SDL &#8211; parte 3 &#8211; Eventos, uma pequena introdução</title>
		<link>http://www.cubagames.com.br/sdl-parte-3-eventos-uma-pequena-introducao/</link>
		<comments>http://www.cubagames.com.br/sdl-parte-3-eventos-uma-pequena-introducao/#comments</comments>
		<pubDate>Sun, 26 Nov 2006 15:31:42 +0000</pubDate>
		<dc:creator>Romulo De Lazzari</dc:creator>
				<category><![CDATA[Desenvolvimento]]></category>
		<category><![CDATA[SDL]]></category>

		<guid isPermaLink="false">http://www.cubagames.com.br/sdl-parte-3-eventos-uma-pequena-introducao/</guid>
		<description><![CDATA[<p>Está no ar a terceira parte desse nosso tutorial de SDL! Está muito legal e bem simples de fazer!</p>
<p><a href="http://www.cubagames.com.br/tutorial-sdl-parte-3-eventos-uma-pequena-introducao/">Clique aqui para acessá-lo</a>.</p>
<p>Comentários são bem-vindos para qualquer dúvida, crítica ou sugestão.</p>
<p>Abraços <img src='http://www.cubagames.com.br/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> !</p>
]]></description>
		<wfw:commentRss>http://www.cubagames.com.br/sdl-parte-3-eventos-uma-pequena-introducao/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SDL &#8211; parte 2,5 &#8211; Carregando uma imagens de outros formatos</title>
		<link>http://www.cubagames.com.br/sdl-parte-25-carregando-uma-imagens-de-outros-formatos/</link>
		<comments>http://www.cubagames.com.br/sdl-parte-25-carregando-uma-imagens-de-outros-formatos/#comments</comments>
		<pubDate>Wed, 22 Nov 2006 02:55:02 +0000</pubDate>
		<dc:creator>Romulo De Lazzari</dc:creator>
				<category><![CDATA[Desenvolvimento]]></category>
		<category><![CDATA[SDL]]></category>

		<guid isPermaLink="false">http://www.cubagames.com.br/sdl-parte-25-carregando-uma-imagens-de-outros-formatos/</guid>
		<description><![CDATA[<p>Vou continuar falando sobre o assunto "carregar imagens", só que agora vamos carregar imagens de outros formatos!</p>
<p><a href="http://www.cubagames.com.br/tutorial-sdl-parte-25-carregando-imagens-de-outros-formatos/">O link para este tutorial está aqui</a>!</p>
<p>Dúvidas/sugestões/críticas? Comentem <img src='http://www.cubagames.com.br/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> !</p>
<p>Abraços!</p>
]]></description>
		<wfw:commentRss>http://www.cubagames.com.br/sdl-parte-25-carregando-uma-imagens-de-outros-formatos/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SDL &#8211; parte 2 &#8211; Carregando uma imagem na tela</title>
		<link>http://www.cubagames.com.br/sdl-parte-2-carregando-uma-imagem-na-tela/</link>
		<comments>http://www.cubagames.com.br/sdl-parte-2-carregando-uma-imagem-na-tela/#comments</comments>
		<pubDate>Wed, 15 Nov 2006 04:16:26 +0000</pubDate>
		<dc:creator>Romulo De Lazzari</dc:creator>
				<category><![CDATA[Desenvolvimento]]></category>
		<category><![CDATA[SDL]]></category>

		<guid isPermaLink="false">http://www.cubagames.com.br/sdl-parte-2-carregando-uma-imagem-na-tela/</guid>
		<description><![CDATA[<p>Continuando como tutorial SDL, vamos aprender a carregar um bitmap (.bmp) na tela.</p>
<p><a href="http://www.cubagames.com.br/tutorial-sdl-parte-2-carregando-imagens-na-tela/">Para acessá-lo é só clicar aqui</a>.</p>
<p>No próximo capítulo, irei mostrar como funciona a parte de eventos! Opiniões/Críticas/Sugestões são bem vindas <img src='http://www.cubagames.com.br/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> !</p>
<p>Abraço!</p>
]]></description>
		<wfw:commentRss>http://www.cubagames.com.br/sdl-parte-2-carregando-uma-imagem-na-tela/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>SDL &#8211; parte 1,5 &#8211; Um Pouco de Conceito</title>
		<link>http://www.cubagames.com.br/sdl-parte-15-um-pouco-de-conceito/</link>
		<comments>http://www.cubagames.com.br/sdl-parte-15-um-pouco-de-conceito/#comments</comments>
		<pubDate>Mon, 13 Nov 2006 21:34:25 +0000</pubDate>
		<dc:creator>Romulo De Lazzari</dc:creator>
				<category><![CDATA[Desenvolvimento]]></category>
		<category><![CDATA[SDL]]></category>

		<guid isPermaLink="false">http://www.cubagames.com.br/sdl-parte-15-um-pouco-de-conceito/</guid>
		<description><![CDATA[<p>Como prometido, estarei fazendo um jogo "simples" ao decorrer dos posts. Montei um pequeno <a href="http://www.cubagames.com.br/design-document/">Design Document</a> com algumas informações do jogo. <a href="http://www.cubagames.com.br/roteiros-de-jogos-parte-1/">Uma pequena história</a>, o estilo de jogo e algumas características. Muitas coisas estão ainda por fazer, mas já é um ponto de partida!</p>
<p><a href="http://www.cubagames.com.br/wp-content/uploads/2006/11/dd_tuto_sdl.pdf">Clique aqui</a>  para ler o Design Document.</p>
<p>Sugestões, opiniões e críticas são bem-vindas nos comentários <img src='http://www.cubagames.com.br/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> . Amanhã estará no ar a 2° parte do tutorial!</p>
<p>Abraços</p>
]]></description>
		<wfw:commentRss>http://www.cubagames.com.br/sdl-parte-15-um-pouco-de-conceito/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>SDL &#8211; parte 1 &#8211; Instalação e Configuração</title>
		<link>http://www.cubagames.com.br/sdl-parte-1-instalacao-e-configuracao/</link>
		<comments>http://www.cubagames.com.br/sdl-parte-1-instalacao-e-configuracao/#comments</comments>
		<pubDate>Tue, 07 Nov 2006 22:08:37 +0000</pubDate>
		<dc:creator>Romulo De Lazzari</dc:creator>
				<category><![CDATA[Desenvolvimento]]></category>
		<category><![CDATA[SDL]]></category>

		<guid isPermaLink="false">http://www.cubagames.com.br/sdl-parte-1-instalacao-e-configuracao/</guid>
		<description><![CDATA[<p>Agora é pra valer, começaremos o tutorial sobre SDL aqui no blog da CubaGames, a primeira parte está pronta (muitas outras virão), gostaria de saber o feedback de vocês aqui nos comentários, eles serão muito bem vindos para as próximas partes do Tutorial.</p>
<p><a href="http://www.cubagames.com.br/tutorial-sdl-parte-1-instalando-e-configurando-a-sdl/">Clique aqui para acessar a página da primeira lição do Tutorial SDL.</a></p>
<p>Abraços.</p>
]]></description>
		<wfw:commentRss>http://www.cubagames.com.br/sdl-parte-1-instalacao-e-configuracao/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>SDL &#8211; Simple Directmedia Layer &#8211; Introdução</title>
		<link>http://www.cubagames.com.br/sdl-simple-directmedia-layer-introducao/</link>
		<comments>http://www.cubagames.com.br/sdl-simple-directmedia-layer-introducao/#comments</comments>
		<pubDate>Wed, 01 Nov 2006 01:14:19 +0000</pubDate>
		<dc:creator>Romulo De Lazzari</dc:creator>
				<category><![CDATA[Desenvolvimento]]></category>
		<category><![CDATA[SDL]]></category>

		<guid isPermaLink="false">http://www.cubagames.com.br/sdl-simple-directmedia-layer-introducao/</guid>
		<description><![CDATA[<p>A partir de hoje, postarei sobre a SDL, uma biblioteca que provê acesso ao video, audio, teclado, mouse, etc, enfim, ajuda no desenvolvimento de jogos plataforma. Ela foi feita em C, mas suporta jogos em C++. <a title="SDL" href="http://www.libsdl.org/index.php">Acesse o site oficial da SDL aqui</a>.</p>
<p>A vontade de fazer um jogo paralelamente com minhas atividades aqui da CubaGames veio a partir do <a href="http://vinicius.azedume.com/arquivo/review-cave-story-doukutsu-monogatari/">post do Vinícius</a> do <a href="http://vinicius.azedume.com">Oitobits</a>, quando disse que o Cave Story (que estou jogando e gostando)  foi feito apenas por uma pessoa!</p>
<p>Vou começar realmente desde o início, como instalar e configurar a SDL em um sistema windows, e assim começar a desenvolver um joguinho ao longo dos posts (que na verdade nem sei como será <img src='http://www.cubagames.com.br/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> ) o jogo será 2D, e, sim, muito simples (mas vai que um dia com uma encrementada aqui, outra ali, ele não fica bom!). Se vocês tiverem alguma sugestão para o jogo, será bem aceita nos comentários!</p>
<p>Na verdade, nao "criarei" esse tutorial, existe um site em inglês com tutoriais muito bons! Começarei meu joguinho a partir desse site, caso não queira esperar meus posts, acesse-o <a href="http://lazyfooproductions.com/SDL_tutorials/index.php">aqui</a>.</p>
<p>No próximo post sobre SDL, falarei sobre a instalação e a configuração.</p>
]]></description>
		<wfw:commentRss>http://www.cubagames.com.br/sdl-simple-directmedia-layer-introducao/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

