tags:

views:

32

answers:

1

Hi, i want to create a basic game Draw engine class for my 2D game. i'm not quite sure whether to share main window handle with class or keep it private as it is in the main class. The other way i'm thinking to do is pass the device context itself to draw engine class. which would be the standard way to work with draw engine?

+1  A: 

I would say pass the Device Context in as you can always call GetDC(hWnd) in order to obtain the device context, however, the benefits of having the hWnd are that you can get the Client Size etc.. so, in that regard, the hWnd would be the best (perhaps save the hWnd in the class).

In terms of speed, you probably want to limit the number of calls to GetDC().

Reaper