Jump to content

  • Log In with Google      Sign In   
  • Create Account

beatlefan

Member Since 26 May 2011
Offline Last Active Aug 19 2012 05:35 PM

Posts I've Made

In Topic: XNA equivalent of glVertex2f()?

08 February 2012 - 05:58 AM

Those equivalent calls don't exist in xna (im 99% sure). For your case look into VertexPositionColor and DrawUserPrimitives. So its kinda like setting up vertex buffer in OpenGL except you don't use a vertex buffer unless you need/want one.

In Topic: XNA 4.0 organization question

27 August 2011 - 07:05 PM

I am trying to "duplicate" the Draw() method. See how you had to put "enemy.Draw(spriteBatch);" in the Game1 class' Draw() method? Is it possible I can give objects their own Draw() method so that I can draw the graphics IN that object?


No, sometime during your Game1.Draw() the enemy.Draw() function has to be called to be drawn. Now you don't have to make that call directly in the Game1.Draw() function, you can have an EnemyManager class that has a Draw(SpriteBatch) function and in that function you would draw the enemies. Though you would still have to do "enemyManager.Draw(spriteBatch);" in the Game1.Draw() function.

In Topic: XNA 4.0 organization question

27 August 2011 - 06:38 PM

That way each object can draw graphics, instead of just this 1 method. So far, I haven't gotten it to work.


What are you doing?

it looks something like this right?
public class Enemy
{
	//stuff
	public void Draw(SpriteBatch sb)
	{
		sb.Draw(EnemyTexture, Position, Color.White);
	}
}

public class Game1 : Game
{
	//stuff
   protected override Draw(GameTime gameTime)
	{
		GraphicsDevice.Clear(Color.Black);
	
		spriteBatch.Begin();
		enemy.Draw(spriteBatch);
		spriteBatch.End();

         base.Draw(gameTime);
	}
}

In Topic: Starting Language

17 August 2011 - 04:47 PM

take a look at this.

In Topic: keypress speed issues...

16 August 2011 - 07:13 PM

Thank you for your reply, but, isn't that what I'm doing? Am I missing something?


What your doing is checking if the key is down. You want to check for key down events, which have a built in delay. So where you have your

if (msg.message == WM_QUIT)

you will want to add a

else if(msg.message == WM_KEYDOWN)

and if that's true check which key is down and move your tetris pieces.

PARTNERS