Home » Community » Forums » » Using the Windows Template Library Part 1
  Intel sponsors gamedev.net search:   
[Control Panel] [Register] [Bookmarks] [Who's Online] [Active Topics] [Stats] [FAQ] [Search]

Add Forum to Favorites |  Send Topic To a Friend | View Forum FAQ | Track this topic


 Last Thread Next Thread 
 Using the Windows Template Library Part 1
Post Reply 
Heh, interesting. I think I'll try using that for my next project.

 User Rating: 1185   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

Yeah, definately worth a look. Very good article. Thanx


pan narrans | My Website | Study + Hard Work + Loud Profanity = Good Code

 User Rating: 1788   |  Rate This User  Send Private MessageView ProfileView Journal Report this Post to a Moderator | Link

Well written + informative. Thank you!

 User Rating: 1643   |  Rate This User  Send Private MessageView ProfileView Journal Report this Post to a Moderator | Link

Wow, that's some good info there... and interesting too.

However I have to disagree with your comment about this WTL code being more maintainable than standard Win32 code. All that BEGIN_WHATEVER_MACRO_MESSAGE(stuff) is nasty on the eyes. Also classes--just by their definition--add an often uneeded layer of administration and confusion to the mess.

 User Rating: 1015    Report this Post to a Moderator | Link

Great article, I finally learn what the WTL is Too bad it's not multiplatform...

quote:
Original post by Anonymous Poster
All that BEGIN_WHATEVER_MACRO_MESSAGE(stuff) is nasty on the eyes.


#define niceLookIngfunct4r BEGIN_WHATEVER_MACRO_MESSAGE

--edit--

Oh, WTL 7.1 is out, yay!

[edited by - Leffe on January 15, 2004 2:46:58 PM]

 User Rating: 1134   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

Thanks for the complements!


quote:

Original post by Anonymous Poster
However I have to disagree with your comment about this WTL code being more maintainable than standard Win32 code. All that BEGIN_WHATEVER_MACRO_MESSAGE(stuff) is nasty on the eyes. Also classes--just by their definition--add an often uneeded layer of administration and confusion to the mess.



Once you get use to the style it's not quite as unsightly. You'll see more advantages to using objected oriented wrappers around the Win32 windowing API in later articles.

quote:

Original post by Leffe
Oh, WTL 7.1 is out, yay!



Yeah, I submitted the article over a year ago and it seems it was misplaced. I'm happy to see that they did finally post it (I had believed that Gamedev simply decided not to publish it). Fortunately, now that Microsoft has .Net, not done much has changed with the ATL/WTL libraries. The 7.1 libraries can be used in place of the 7.0 libraries.

[edited by - Solo on January 15, 2004 9:59:24 PM]

 User Rating: 1028   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

Uhm... another template related article. (but this time a better one).

The goods:

+ I like these "Building from Cratch" - tutorials!
+ The concrete comparison between Win32 code, MFC code and WTL code was imho not done before. Everybody talks about the differences, but this time we got an concrete example. Nice!
+ For a noob to WTL (but an experienced ATL/template coder) it covers already the most important things (and that on only 4 sheets - impressive!)

The bads:

+ What i really missed - fortunately one of the Editors mentioned it at the end - is a link to one of the best WTL tutorials on the net imo: WTL for MFC Programmers by Michael Dunn
+ The comparison between the apps - as good as it is - focuses on code size than on speed. That is for the minimalistic App ok, but for bigger projects, templates in general tends to produce faster but even large-sized code than class hierarchies. This comes through the fact of the much special code generation, e.g. VecImpl< float, 3 > Vecf3; VecImpl< int, 2 > Vec2i; VecImpl< FixedImpl< 32 >, 4 > MtxFix32;
+ CWindowImpl is only slightly touched in the article... but this is the only template-related paragraph and is at the same time one of the main concepts of WTL. There should be imho some more words about the idea behind it.
+ I missed a hint to install and use the ATL/WTL wizards, which do already a good job preparing an application.

However, nice work. Very good readable and well designed. I wait for the next part

=Cy=.

[edited by - cylogic on January 16, 2004 4:58:32 AM]

 User Rating: 1015   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

Great article! I have a question, though:
is WTL flexible enough to use it for making User Interface (in-game windows, menus and so on). If yes, what about it's performance and possibilities of customization?
If not - what is its purpose in programming games? Writing an application class (which encapsulates Win API functionality) is one of the easiest activieties when writing a game (correct me if I'm wrong - I'm only a newbie, and maybe there are some difficult parts, which I've never encountered...)

thanks for the article

Adam 'Psyho' Pohorecki

 User Rating: 1015   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

quote:

Original post by cylogic
The comparison between the apps - as good as it is - focuses on code size than on speed.



Comparing speed is difficult at best. 99.9 percent of the time the app is just sitting around waiting for a message to arrive. If the WTL does that better than MFC it'd be hard to tell.


quote:

Original post by cylogic
... templates in general tends to produce faster but even large-sized code than class hierarchies. This comes through the fact of the much special code generation, e.g. VecImpl< float, 3 > Vecf3; VecImpl< int, 2 > Vec2i; VecImpl< FixedImpl< 32 >, 4 > MtxFix32;



True, but here we take advantage of the fact that 90 percent of the classes MFC offers we don't need. You'd have to implement a lot of windows before the size of the app finally caught up. One of the reasons the ATL libraries were created was because, at that time, developers where toying with the idea of using OLE controls on web pages. They needed a lightweight alternative to using MFC to create their OLE controls because the end users were going to be downloading them.

cylogic - most of the items you'd like to see will appear as the series plays itself out. Thanks for the comments!



quote:

Original post by psyho
...what is its purpose in programming games? Writing an application class (which encapsulates Win API functionality) is one of the easiest activieties when writing a game...



Yup. But why reinvent the wheel. You'd be hard pressed to do it better than the WTL does.

quote:

Original post by psyho
is WTL flexible enough to use it for making User Interface (in-game windows, menus and so on)



Hadn't thought about it much but I suppose you could create your own handlers for WM_PAINT, WM_NCPAINT, WM_NCACTIVATE, ect. and do the drawing with DirectX instead of the GDI. I've never had a reason to paint the non client area so I'm not sure how much trouble it would be to do.




 User Rating: 1028   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

Nice article you've got yourself there.. it really gives a great alternative to the "oh-so-much-discussed" MFC

Anyways, looking forward to the next parts of the article as I've always wondered what WTL was and now it seems I've got an easy chance to find out

Keep up the good work :D



 User Rating: 1015   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

quote:
Original post by Solo
quote:
Original post by psyho
is WTL flexible enough to use it for making User Interface (in-game windows, menus and so on)

Hadn't thought about it much but I suppose you could create your own handlers for WM_PAINT, WM_NCPAINT, WM_NCACTIVATE, ect. and do the drawing with DirectX instead of the GDI. I've never had a reason to paint the non client area so I'm not sure how much trouble it would be to do.
I tried a while back to fool around with the owner-draw features of Win32 controls (which the WTL wraps). Damn-near impossible to do it with DirectX because of the fact that the main context used by DirectX does not generate WM_PAINT messages, for one thing. There were a few other issues, but I forget what.

An interesting exploration would be owner-drawing Windows.Forms controls using Managed DirectX... Any takers?

 User Rating: 2027   |  Rate This User  Send Private MessageView ProfileView Journal Report this Post to a Moderator | Link

I dont use MFC or WTL any more, all managed c and C#
Its SSSOOOOOOOO!!!! much better.

 User Rating: 1015   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

Good work - nice to see this finally see the light of day.

[ MSVC Fixes | STL Docs | SDL | Game AI | Sockets | C++ Faq Lite | Boost
Asking Questions | Organising code files | My stuff | Tiny XML | STLPort]


 User Rating: 1905   |  Rate This User  Send Private MessageView ProfileView Journal Report this Post to a Moderator | Link

I strongly recommend people dont use WTL -- because of the virtual complete lack of documentation. It is OK for coders, but for maintainers such as me who have to deal with WTL + ATL + MFC + native it adds an extra level of complexity.

I strongly agree with the comment above to forget the whole nightmare and use c#



 User Rating: 1015    Report this Post to a Moderator | Link

All times are ET (US)

Post Reply
 Last Thread Next Thread 
Forum Rules:
You may not post new threads
You may post replies
You may not edit your posts
You may not use HTML in your posts
Jump To:
Administrative Options: