Archived

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

API or not?

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

In my current project, I am going to rely somewhat heavily on windows and all their little pet controls. I was wondering, for those who use the Win API, as opposed to those who have lots of time on their hands (of which I am part of) who coded their own window classes: Which should I do? The game will be heavily GUIed but it is not a fast paced game, almost closer to an application in terms of activity. However, as I said above, I have lots of time on my hands and no set date for the project''s completion as it is a personal thing. So what do you all recommend? Use the Windows stuff or make my own? Or should I post more information? Thanks a lot.

Share this post


Link to post
Share on other sites
Are you asking whether or not you should use MFC vs. making calls directly to the Win32 API? If that''s your question, I think it''s more a combination or personal choice, deadline requirements of the project (which you say are basically none), and the type of program you''re building. Since you say that the what you''re building would be closer to an "application" (I assume you mean something like Word or Excel) in terms of performance requirements, then MFC could be very helpful to you. Calling directly to the Win32 API is more time-consuming, but possibly yields better performance and is also more of an educational journey through low-level Windows (if you''re into that sort of thing).

If you''re asking whether or not you should use the Win32 API...Well, I''m no expert on all things Windows, but I don''t think you can program a Windows app without using that Win32 API (unless you plan to use Assembler).

Share this post


Link to post
Share on other sites
I think it depends on the type of game you''re making. MFC is a thin wrapper of the Win32 API common controls, so it make sense to use it unless you''re an advanced programmer and making custom controls.

Also, you can use MFC and still blend in your own graphics functionality, i.e. make shapes, manipulate colors etc. in say a derivation of the CView class, using the Windows GDI (I think that''s what it is called). However it''s definitely not the optimum way to implement high-framerate graphics updates.

I think some example MFC programs in certain books show how you can use the GDI to make simple sketch and paint programs. That might be a good place to start.

Share this post


Link to post
Share on other sites
NO! Not MFC, Ive had enough trouble dealing with MFC. What I mean is say I want a button, do I do

CreateWindow( BUTTON, ... )
after doing CreateWindow( blahblah )

or would it be better to make a completly independant windows system, something along the lines of the "Programming a GUI Using DirectX" article in the Gamedev archives, which barely touches on the API.

What I mean by application is yes Excel, Word, etc, but in the sence which I am using it, I am trying to say that my game is not a fast paced reaction clicker, more of a read, contemplate, act type.

I appreciate input, maybe it would be better if there are some pros or cons for each approach-this is IMO the most sensitive part of the project. If I realise later on that the way I went is giving me performance hits, then it will probably be pretty tough to change the setup.

Just to further clarify things,
what I am saying is is it better to create a window using
the CreateWindow( ... ) function or to do

class DRMOLS_WINDOW_CLASS
{
//Redrawing code
//Creation Code
//Coordinates
//BackGround
}

Thanks again.

Share this post


Link to post
Share on other sites
I''d suggest that you learn MFC. It''s not that hard to use (and it''s a hell of a lot easier than straight Win32). Plus it''s very easy to write custom controls. You could write your own GUI code, but what''s the point? Windows has been in use for years and it''s GUI code is relatively bug-free, so why re-invent the wheel (unless you''re in a DirectX or opengl environment and don''t have much choice)

You can probably find other people''s custom GUIs out there. I know there''s plenty which work for either DirectX or opengl, so why not for GDI?


codeka.com - Just click it.

Share this post


Link to post
Share on other sites
I would recommend using the Windows API. Everything is already there for you and unless you are a good artist, it is hard to make a homemade GUI look good.

---
Make it work.
Make it fast.

"Commmmpuuuuterrrr.." --Scotty Star Trek IV:The Voyage Home

Share this post


Link to post
Share on other sites
Thanks for the input! I have decided. For now, I am going to use winAPI but encapsulate it as much as possible, at the expense of speed. Later on when I have the core game up and running, I will go back and create my own interface, for both the educational experience and the enjoyment of it, and hopefully, the windows code will be seperate enough for me to be able to plug in my homemade stuff later on.

Share this post


Link to post
Share on other sites
I just wanted to point out that everyone who responded to this post other than CaptainJester and myself need to learn to READ. Not a single other person managed to come even close to answering his question or even understanding it hehe. As for my opinion...

I think that making your own objects would be a very tedious task but as long as you are doing it for your own personnal satisfaction and education, I think its a very good idea. Definately something worth the effort just to be able to say you did it, did it right, and made it look good!

~Vendayan

[edited by - Vendayan on June 26, 2002 10:36:03 PM]

Share this post


Link to post
Share on other sites
quote:
Original post by Vendayan
I just wanted to point out that everyone who responded to this post other than CaptainJester and myself need to learn to READ. Not a single other person managed to come even close to answering his question or even understanding it hehe. As for my opinion...



Get off your high horse. Jester said to use the Windows API. I said I perfer the Windows API. Stop quibbling over words. I think the original poster can clearly see our points; it''s a shame you fail to.

Speaking of which, maybe you should read :

quote:

So what do you all recommend? Use the Windows stuff or make my own?


Most of the people here responsed promptly to that question.

But for the sake of your happyness..I bow down to your superior thread responding skills.

Share this post


Link to post
Share on other sites
munkie, he said..

quote:

or would it be better to make a completly independant windows system, something along the lines of the "Programming a GUI Using DirectX" article in the Gamedev archives, which barely touches on the API.



He is obviously talking about making his own GUI. He made his decision long ago that he wasn''t using MFC, and was mearly deciding whether or not to use common controls or make his own ''common controls''. So why is everyone trying to explain the different benefits of using MFC or Windows API?!

He is trying to reinvent the start button or something not decide whether to use MFC or straight API.

~Vendayan

Share this post


Link to post
Share on other sites
Huh boy, look what Ive gone and started!

Thank you all very much for your opinions. I personally do not like MFC, I think that if you make a wrapper for anything, it is probably best to do it personally, or get it from someone who can tell you how it does what it does. I think that code reuse is a great thing for quick and dirty programs, but IMHO, it is not well suited for game programming. I think that not being able to see the implementation is a big disadvantage, since you dont know exactly what is going on, and in other cases, when you can see what is going behind public: it takes quite a while to wade through code, and frankley, ive always had trouble figuring out other peoples code. It is always: OK, is this a function he wrote or a system function? Ok, Ill search for it. Here it is, uh-oh, he is calling a function from this function...search for that...now what was the original question? Its a bit too much like police work to me. When I write something I know where it all goes, where it all comes in, and how it is all processed. Plus I dont feel so guilty. The only things I have reused is an exception handling system, and the random generator.

Vendayan thanks for the encouragment, it is always good to learn something new, everyone speaking about MFC, well thanks because I dont feel so left out at disliking it-a shame since I did love to use CString. That was MFC''s shining star as far as I am concerned.
And thanks everyone for you input and assistance. I am now confident that I can move forward with the next phase of my project.


Share this post


Link to post
Share on other sites
"a shame since I did love to use CString. That was MFC''s shining star as far as I am concerned."


You should investigate std::string. The MFC''s container stuff looks to have been designed to approximate STL anyway, and you can do it without the MFC''s overhead.

Share this post


Link to post
Share on other sites