Advertisement

Direct2D for 2D games

Started by July 02, 2018 10:45 AM
3 comments, last by ROGRat 6 years, 3 months ago

Is it reasonable to use Direct2D for some small 2D games? I never did too much of Direct2D stuff, mostly I used it for displaying text/2D GUI for Direct3D engine etc. but I never tried doing game in it. Is it better to use Direct2D and sprites or would you prefer to go with D3D but with 2D shaders // is D2D not meant for games, no matter how big or small, at all?

Hi,

I think you have the answer on MSDN :) (https://docs.microsoft.com/en-us/windows/uwp/gaming/working-with-2d-graphics-in-your-directx-game)

Quote

You can develop 2D gaming graphics in DirectX using either Direct2D or Direct3D, or some combination. Many of the more useful classes for 2D game development are in Direct3D, such as the Sprite class. Direct2D is a set of APIs that primarily target user interfaces and apps that require support for drawing primitives (such as circles, lines, and flat polygon shapes). With that in mind, it still provides a powerful and performant set of classes and methods for creating game graphics as well, especially when creating game overlays, interfaces, and heads-up displays (HUDs) -- or for creating a variety of 2D games, from simple to reasonably detailed. The most effective approach when creating 2D games, though, is to use elements from both libraries, and that's the way we will approach 2D graphics development in this topic.

 

You can also use this : (it uses Direct3D)

https://github.com/Microsoft/DirectXTK/wiki/Sprites-and-textures

https://github.com/Microsoft/DirectXTK/wiki/SpriteBatch

I would personally use Direct3D to draw the sprites, and depending on the time I want to spend on the game use Direct3D or 2D/Write to draw texts and interfaces. I've only used Direct2D/DirectWrite to draw interfaces and texts, but I think you'll get more flexibility with Direct3D for sprites.

Hope this helps

Advertisement

Is direct2D not for screen coordinates ?, better take 3D then if that is true, all computers have different monitor.

S T O P C R I M E !

Visual Pro 2005 C++ DX9 Cubase VST 3.70 Working on : LevelContainer class & LevelEditor

On 7/2/2018 at 8:45 PM, kkmzero said:

Is it reasonable to use Direct2D for some small 2D games? I never did too much of Direct2D stuff, mostly I used it for displaying text/2D GUI for Direct3D engine etc. but I never tried doing game in it. Is it better to use Direct2D and sprites or would you prefer to go with D3D but with 2D shaders // is D2D not meant for games, no matter how big or small, at all?

I’ve implemented a complete engine using DXGI (for access to a SwapChain and Output devices) and Direct2D.  If used properly it’s very fast and is easy to work with.  Of particular interest to game developers is the SpriteBatch class, which can punch out thousands of sprites, with transforms and effects, per frame on modest hardware

This topic is closed to new replies.

Advertisement