Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 05 Feb 2005
Offline Last Active Oct 02 2013 09:07 AM

#4982485 can't initialize directx 11

Posted by on 21 September 2012 - 02:21 PM

It looks like your video card supports up to directx 10.1

source: http://www.geforce.c...e-310m/features

edit: Not sure why the samples would run if dx11 will not init.

#4982186 Convert 1D array to 2D array C#

Posted by on 20 September 2012 - 04:48 PM

Feel free to play around with this and learn how it works but this is a very basic example of writing and reading your map data from a file written in binary, I also wouldn't call myself an amazing programmer but this works.

    public class MapLocation
		public int TileNumber = 0;
		public bool Blocked = false; //if the tile itself is blocked
	public class MapManager
		MapLocation[,] MapData = new MapLocation[100, 100]; //create a 2d Array with our map class
		// ////////////////////////////////////////////////////////////////////////////////////////////////////////
		public int GetTileAtLocation(int X, int Y)
			//check bounds
			if (X < 0 || X > 100 || Y < 0 || Y > 100)
				return 0;
			else //its in bounds of our array
				return MapData[X, Y].TileNumber;
		// ////////////////////////////////////////////////////////////////////////////////////////////////////////
		public void SaveMap()
			using (FileStream stream = new FileStream("Map.dat", FileMode.Create))  //create our file
				using (BinaryWriter writer1 = new BinaryWriter(stream)) //create writer
					//write header
					writer1.Write(1000); //File Version increment this anytime you change data below
					for (int x = 0; x < 100; x++) //loop through all of our tiles
						for (int y = 0; y < 100; y++)
							writer1.Write(MapData[x,y].TileNumber); //write tile number
							writer1.Write(MapData[x,y].Blocked); //write blocked flag
		}//End SaveMap()
		// ////////////////////////////////////////////////////////////////////////////////////////////////////////
		public void LoadMap()
			if (!File.Exists("Map.dat"))
				//file does not exist return
				Console.Write("File Does not Exist\n");

			using (FileStream stream = new FileStream("Map.dat", FileMode.Open))
				using (BinaryReader reader = new BinaryReader(stream))
					//Read Header
					int ThisFileVersion = reader.ReadInt32(); //pull our version from the file and make sure it matches what we think we are reading
					//Check our file version
					if (ThisFileVersion != 1000)
						Console.Write("Exp File Version Mismatch\n");
					for (int x = 0; x < 100; x++) //loop through all of our tiles
						for (int y = 0; y < 100; y++)
							MapData[x,y].TileNumber = reader.ReadInt32();
							MapData[x,y].Blocked = reader.ReadBoolean();
		}//end LoadMap()

	}//end MapManager

#4982037 c++ string pointer to char*

Posted by on 20 September 2012 - 08:24 AM

Jeff, check out this link, it has some interesting reading on the subject:


#4982031 c++ string pointer to char*

Posted by on 20 September 2012 - 08:15 AM

edit: Sorry I completely misread your post.

Time for some more coffee =)

#4979317 How Would You Tackle This Simulation?

Posted by on 12 September 2012 - 08:31 AM

You could represent the track as a large array of available movement slots something like:


Each spot on your array has a value associated with the movement cost with lower being better so each step of the runner he will choose the quickest route.
You would have to do somethig to prevent them from running in reverse but you get the idea.

If another runner is already in that spot the runner behind him will have to go around at a higher movement cost.

I am sure there are way better ways to do this but just something I thought of.

#4969226 2D Platformer fps/Independent- time based movement

Posted by on 13 August 2012 - 04:36 PM

I looked through your code and the only thing I am a little unsure of is:

float elapsed = (float)gameTime.ElapsedGameTime.TotalSeconds;

Does this return milliseconds as well or a just seconds?
IE: 0.0033 seconds or just 1 second, IE whats the resolution of this timer?

I would check the value of TotalSeconds on runtime on both platforms and see if you get similar results.

Also (correct me if I am wrong) gameTime.ElapsedGameTime.TotalSeconds is a XNA thing when you ported it over what did you change it to?

#4968134 2D Platformer fps/Independent- time based movement

Posted by on 10 August 2012 - 10:41 AM

Do you ApplyPhysics() every frame?

Also how are movement and MoveAcceleration defined?

#4893248 Help with improving drawing in DX9

Posted by on 12 December 2011 - 03:04 PM

gd3dDevice->SetTexture (0, texture);

Every time you draw something is a huge bottle neck.
If you can draw your scene by only binding your texture only a few times you will get a huge FPS increase.

#4892260 Creating File Help

Posted by on 09 December 2011 - 12:08 PM

Also you should check if myfile is NULL after the fopen, as to WHY it doesn't open thats something strange.

I was thinking maybe you didn't fclose or something like that but I didn't find that in the code.

And check errno for one of those error codes.

#4892252 Creating File Help

Posted by on 09 December 2011 - 11:34 AM

darn, had my hopes all up! Sorry for a bad commenting, you can tell this isnt quite finished -.-

Hrmm, I have having trouble locating anything that sticks out but im no expert.
But looking in your AddQuery Function
static int textactive = 0; //1 = barcode, 2 = customer, 3 = ordernumber

When you go into your code you set the number based on the LOWORD(wParam)

Your textactive would still be set to zero and when you get to your IDOK, if this was still 0 nothing would be written to a log file.

I would try stepping through that section and see whats going on.

#4891940 Tiburon

Posted by on 08 December 2011 - 03:16 PM

EA Tiburon is an Electronic Arts video game development studio located in Maitland, Florida, United States founded in 1994. It is located just north of the Orlando, Florida downtown area.[1] It was formerly known as Tiburon Entertainment, which was acquired by EA in 1998.


#4891851 c++ error: warning C4700: uninitialized local variable 'k' used

Posted by on 08 December 2011 - 11:39 AM

Your using the variable k without giving it "default" value.

This warning will go away if you do this:
int k = 0;

Its just a warning and your overwriting whatever value happens to be there for your variable k anyway.

#4881781 Game Idea Text Based or 2D Best?

Posted by on 08 November 2011 - 09:38 AM

It really comes down to another question.

Do you want to complete this project or possibly not complete it and learn some new stuff?
If you want to complete the project go with what you know and do it text based, generally most people tend to frown on text based games but there is a small nitch market out there for them.

If you want to learn something new about 2d programming etc go for it, but if your anything like me doing a project while your learning tends to lead to many rewrites then a scrapping of the project to start over =p

Now if you can learn 2d programming AND work on your final project thats awesome, I personally cannot do that.

A suggestion would be do some 2d type demo's until you figuring everything out you will need then start working on your final project.

#4876477 Question about Managers

Posted by on 24 October 2011 - 03:04 PM

Then what exactly is a Manager?

Something that detracts from your projects goals and make them harder to understand.

#4874397 Question about Managers

Posted by on 19 October 2011 - 12:00 PM

When a class name becomes vague, the temptation to blur its responsibilities increases.

class ManagerManagerManager
	LightManagerManager LightManager;
	ObjectManagerManager ObjectManager;