How do I render stuff in Visual C++?

Miscellaneous Forums/General Discussion/How do I render stuff in Visual C++?

Hey guys, i just got into Visual C++, so far its great, but i can't figure out how to draw anything. So i was wondering how to just render some 2d stuff for a start. Staring at the command prompt is fun and all but...

You have to use an API or a library / engine of some sorts. You can go with Direct3D, OpenGL, Tons of free game engines, SDL etc. etc.

Allegro's a good one for beginners to get into games writing. Use a compiler like dev c++ and look up allegro tutorials on youtube.

Visual C++ is just plain old C++ by default, so like Mortiis said you need to choose some sort of library to use. Professional game designers usually use DirectX/OpenGL to make an engine from scratch, but there are plenty of premade engines out there as well.

I wouldn't recommend Dev C++, but there's no need to explain - if you try it you'll find out for yourself why Visual C++ is so much better.

I just downloaded SDL today, but for some reason it won't work. I copied the libs and include files, but the linker returns "fatal error LNK1561: entry point must be defined"
?

"fatal error LNK1561: entry point must be defined"

Sounds like it's not finding your main() function.

I copied the libs and include files

FYI, you can add the include/lib paths and a list of .libs to link to your project options and you won't have to copy anything.

you can add the include/lib paths and a list of .libs to link to your project options and you won't have to copy anything.


Wow, you can tell i'm a beginner at this.

Sounds like it's not finding your main() function.


it's something to do with SDL.h, because when i comment it out, the error goes away. For instance this will work:



int main(){

return 0;
}


while this won't:



#include "STD.h"

int main(){

return 0;
{


?

Wouldn't you be better asking about C++ SDL questions on the SDL forums?

I've never used SDL, so I can't really help you, except this:
int main(){

return 0;
{


Should be this:

int main(){

return 0;
}


Oh yeah, ment that.

If you want to use C and do graphics I'd recommend downloading Microsoft's free XNA Game Studio and VisualC 2005 - XNA gives you all the great stuff you need to code games and they come with loads of tutorials and you'll have games up and running in no time.

Try it and you'll be hooked - I certainly am!

I wouldn't recommend Dev C++, but there's no need to explain - if you try it you'll find out for yourself why Visual C++ is so much better

Yes, being able to download the SDL devpac so you get an SDL project option that just works is such a pain! :) Being able to carry the compiler around on a flash key as a portable app -- HIDEOUS! :D

does XNA have 2d collision commands?

@Sledge: yeah, that's why I recommended it. Although I probably will try visual studio expresa with XNA soon.

XNA is very Blitzy. There are tutorials for everything imaginable including 2D collision.

Yes, being able to download the SDL devpac so you get an SDL project option that just works is such a pain! :) Being able to carry the compiler around on a flash key as a portable app -- HIDEOUS! :D

I'm sure it's very easy to install, and I'm sure it's very novel to have it on your flash drive, but I'm referring to the tool itself.

Visual C++ not only has a compiler that is miles ahead of Dev C++'s in terms of speed (compiled code often executes 2x as fast as GCC/MingW/etc.), but it's editor is far better, the debugger is one of the best in the world (needless to say, Dev C++ doesn't even compare), etc., etc. There are so many other advantages it would take too must space to list them all.

Thanks guys. I thought XNA was for for C#. I downloaded that, but haven't used it exept to transfer some games on my Zune (Best mp3 player out there - slaughters ipod). Is there a version for C++?

There are so many other advantages it would take too must space to list them all.
None of them really matter if he can't get his code to compile, though -- that's the context for suggesting DevC++, purely because getting an SDL project up and running involves clicking a few icons. I shan't argue against the general supremacy of Microsoft's tools, it's just demonstrably easier to get going in the simpler (and, yes, less capable) environment. But hey he's gone for XNA so that's two birds with one stone. :)

Visual C++ is probably one of the easiest things to get code up and running quickly because most code out there includes visual C++ project files which work instantly. It sounds to me the only reason DevC++ is easier in this case is because it includes a template for SDL.

Is this correct? If so, that would be a rather foolish reason to use an inferior IDE. Chances are you're going to have to use a library later that you don't have a template for, so you're gonna have to learn how to use C++ libraries sooner or later.

It sounds to me the only reason DevC++ is easier in this case is because it includes a template for SDL.

I'm not going to argue with you about the Visual suite being one's inevitable destination for mid-level programming on Windows. However for the purposes of checking out SDL with C++, DevC++ with the appropriate devpac is a really expedient way to investigate whether you'd even want to pursue it further with Visual C++. That's all -- for what we're specifically talking about in this thread DevC++ has a particular level of accessibility to recommend it.

However for the purposes of checking out SDL with C++, DevC++ with the appropriate devpac is a really expedient way to investigate whether you'd even want to pursue it further with Visual C++.

True.

I am going to stick with Visual C++; I am planning to make some applications, and the drag-and-drop GUI editor is so much easer then coding all the buttons in manualy. Is XNA Available for C++?

No, XNA is for C# only AFAIK.

I am going to stick with Visual C++; I am planning to make some applications, and the drag-and-drop GUI editor is so much easer then coding all the buttons in manualy.

Actually you're referring to managed C++. I'd actually recommend against that, because Microsoft's "Managed C++" is a modification of real C++, and is really really messy to program with, and runs just as slow as C# - it's not "true" C++ - it's C# in disguise.

For the easy to use GUI editor, I'd strongly recommend you use C# instead. It's a much easier and cleaner language than managed C++ (which is C++ with a few misplaced things tacked on) for .NET style programming.

If you do want to learn C++, learn pure C++ - it's faster, cleaner, easier to learn, and makes more sense than managed C++.

John J., is C# also a modified form of C++?

C# is similar to C++ in syntax and style, but other than that it's a completely different language.

Managed C++ tries to emulate C++ when in reality it has to use managed features and methods which are really native to C# and VB.NET. In other words it tries to mix a language where memory manipulation and close hardware control are core features (C++) with a language that entirely discards those methodologies and uses an entirely different approach. The result of managed C++ is IMO a very messy and horrible language to work with.

In my somewhat limited experience of C#, it seems to be a very good language for application development because it's fairly easy to use, but for games where performance is critical, I have my doubts about any managed language.

I mainly want to make games, and the cross platforms avalible on C# with XNA (Xbox 360 and Zune) appeal to me greatly. I originally planned to learn Visual C++ and then Visual C#, but if Visual C++ is messy, I certainly don't want a messy language, that being one of the reasons I started to think another language beside Blitz3D. Thanks a bunch.

Visual C++ is not messy - it's just pure, standard C++.

Managed C++ in Visual C++ is messy. There's a difference.

dev c++ for me, being based on gnu C++ its MUCH more portable than VC++