Advertisement

Getting started (Visual C++ & OOP)

Started by June 22, 2002 04:46 PM
4 comments, last by Indie 22 years, 4 months ago
Right. I know there are no dumb questions, but this is kinda close... Where do I start? I know quite a bit about programming already, but I haven''t done any C++, but it so close to Java that I shouldn''t have any problems. The main problem, for me, is that I''m just overwhelmed with the Visual C++ interface and everything in it. With Java, I had a blank page and a (programming) text editor. Now I''ve got all these buttons, options and other crap... argh! Can someone give me a brief summary on how to make a simple program that uses an object? A text-only program would be sufficient. That should be enough to get me started. I _DON''T_ need any info on how to program, just the info on how to get a window and how to make my own class that doesn''t have any graphics related crap already put in it. And if its possible, I''d like to know if I can code a class and compile it without writing a program that actually uses it. My eventual goal is to make a game where I''d have everything neatly in their own classes. e.g. universe class, starship class... I''d especially like the graphics to be completely separe from the rest. The graphics should be drawn according to the info in the other classes, but it should be one neat little package that I could recode if I wanted to improve the graphics. Does this sound like a workable approach?
click here

"I pity the fool, thug, or soul who tries to take over the world, then goes home crying to his momma."
- Mr. T

[edited by - ncsu121978 on June 22, 2002 6:02:57 PM]
Advertisement
'I haven't done any C++, but it so close to Java that I shouldn't have any problems.'

You'll have more than you may think. Having coded many an application in both languages, I can say there are a lot of things that are taken for granted in Java that have the potential to bite you in the keister when it comes to C++ (memory management comes immedietly to mind).

'With Java, I had a blank page and a (programming) text editor. Now I've got all these buttons, options and other crap... argh!'

Learn what those buttons do, don't avoid them. If you're more comfortable using a text editor to write your code, do it. There's nothing to prevent you from using VC++ as a command line compiler/linker (although I'd have to question why you bought VC++ instead of using one of the many free 32 bit compilers if you don't want to use the IDE).

'Can someone give me a brief summary on how to make a simple program that uses an object? A text-only program would be sufficient. That should be enough to get me started.'

Examples are sometimes better...


    #include <iostream>class foo {public:  	foo();	~foo();	void print();};foo::foo() {	//Nothing to be done for foo on creation}foo::~foo() {	//Nothing to be done for foo on destruction}void foo::print() {	std::cout << "foo\n";}int main(int argc, char* argv[]) {	foo fugazi;	fugazi.print();	return 0;}    


'I _DON'T_ need any info on how to program, just the info on how to get a window and how to make my own class that doesn't have any graphics related crap already put in it.'

You can't avoid graphics related 'crap' when working with the GUI aspect of any windowing O/S.

'I'd like to know if I can code a class and compile it without writing a program that actually uses it.'

Use google and look up information on DLL's (which is about as close to a Java .class file as you can get).

'...Does this sound like a workable approach?'

It sounds like an excellent approach, but you still have much to learn about Visual C++/Windows (not to mention all of the other API's you'll need such as OpenGL/Direct3D, DirectX, etc) before you get there.




SysOp_1101

[edited by - SysOp_1101 on June 22, 2002 6:24:05 PM]
SysOp_1101
Thanks SysOp, that all helps. Especially the bit about dll:s. I think that is exactly what I need to study at this point.

Thanks also to you ncsu, although those links are more programming related than what I''m looking for. My problems are more on the "conceptual" side... :/

As for what I''m doing with Visual C++ - well, I already had it as a part of a cheapo student package that had other MS''s programming tools as well. The down side is that it didn''t come with any documentation at all. So far I had been using Visual Basic and some Java. At first I figured I''d do the game with VB, but I soon realized that I''d need an OO language to better keep track of things. Yes, I suppose it might be easier for me to start C++ programming with the text editor, but I''d really like to learn to use the visual aspects of VC++ too (this isn''t such a problem - most tutorials I''ve seen are about the visual aspects - already did a few) since that would give me the benefits I get from Visual Basic (easy graphic user interface) and objects. I already put together a nice little universe creator with VB in no time, but I don''t think its a good idea to make all the tools for my game with VB since many of the functions would come in handy in the real game.

My game won''t be 3d, but I''ll probably need directdraw - although fast graphics aren''t a priority as its going to be a slow-paced strategy/adventure.

Ah well, I''m getting there - albeit slowly.
Glad I could help a little. One other thing for you...one great (and free) resource to use for Windows programming/Visual Studio information is (http://msdn.microsoft.com/library/) the Microsoft Developers Network. I'd also highly recommend getting the help file for the Win32 API (don't have a link for that one on hand though...I'll try to find one).

[edited by - SysOp_1101 on June 22, 2002 11:21:20 PM]
SysOp_1101
quote: Original post by Indie
I haven''t done any C++, but it so close to Java that I shouldn''t have any problems.


This goes the other way around. C++ programmers will have no trouble using Java, but Java programmers may go through hell trying to learn C++ since all the stuff Java does automatically for you (that you don''t have to think of) you have to do manually in C++. Good luck though !

This topic is closed to new replies.

Advertisement