Archived

This topic is now archived and is closed to further replies.

Move on to windows now??

This topic is 5534 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

I''m a newbie programmer and have been learning C++ for about 3-4 months now, and have made a few text games. I know that windows is the dominant platform to develop games for, so should I move onto windows programming straight away? ....or would it be better to learn more C++ in DOS, then when I''m competent in C++ move onto windows. I''ve checked out some windows source code and it looks pretty daunting to me, all the new weird names mean nothing to me.. Is learning windows programming best suited to experienced C++ programmers, or would newbies like me be able to grasp it? Any help would be nice (remember i''m a newbie!)

Share on other sites
MFC is a perfect example of how not to make an GUI API. You''ll have to purpasely over complicate your code to make GUI''s using Micorosfts API.

Share on other sites
Resist the erge to use MFC. It may look easy, but it will bite you in the arse every time. Pick up a good book on Win32 programming. Check out the latest copy of "Programming Windows: The Deffinitave Guide" or something like that by Charles Petzold. It takes a bit to get used to but it is an excellent skill to have. When you move on to OpenGL or DirectX to develop games, you will need to know, well should know anyways, how to create and manage a window. Cause you kinda need to have something to draw your graphics on

Share on other sites
Hehhe. Every newbie faces this dilemma. Continue in c/c++ or... win32?!

Well, I can tell you that you are going to *definatly* need a tone of c/c++ knowledge to be successfull. Unfortunatly, DOS is sooo boring nobody really wants to spend any time in it (myself included). That was one.. mistake, I guess you could say, that I made. I knew the basics, and decided to move on to windows and directx programming right away (well, after 5 or so months of c/c++ basics.) Anyway, in doing this you *can* manage somewhat, with the help of these forums. However, I never really learned good coding practices (besides the obvious naming conventions and the like), and optmization techniques, etc.

To me, Win32 is a good pick for programming in windows. It''s very simple once you read a good tutorial on it, and you basically never look back. However, I found it extremely intersting and spent some time using just a few of it''s many different functions. I learned this mostly from tutorials on the web. I found this was a good tutorial on Win32.

Anyway, before you move on to Win32 I suggest you know the following:

• Know what to put in header files and what to put in cpp files
• Know proper header structure so the compiler doesn''t have to do extra work
• Learn how to use precompiled headers properly.
• Know that you shouldn''t use a class to store three variables (a structure will do fine)
• Be able to use pointers in almost every possible way (something I didn''t do and probably still can''t do)
• Know that you are about to enter the mystical world of Win32

There''s probably more, but that''s all I can think of for now. I really hate saying this, because I have no idea who in their right mind could even attempt to stay in dos this long. Though, I must admit I would be much further along the learning curve if I had taken this advice I''ve just given you.

Hope you turn out {insert appropriate adjective here} like the rest of us! :D

¬_¬

Share on other sites
I have to say that i agree with Fuzztrek on this matter as knowing as much as possible about c/c++ will help a great deal with windows/direct x programming. I will have to admit though that i did exactly the same as Fuzztrek in that i tried to do windows/direct x programming before i really understood a lot of the basics of c/c++ programming and really ended up with a lot of problems trying to understand what was going on in a basic windows program. However i did go back and read up a lot on c programming and am now trying to do the same with c++ which i have found has given me a new understanding of what is happening in windows programs.
I am sure that if you take the plunge you might be facing some similar problems in that a lot of the windows data types will have names that won't mean much to you such as HANDLES, DWORD, WORD etc, however if you know basic c/c++ programming well enough you should work out that these are just datatypes like int, char etc but are made specifically for windows programming. I guess a simple way to describe any API would be to say that it is just a collection of data types and functions designed to be used within a specific framework but understanding what is used to build this framework is probably the key to learning how to use it properly.
One last thing, as Fuzztrek said pointers are a must and you should at least be comfortable in using and understanding what normal pointers do and how they can be used. I have also seen pointers to pointers used quite a lot in windows programming so this is another area that needs to be looked at as well as function pointers.

Fuzztrek, i feel from reading your post that you are at a similar level in terms of programming to me. I would be interested to know what kinds of programs you have created and what you are currently trying to learn.

[edited by - popcorn on December 7, 2002 11:02:34 PM]

Share on other sites
[mindless self-centered semi-rant]
I use C on my OS.
I despise Windows.
I wont use windows anymore when I port GCC and NASM to my OS.

I, unlike many, can stand independant from Microsoft...
[/mindless self-centered semi-rant]

[what actually comes out of my mouth]
Yeah, Windows is ok...
[/what actually comes out of my mouth]

Enter the Unspoken Realm

Share on other sites
quote:
Original post by popcorn
Fuzztrek, i feel from reading your post that you are at a similar level in terms of programming to me. I would be interested to know what kinds of programs you have created and what you are currently trying to learn.

I havn''t done very much so far, just fiddling with Direct3D. I''m optimizing a MD2 loader at the moment, and after that I''m going to try and impliment a view frustrum into my engine. I''m very interested in vertex shaders, however I''m going to try and learn more of the basics first

¬_¬

Share on other sites
I started out after console apps( I actually didn''t stay there long in C++, It just annoyed me to heck after being *FORCED* to use Pascal in a class I was taking. ) I danced around the internet for a while and came across four main graphical thingies(sry, I can''t think of the word) The WinAPI+MFC, OpenGL, DirectX and SDL. I looked at OpenGL and DirectX, and then I looked to SDL, and found it was simple enough that even someone from console-based programming would be comfortable using.

There is no extensive class declaring (think WinAPI), and It starts off with a few simple functions.

Okay, as you read this you may think this off topic, but stay with me. WinAPI is crazy to learn, and most likely you''ll just end up using a template. And from what I think you''ll try to do(read: a game), SDL is the quickest way to just give you a screen to work with and let you put pictures on it.

I was able to learn and write a simple game in less than a few days. (Most of the time was spent looking for the next set of tuts) If you''re looking for a GUI, I''ve actually managed to make a GUI with SDL that looks pretty lame, but it''s functional.

sites you should look at:
http://cone3D.gamedev.net - Click on the ''GFX with SDL'' on the sidebar
http://www.gamecoding.co.uk - Some good tuts there as well.

Share on other sites
quote:

Know that you shouldn''t use a class to store three variables (a structure will do fine)

Don''t mean to nitpick, but in C++, there is no difference between the keywords "struct" and "class", except that struct defaults to public. Thus the following two code examples are completely and exactly the same:
class threevars{public:    int var1;    int var2;    int var3;};struct threevars{    int var1;    int var2;    int var3;};

- Andy Oxfeld

Share on other sites
Andy,

You are absolutely correct.

On the other hand, there is kind of a standard convention that has been developed that goes something like this:

If you''re JUST working with data, make it a struct. If you''re going to add operations, etc... make it a class.

So in reality Struct and Class are different entities. A class is used statically, as an interface, and as a means to create objects.

Structs on the other hand are mostly just used as a way to group data. ( an instance of a struct is rarely called an object)

Best Regards,

Jeromy Walsh
Programmer
Liquid Entertainment
------------------------
"The question isn''t how far, the question is do you possess the constitution, the depth of faith, to go as far as is needed?" -Boondock Saints

Share on other sites
Go windows now, don''t bother about using C++ in DOS. I started windows programming when I had a very little understanding about classes. As long as you are familiar with C programming structure, you can write programs in Windows.

Don''t worry about those "new" weird names. You will get used to them.

My compiler generates one error message: "does not compile."

Share on other sites
just buy "Programming Windows 5th Edition" by Charles Petzold ;D
it''s the best book on win32 api (not mfc).

Share on other sites
How I learned win32:

http://winprog.org/tutorial/

I started programming in QBasic. I had made a few games, and my own graphics tile editor.

Of course, QBasic is crap for "real" programming, and I heard that VB was crap, so I decided to learn c++. I made 2 non-win32 c++ programs (just two) and they were: "Hello World", and an OO program about a cat (there was a Cat class). You could name the cat what you wanted, feed it, and exercise it. If you fed it too much at a time, it exploded (text mode, mind you) and if you exercised it too much it died from fatigue. Then I jumped into win32 (I still didn't know the syntax all the way, was always forgetting ;'s)

-EDIT- I forgot, my real 1st win32 program was a message box that said "Hello World!" -/EDIT-

My first ever win32 program was a download time calculator. I didn't trust the figures that IE was giving me, so I wrote a simple dialog based program that took the current download speed, file size, and the size of the part that was already downloaded and spit out a h/m/s. Turns out IE was right.

The next program I made was a tic-tac-toe game, with GDI. The window was resizeable (the board got bigger with the window), it worked perfectly, it had computer ai, and it had a statistics dialog box which showed totals wins, win streak, and max win streak for each player.

Then I jumped into OpenGL using NeHe's site, and I've been learning/mastering OGL since. (still no completed games )

Anyway, I recommend jumping into Win32 now. If you have the syntax down for c++, you're ready. I barely knew how to write a for loop when I started win32, but now I'm fine. So whatever you do, good luck and have fun!

[edited by - Neosmyle on December 8, 2002 8:06:32 PM]

Share on other sites
Learn console programming first. There''s no point in starting with a 100 line Hello World windows program when you can start with a 3 line console Hello World program.

- Andy Oxfeld

Share on other sites
Andy,

I agree that you should learn console programming first, however I still stick to the 3 vars = struct. I didn''t realize that this was such a hot topic, but that''s the way I''ve learned it and it just makes sense to me (ie, I wonder why it would be any other way.)

- Fuzztrek

¬_¬

Share on other sites
quote:
Original post by AndyOxfeld
There''s no point in starting with a 100 line Hello World windows program when you can start with a 3 line console Hello World program.

There is, learning. How many of you here started with QBasic and moved to C/C++? If you are one of them, I believe there was a time you thought about this:

"Why do i have to write 5 lines of ''Hello World'' in C/C++ if I can do it just 1 line in QBasic?"

"What? 5 lines just for a ''Hello World'' on the screen?"

However, when you study further, you start to realize that it''s worth studying 5 lines of Hello World. It is much better than 1 line of Hello World. Same here. Sometimes later, you will be glad learning Windows. There is a big challenge ahead, but you have to go through it, sooner or later; but sooner is better.

Let me tell you this, there is a very little benefit learning console now and Windows later. They are completely different. Even if you are the master of consoles, once you go Windows, you are a newbie. So, learn now, face the challenges.

My compiler generates one error message: "does not compile."

Share on other sites
Its nice to hear from you Fuzztrek, I am currently looking at a c++ book at the moment as well as reading windows programming by charles petzold. However i think you are probably a bit ahead of me at the moment. I have not created a single game yet, not even a text based one but you seem to be making engines already. I have read some Direct x tutorials by joseph farrell which are on this site and i guess the best i have done is initializing direct x and drawing a full screen window.

Anyway what is an MD2 loader, and a view frustrum in an engine? How did you find the early direct x stuff? I have looked at some sample code that comes with the sdk and have noticed that a lot of the initializing stuff that is in joseph farrels tutorials can be handled by the d3dutils header file i think. Have you used this?

Windows Programming
- I guess one of the problems with windows programming is the sheer number of functions that are available through the api and i sometimes think it is difficult for new programmers to know which functions are useful for a particular problem. With some knowledge of c/c++ it is possible i guess to use the majority of functions but how do you determine which fuctions to use and how useful they will be. Is it just a matter of time and persistance, or is there a more tactful way of finding out the correct functions to use. I mean to be honest i still am not familiar with the majority of c''s runtime functions, however i believe i have used the main ones like printf, strcmp, clrscr etc.

Share on other sites
quote:
Original post by popcorn
Windows Programming
- I guess one of the problems with windows programming is the sheer number of functions that are available through the api and i sometimes think it is difficult for new programmers to know which functions are useful for a particular problem. With some knowledge of c/c++ it is possible i guess to use the majority of functions but how do you determine which fuctions to use and how useful they will be. Is it just a matter of time and persistance, or is there a more tactful way of finding out the correct functions to use. I mean to be honest i still am not familiar with the majority of c''s runtime functions, however i believe i have used the main ones like printf, strcmp, clrscr etc.

it''s a matter of time and persistence. MSDN is your definite source of knowledge, everything is explained there.

My compiler generates one error message: "does not compile."

Share on other sites
If you already know C++ well, but not much Win32, is it worth spending the time to study through a book as large as Petzold''s? I have that book on my shelf but its just so damn huge that I was planning to go straight into some DirectX tutorials when I get to that stage, and just refer back to a book like Petzold for reference. I think it would take me a year just to study that book alone.

Caroline M.

Share on other sites
quote:
There's no point in starting with a 100 line Hello World windows program when you can start with a 3 line console Hello World program.

#include <windows.h>int WINAPI WinMain(HINSTANCE, HINSTANCE, LPCTSTR, int){  ::MessageBox(0, "Hello, World!", "Welcome", MB_OK);  return 0;}

Well, just 2 lines in the WinMain()!

[EDIT] Anyway, building up your experience on pointers/references in console mode would be easier than figuring out errors like "unable to convert 'void*' from 'HINSTANCE__*'".

[edited by - DerekSaw on December 27, 2002 9:45:03 PM]

Share on other sites
quote:
Original post by DerekSaw
[quote]There''s no point in starting with a 100 line Hello World windows program when you can start with a 3 line console Hello World program.

#include <windows.h>int WINAPI WinMain(HINSTANCE, HINSTANCE, LPCTSTR, int){  ::MessageBox(0, "Hello, World!", "Welcome", MB_OK);  return 0;}

Well, just 2 lines in the WinMain()!

[EDIT] Anyway, building up your experience on pointers/references in console mode would be easier than figuring out errors like "unable to convert ''void*'' from ''HINSTANCE__*'' ".

[edited by - DerekSaw on December 27, 2002 9:45:03 PM]

@DerekSaw: I guess you can program a hello world program that way, but you should look at Microsoft''s idea of what Hello World is. In Visual C++, when you create a new project and normally specify ''Empty Workspace'', specify ''Hello World'' or something like that. It''s just -- pathetic.

[  c o d e  m a t r i x  ]

Share on other sites
Well said. I just wanna point out that comparing the popular "Hello, World!" with a Windowed version of "Hello, World!" is like apple vs orange. The former have text only, whereas the latter have system menus, graphics, fonts, maximize/minimize/close buttons... etc.

In short, writing 100 lines of "Hello, World" isn''t useless.