xna scene graph tutorial

On January 7, 2009, in games, programacao, by athanazio
0
Tagged with:
 

c# xna, desenhando o sprite na tela

On January 6, 2009, in games, programacao, by athanazio
0

arre o primeiro sprite na tela a gente nunca esquece !!

olha que belo o codigo !!

using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using Microsoft.Xna.Framework.Net;
using Microsoft.Xna.Framework.Storage;

namespace WindowsGame1
{

public class Game1 : Microsoft.Xna.Framework.Game
{
GraphicsDeviceManager graphics;
SpriteBatch spriteBatch;

Vector2 mPosition = new Vector2(0, 0);

Texture2D mSpriteTexture;

public Game1()
{
graphics = new GraphicsDeviceManager(this);
Content.RootDirectory = “Content”;
}

protected override void Initialize()
{
base.Initialize();
}

protected override void LoadContent()
{
spriteBatch = new SpriteBatch(GraphicsDevice);
mSpriteTexture = this.Content.Load(“alien”);
}

protected override void UnloadContent()
{
}

protected override void Update(GameTime gameTime)
{
// Allows the game to exit
if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
this.Exit();

base.Update(gameTime);
}

protected override void Draw(GameTime gameTime)
{
GraphicsDevice.Clear(Color.CornflowerBlue);

spriteBatch.Begin();
spriteBatch.Draw(mSpriteTexture, mPosition, Color.White);
spriteBatch.End();

base.Draw(gameTime);
}
}
}

Tagged with:
 

c# eita to de volta ao clipper !

On January 5, 2009, in programacao, by athanazio
0

hauhauhuaa lembrei dos meus tempos de clipper summer 87 e os famigerados comandos de posicionamento de cursor na tela e fazer interfaces magicas em modo texto !! veja que legal este experimento de colocar os cursores nos seus lugares !!

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication4
{
class ConsolePosition
{
static void Main(string[] args)
{
Console.Title = “back to clipper summer 87 !!”;
Console.ForegroundColor = ConsoleColor.DarkGreen;
Console.WindowLeft = Console.WindowTop = 0;
Console.WindowHeight = Console.BufferHeight = 30;
Console.WindowWidth = Console.BufferWidth = 80;

int[] numbers = {1,2,3,4,5,6,7};
foreach(int n in numbers){
Console.SetCursorPosition(n,n);
Console.Write(“#”);
}
}
}
}

deu ateh vontade de fazer um joguinho bem bocó de mexer um treco na tela hehehehe

outros exemplos parecidos
http://msdn.microsoft.com/en-us/library/system.console.setwindowposition.aspx
http://nodstrum.com/2007/11/09/matrix-code-in-c/

Tagged with:
 

c# percorrendo matriz

On January 5, 2009, in programacao, by athanazio
0

ao menos duas formas de percorrer uma matriz

using System;

namespace foo
{
class numbersAreGreat{
static void Main (string[] args){
string[] numbers = {“one”, “two”, “three”, “four”, “five”};
if (args.Length > 0)
{
int number = int.Parse(args[0]);
if (number <= 0)
{
Console.WriteLine("please more than zero");
}
else
if (number > numbers.Length)
{
Console.WriteLine(“{0} is greater than we can understand…”, number);
}
else
{
Console.WriteLine(“thanks for the {0} ! “, numbers[number - 1]);
}
}
else
{
Console.WriteLine(“would be a big effort to inform an integer ?”);
}

}
}
}

Tagged with:
 

c# array condições e trecos

On January 5, 2009, in programacao, by athanazio
0

Neste experimento rolou de declarar array inline, fazer teste de parametros da linha de comando, display no console, fomatação de mensagem do tipo printf() que deu pra reparar eh com {0}, que por sinal eh do mesmo jeito nos arquivos de resource do struts, coincidência ? =)

using System;

namespace foo
{
class numbersAreGreat{
static void Main (string[] args){
string[] numbers = {“one”, “two”, “three”, “four”, “five”};
if (args.Length > 0)
{
int number = int.Parse(args[0]);
if (number <= 0)
{
Console.WriteLine("please more than zero");
}
else
if (number > numbers.Length)
{
Console.WriteLine(“{0} is greater than we can understand…”, number);
}
else
{
Console.WriteLine(“thanks for the {0} ! “, numbers[number - 1]);
}
}
else
{
Console.WriteLine(“would be a big effort to inform an integer ?”);
}

}
}
}

Tagged with: