Jump to content
  • Advertisement

Archived

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

Eriond

Syntax question and question about GetAsyncKeyState

This topic is 5231 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

I have seen people do like this:
if (::GetAsyncKeyState('B') & 0x8000f)  
Why not just
if (::GetAsyncKeyState('B'))  
? The second question is about syntax. In a sample chapter from Modern C++ Design I saw this code:
template <template <class> class CreationPolicy>
class WidgetManager : public CreationPolicy<Widget>
{
    ...
    void DoSomething()
    {
        Gadget* pW = CreationPolicy<Gadget>().Create();
    ...
    }
};
Why does he write:
template <template <class> class CreationPolicy>  
? [edited by - Eriond on March 24, 2004 10:22:33 AM]

Share this post


Link to post
Share on other sites
Advertisement
To answer your first question, GetAsyncKeyState returns information on a given key on a the keyboard as a series of flags in a 32-bit integer. It just so happens that 0x8000 is the bit which checks wether the key is down or not. Since this is generally what we want to know when we use GetAsyncKeyState, I''m pretty sure you can deduce the answer to your question now.

Share this post


Link to post
Share on other sites
Thank, I thought it was something like that but I wasn''t sure. Now there is only the second question left

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!