XNA Game Development Forums
2012/05/21 19:01:00 *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   Home   Help Search Calendar Login Register  
Pages: [1] 2 3
  Print  
Author Topic: Tutorial 1 :: Introduction to the XNA Framework  (Read 12695 times)
mikeschuld
Administrator
Sr. Member
*****
Offline Offline

Posts: 389


View Profile WWW
« on: 2006/08/30 19:51:08 »

Just thought I'd make a group for each tutorial in the forums. Might be a good idea instead of having comments on them on the blog side.
« Last Edit: 2006/11/30 05:53:08 by mikeschuld » Logged
elwolv
Newbie
*
Offline Offline

Posts: 1


View Profile
« Reply #1 on: 2006/09/02 08:53:19 »

I did see your first program, thanks
i was looking for information on the GUI/Controls for use in XNA. i did not find any in the Documentation?

my interest is not in games but managed Directx=XNA for CAD like application. 

where are those topics in the XNA SDK documentation?

thanks
Logged
Chr0n1x
Global Moderator
Sr. Member
*****
Offline Offline

Posts: 307


View Profile WWW
« Reply #2 on: 2006/09/02 21:26:34 »

For XNA a GUI must be created yourself or you can dl a component created by someone else. I think I saw one before somewhere.
If you use MDX1.1 you can create an application which puts the DirectX into a WinForms control like Mike does in his HMSceneEditor.

So if you want to use XNA, you will have to get/create your own GUI. (At least for now)
Logged

mikeschuld
Administrator
Sr. Member
*****
Offline Offline

Posts: 389


View Profile WWW
« Reply #3 on: 2006/09/04 16:45:21 »

So, I changed the method of architecting the tutorials to use GameComponents through the GUI in Visual Studio instead of just handling everything within the code. This should make things a lot nicer later on when we want to add in things like the physics engine and a GUI. Now I just have to make all the components play together nicely so they are simple drag and drop functionality additions. Shouldn't be too hard if you ask me.
Logged
Chr0n1x
Global Moderator
Sr. Member
*****
Offline Offline

Posts: 307


View Profile WWW
« Reply #4 on: 2006/09/04 22:46:23 »

I really^5 like the new component system, and the integration into the graphical designer is wondrous! Really makes it much easier to make games. Now you can release all of the parts as component code and we can just plug it in Wink Great for the extra addons as well. Cheesy
Logged

mikeschuld
Administrator
Sr. Member
*****
Offline Offline

Posts: 389


View Profile WWW
« Reply #5 on: 2006/09/05 02:34:25 »

Haha, I would have liked it better had I played ith it for longer before writing the first tutorial. I am going to once again change it after I get through working on tutorial 2 tonight because of a bit of moving around of code that I should have done in the first one without realizing what it would cause later (guess that's what I get for using a new architecture blindly). At any rate. I think I got it how I will end up with it since it is actually a cross now between the GameComponents method and the MDX version of the engine. Guess we'll see.
« Last Edit: 2006/10/22 20:35:26 by mikeschuld » Logged
tyetheczar
Newbie
*
Offline Offline

Posts: 1


View Profile
« Reply #6 on: 2006/11/26 10:32:27 »

My problem came after it saidWe will also want to add the HMEngine as a Reference to the demo project, so right click ?References? and choose ?Add Reference?. Then, on the Projects tab, double click the engine project. For the last step, right click the demo project and set it as the startup project so when we click the Debug button it will look in that project for Main() and not in our engine (since the engine is a class library and should have no Main). Now we are ready to start getting into some code! When I click on Add Reference's
Projects tab, I don't see anything there Huh! HELP Embarrassed
Logged
jadams
Newbie
*
Offline Offline

Posts: 14


View Profile
« Reply #7 on: 2006/11/26 12:53:28 »

Tye,

Make sure you ahve two projects in the solution explorer in C# Express. You want to run/edit both projects from the same instance. When you right-click the HHMDemo's Reference select Add Reference. In the new window, make sure you select the projects tab. You should just see one, the HMEngine. If you don't see it, both projects are not loaded in the IDE simultaneously. 
« Last Edit: 2007/01/07 03:35:34 by mikeschuld » Logged
vogelmann
Newbie
*
Offline Offline

Posts: 4


View Profile
« Reply #8 on: 2007/01/07 13:16:25 »

ya, I notice that when i type in this code here for tutorial 1
Code:
public HMGame() { 
myGraphics = new GraphicsDeviceManager(this);

Window.AllowUserResizing = true;
Window.ClientSizeChanged += new System.EventHandler(Window_ClientSizeChanged);
}

void Window_ClientSizeChanged(object sender, System.EventArgs e) {
myGraphics.PreferredBackBufferWidth = Window.ClientBounds.Width;
myGraphics.PreferredBackBufferHeight = Window.ClientBounds.Height;
}

I get errors at GraphicsDeviceManager, at HMGame, and at System. All the errors are Expected class, delegate, enum, interface or struct. Any help on this would be appreciated
Logged
mikeschuld
Administrator
Sr. Member
*****
Offline Offline

Posts: 389


View Profile WWW
« Reply #9 on: 2007/01/07 17:20:18 »

are you typing that code inside the HMGame class? that is where it belongs.
Logged
vogelmann
Newbie
*
Offline Offline

Posts: 4


View Profile
« Reply #10 on: 2007/01/10 15:04:14 »

Yes, I am typing that in the HMGame class
Here is the code for HMGame that I have written
Code:
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace TPEngine
{
    public class TPGame : Game
    {
    }
}
public class TPGame : Game
{
    GraphicsDeviceManager myGraphics;

    public TPGame()
    {
        myGraphics = new GraphicsDeviceManager(this);
    }

    protected override void Draw(GameTime gameTime)
    {
        myGraphics.GraphicsDevice.Clear(Color.CornflowerBlue); base.Draw(gameTime);
    }
}
public TPGame() {
    myGraphics = new GraphicsDeviceManager(this);
    Window.AllowUserResizing = true;
    Window.ClientSizeChanged += new System.EventHandler(Window_ClientSizeChanged);
}

void Window_ClientSizeChanged(object sender, System.EventArgs e) {
    myGraphics.PreferredBackBufferWidth = Window.ClientBounds.Width;
    myGraphics.PreferredBackBufferHeight = Window.ClientBounds.Height;
}
« Last Edit: 2007/01/10 15:06:59 by vogelmann » Logged
Nemo Krad
Global Moderator
Hero Member
*****
Offline Offline

Posts: 512


I have seen the fnords


View Profile WWW
« Reply #11 on: 2007/01/10 16:38:32 »

You have to keep the class inside the namespace scope.

rearrange it like this:
Code:
namespace TPEngine
{
    public class TPGame : Game
    {
        GraphicsDeviceManager myGraphics;


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

        public TPGame()
        {
            myGraphics = new GraphicsDeviceManager(this);
            Window.AllowUserResizing = true;
            Window.ClientSizeChanged += new System.EventHandler(Window_ClientSizeChanged);
        }

        void Window_ClientSizeChanged(object sender, System.EventArgs e)
        {
            myGraphics.PreferredBackBufferWidth = Window.ClientBounds.Width;
            myGraphics.PreferredBackBufferHeight = Window.ClientBounds.Height;
        }
    }
}

You seem to be not reading the tutorial between code segments as you had 2 constructors in there.
Some code examples are replacements for earlier examples.
« Last Edit: 2007/01/10 16:43:31 by Nemo Krad » Logged
ericc59
Jr. Member
**
Offline Offline

Posts: 50


View Profile
« Reply #12 on: 2007/01/10 16:42:19 »

Quote
public TPGame() {
    myGraphics = new GraphicsDeviceManager(this);
    Window.AllowUserResizing = true;
    Window.ClientSizeChanged += new System.EventHandler(Window_ClientSizeChanged);
}
This should replace the other TPGame() function you have inside the TPGame class.

Quote
void Window_ClientSizeChanged(object sender, System.EventArgs e) {
    myGraphics.PreferredBackBufferWidth = Window.ClientBounds.Width;
      myGraphics.PreferredBackBufferHeight = Window.ClientBounds.Height;
}
This should go inside the TPGame class with the rest of the functions. 

The class needs to be inside the Namespace TPEngine {}  brackets.  And the functions for that class need to be inside that classes brackets.  That is why you are getting those errors.

So it should instead look like this:

Quote
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace TPEngine
{

    public class TPGame : Game
    {
        GraphicsDeviceManager myGraphics;

        public TPGame() {
            myGraphics = new GraphicsDeviceManager(this);
            Window.AllowUserResizing = true;
            Window.ClientSizeChanged += new System.EventHandler(Window_ClientSizeChanged);
        }

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

        void Window_ClientSizeChanged(object sender, System.EventArgs e) {
            myGraphics.PreferredBackBufferWidth = Window.ClientBounds.Width;
            myGraphics.PreferredBackBufferHeight = Window.ClientBounds.Height;
        }
    }
}


Edit: Oops, you beat me to it Smiley
« Last Edit: 2007/01/10 16:45:53 by ericc59 » Logged
vogelmann
Newbie
*
Offline Offline

Posts: 4


View Profile
« Reply #13 on: 2007/01/10 19:57:19 »

thanks for the help, working fine now
Logged
vogelmann
Newbie
*
Offline Offline

Posts: 4


View Profile
« Reply #14 on: 2007/01/10 20:27:10 »

Hate to sound stupid but I get the same error in the next section of the tutorial, at void

Code:
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
namespace TPEngine
{

    public class TPGame : Game
    {
        GraphicsDeviceManager myGraphics;

        public TPGame()
        {
            myGraphics = new GraphicsDeviceManager(this);
            Window.AllowUserResizing = true;
            Window.ClientSizeChanged += new System.EventHandler(Window_ClientSizeChanged);
        }

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

        void Window_ClientSizeChanged(object sender, System.EventArgs e)
        {
            myGraphics.PreferredBackBufferWidth = Window.ClientBounds.Width;
            myGraphics.PreferredBackBufferHeight = Window.ClientBounds.Height;
        }
    }
}
protected override void Update(GameTime gameTime) {
KeyboardState kState = Keyboard.GetState();
if(kState.IsKeyDown(Keys.F)) {
myGraphics.ToggleFullScreen();
}

base.Update(gameTime);
}

Logged
Pages: [1] 2 3
  Print  
 
Jump to:  

Related Topics
Subject Started by Replies Views Last post
so xna... General Discussion nordwindranger 3 1957 Last post 2006/10/20 12:44:58
by BrophyJ
Tutorial 2 :: Scene Graph and Object Framework Tutorial Discussion « 1 2 » mikeschuld 18 10052 Last post 2008/07/31 22:50:22
by mikeschuld
MOVED: XNA Tutorials :: Game Engine and Game Development :: Tutorial 1 Hazy Mind 3D Engine mikeschuld 0 2365 Last post 2006/10/30 21:35:32
by mikeschuld
Tutorial 8 :: Post Processing Framework Tutorial Discussion « 1 2 3 4 » Chr0n1x 59 18079 Last post 2007/06/15 03:41:52
by Chr0n1x
XNA Tutorial Forecast Hazy Mind XNA Engine Requests Ashe 3 2605 Last post 2007/02/16 16:03:20
by swakdaddy
XNA Animation Component Library in XNA HMEngine Hazy Mind XNA Engine dotslash 0 2621 Last post 2007/05/31 13:53:12
by dotslash
Physics simulation: BulletX (Bullet for XNA) physics and Hazy Mind Xna Engine Hazy Mind XNA Engine Yubastard 6 5560 Last post 2007/08/12 08:57:21
by Yubastard
Please write a tutorial: XNA+WinForm in Hazy Mind General Discussion Francisk 4 3275 Last post 2009/12/14 11:45:40
by Mikeske
Introduction General Discussion cgi ebay 1 931 Last post 2011/02/27 22:56:20
by joeljefcoat
Powered by MySQL Powered by PHP Powered by SMF 1.1.12 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 0.404 seconds with 20 queries.