Constant framerate in WPF for game

后端 未结 3 1728
没有蜡笔的小新
没有蜡笔的小新 2021-02-08 19:17

Im creating a simple vehicle and projectile simulation game in WPF using C#. I need to have a constant frame rate (i.e. i need to know how much to move an object with a certain

3条回答
  •  一个人的身影
    2021-02-08 19:36

    You can use WPF to draw the surrounding UI of your game and then use the DirectComposition API to have the Composition Engine (DWM) compose your swapchain directly on top of WPF's window.

    I have uploaded a sample demonstrating this on github.

    The UI would not have a constant frame rate, but your swapchain would. Hittesting would just fall through to the WPF window.

提交回复
热议问题