Jump to content
Sign in to follow this  
  • entries
    67
  • comments
    82
  • views
    37082

Further questions

Sign in to follow this  
wijnand

141 views

My teacher basically told me today that the renderer engine should be seperate of the Window manager. The goal is to write a Window Manager that allows me to create multiple windows . The problem is, how do you write a class out of a WIN32 API? I know I need to do a window function call but how do you manage to put this in an OOP Perspective?

My friend already wrote some code, but it refuses to compile, and I am quite curious on how other people have solved this problem :)

Sign in to follow this  


4 Comments


Recommended Comments

I think I understand what's going on here. If I'm barking up the wrong tree, please ignore me. :)

Since you're writing a wrapper class around a Win32 HWND, you'll need a static or non-member function to register as a WindowProc. From there, you can call a specific non-static WindowProc function that's right for the class.

Without giving you code, since this sounds like it's for an assignment, here's what you need:
1) create the window (HWND), using a static member function as the WindowProc
2) call SetWindowLong (or SetWindowLongPtr), to register your "this" pointer as user data for the window
3) when the window generates an event, you'll get to the static function. From there, do a GetWindowLong, cast that back to a Window*, then call a non-static member function pointer->HandleEvent.

Does that make sense?

Hope it helps. :)

Share this comment


Link to comment
sounds feasable, so with this i can run multiple window instances with a new game in it? :)

Thank you!

Wijnand

Share this comment


Link to comment
lol i do not mind a kick in the right direction, but rather not get a complete listing of the solution. But thanks for the feedback thus far :D

Share this comment


Link to comment

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
  • 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!