开发者

Basic Game DrawEngine question

开发者 https://www.devze.com 2022-12-17 20:31 出处:网络
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 oth开发者_C百科er

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 oth开发者_C百科er 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?


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().

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号