Hello I would like to program my own 2d game into C++. I know
its hard I know it needs a lot of time but I strongly believe the only
way to learn c++ is to program so if you won't swim deeper you
will never learn to swim. I searched into google and I got plenty ressults for XNA game studio but its for c# all others was about
costume programs. Could you suggest me something?

Look up Allegro. I hear it's pretty good. Never used it myself though.

You want to read up about game engines and you will find that there are several options that would allow you to start very quickly.

If you are using visual studio and windows the trickiest bit is creating the window and understanding what messages are about.

Now although versions of VISIO offer various resources that you can use to start it is important to be able to create the code without a built in resource if you wish to use Express editions as much of the resource editor is not present.

A good place to start on the learning of graphics is via online tutorials or scribble.

If you are using linux there are various other open source projects and physics engines that let you get started quikly but configuring the build options can be tricky as you have to link to every font used etc

I suggest using Direct2D (If you have a vista or windows 7 computer)

The documentation on MSDN is very well written and can get you started in an hour or two.

If you just want to learn how to create 2d games, it shouldn't really matter if the code is portable.

First learn the basics of WinAPI (how to create a window and the window procedure)
Then learn to use a rendering engine (Direct2D)
Then plan your first game (I recommend with pen and paper) and then start programming it.
My first game was Tetris, and it learnt me alot.

Ow yeah, also create a time management class for your games.
I can send you mine if you want.
I've also created a (small) class that helps initializing Direct2D applications.
PM me if you want it.

My 2 cents.

Hello, I'm not even an amateur programmer yet. But, I know that Half-Life 2 games (i.e. Counter Strike: Source, Team Fortress, Portal, Day of Defeat: Source) all use the C++ language. I believe they call it source because they make the source code entirely transparent. It is worth looking into the HL2 source code. You can see how organization is an extremely important part of programming. Teams of programmers write the code. That's why I think it is so difficult to get started in game making. Check Java for gaming, also check out the macromedia development tools.

I don't recommend looking into professional source code. You won't be able to understand it. Those are really big projects with MBs of code.


Program with either Allegro, or if you want probably the easiest to learn yet can go to professional commercial developmental levels I would highly suggest DARK GDK.

It is simple as pie and there are more than enough resources and tutorials to learn from. Its about as simple as you draw yourself lets say in paint shop a little guy who is 40pixels wide, 70 pixels tall\in height. Now you wanna control it so you would load it into your game simple as dbLoadImage("C:/LocationOfPicture", 1) the 1 being the id of the picture to easily identify it.
Then to control it in your game you would sprite it simple as
dbSprite(1, 300, 200, 1) where 1, is Sprite ID, 300 = Xcoord, 200 is Y coord, 1 is Image ID you loaded with the dbLoadImage.

Now control is :) SIMPLE for a simple move forwards using the right arrow key would be.
dbSpriteX(1) + 1;
That simple if statement says Move sprite 1 which is the image you loaded and gave id of 1, +1 on X axis. So when you hit the right arrow key your little guy would move to the right + 1.

Game programming by far can teach you in the funnest way how to program anything complex later on such as when you dive into WinApi programming.. Learning structures and pointers and classes through game programming will make it sink best because it's FUN!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.