Sign in to follow this  
LordFallout

New member sharing experiences and problems :)

Recommended Posts

Hello all, this is my first post on the gamedev forum seems to be a lively place with a close community. my language of choice so far is c++ which i have been programming for appr 1 year, i can handle a lot of c++ techniques including inheritance and encapsulation. However i have been running into severe hurdles when trying to write win 32 applications in c++, i think the main problem with this is that when i first saw some win32 code as apposed to a simple console applications code i was shocked, im quite concerned as to the ammount of code needed to write a simple program. Stuck wondering how am i going to learn all this, remember all the windows or direct x specific data types etc. How do you guys manage to remember everything? im not sure it would be wise for me to have to check documentation every single time i want to write a simple app, another problem i am having is that the msdn documentation is written in microsoft English, i cant seem to understand any of it lol. I have purchased a couple of c++ books and recently purchased a beggining visual c++ 2005 book by wrox. This is a pretty good book although i now hate the MFC. I have read multiple tutorials on win32 and directx sdk, most of the time i run into compiler errors as this code is out of date and wont compile with vs2005 pro. another problem im having is that most of the tutorials i find on the internet are not explained properly and end up reading do this, then this with no real explanation as too whats happening. im sure this forum will provide me with all the answers i require and you should all hear from me again soon :P

Share this post


Link to post
Share on other sites
dont worry about the window setup stuff, it worries a lot of people. fact is you use it once at program initialisation and never look again. i really wouldn't worry if you cant remember all the parameters of WndProc, provided you know whats going on with the functions.

also in my opinion the MSDN stuff is hit or miss. sometimes they have good explanations with examples, other times they just hash together a hopeless description.

Share this post


Link to post
Share on other sites
The important thing is, don't just remember, but understand why... I remember learning to fill out the WNDCLASSEX structure, all I did was to sit for an hour repeating it, not fun. I never thought about changing it, I never thought about changing the style etc. The important thing about very simple Win32 is to get the steps, first I fill a structure which contains information about the window, then I create the actual window with some parameters, after that I show the window and at least I start the message pump. You should understand the parameters, but there is no need to remember them. With a decent idea you should be able to write:

WNDCLASSEX wcex;
wcex.

and then get a list of fields, now just fill them in one at a time. In the same way when you place the opening paranthesis in CreateWindowEx you should see a list of parameters. If this doesn't work you should just look it up on MSDN. MSDN is not a good place to learn about Win32, unless you are experienced. If you want some additional information on a function it's very good though.

The best tutorial on the Internet, is IMO Triplebuffer's tutorial. You should focus on the text, not the code you want to understand the process, not remember the code. Also there is nothing wrong in reading a tutorial like this more than once, it can take some time to understand everything properly the first time.

Share this post


Link to post
Share on other sites
Yeah, don't get too intimidated by it. Find a basic tutorial for that stuff (just enough so you understand the basic concepts, like the message pump), and then you can design things in such a way that you abstract away most of that stuff. I typically have a "stupid_windows_stuff.h" :D.

Share this post


Link to post
Share on other sites
If you are writing DX apps, (as you seem to be from your post) then you only actually need to know a very small subset of Win32. Just the window creation and message handling code initially. The RegisterClass, CreateWindow, UpdateWindow, ShowWindow, PeekMessage functions and associated objects are probably the things you'll be using most at this stage (there are probably one or two others). But don't worry about remembering all the functions and objects. These will become more and more familiar to you as you use them.

You will be using a lot of the objects from DX and you can't expect to know all of them. When programming on windows, being able to read microsoft's documentation is a very important skill. I know you said you found it difficult, but you're going to have to get used to it if you are going to use DX. There is a lot to DX, and it gets updated quite often, so the docs are your best friend. Read through the sample source that comes with the SDK too if you're having trouble. And remember that we have a very helpful DX forum if you're having trouble.

I'm going to state a personal opinion here and say, don't use MFC. You have VS2005 Pro, which means you have C#. MFC is, in my opinion, bad. The apps which you would use MFC for are usually more easily created by a language more geared towards RAD (Rapid Application Development), such a C#. Just say NO to MFC [smile] - especially for games.

Hope that helps somewhat.

Share this post


Link to post
Share on other sites
thanks for everyones replies there very helpful nice to see a active forum for once :) ill have a crack at understanding MSDN and expect to hear back from me when i get stuck somewhere, i think i've understood basic concepts behind initialising a window and the message loop :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this