Sign in to follow this  

GDI Graphics

This topic is 1503 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Haven't programmed 2d stuff in awhile, is GDI+ still a decent way to go for 2d graphics? Looking at creating some small games for the windows surface pro and maybe RT, if not gdi what would you recommend?

 

Would be good if I didn't have to install the directx distributables too if possible...

 

Thanks,

 

rh

Edited by rhuala

Share this post


Link to post
Share on other sites

Well, I can say it's been quite a while since you haven't draw anything with code :) 

 

GDI is no longer an option now, but do you want to go for low level programming or do you want to make a 2D game (for which there are countless free frameworks and engines to choose from)?

Share this post


Link to post
Share on other sites

Well, I can say it's been quite a while since you haven't draw anything with code smile.png

 

GDI is no longer an option now, but do you want to go for low level programming or do you want to make a 2D game (for which there are countless free frameworks and engines to choose from)?

 

Would like to use c++ to design 2d strategy game, can you recommend a good c++ framework or engine for this?

 

Anyone hear of FTL, something like that, what would you say they used? But would like to incorporate touch screen:

 

http://www.kickstarter.com/projects/64409699/ftl-faster-than-light

Share this post


Link to post
Share on other sites

Isn't gdi+ super robust, reliable and and easy to use? Would like to keep things as simple as possible, reach as wide an audience and of course reliable with easy install... 

Edited by rhuala

Share this post


Link to post
Share on other sites

 

Well, I can say it's been quite a while since you haven't draw anything with code smile.png

 

GDI is no longer an option now, but do you want to go for low level programming or do you want to make a 2D game (for which there are countless free frameworks and engines to choose from)?

 

Would like to use c++ to design 2d strategy game, can you recommend a good c++ framework or engine for this?

 

Anyone hear of FTL, something like that, what would you say they used? But would like to incorporate touch screen:

 

http://www.kickstarter.com/projects/64409699/ftl-faster-than-light

 

 

FTL used SFML http://www.sfml-dev.org/

 

It takes ages to load and has performance issues on my (ancient i.e. 2006) PC though ;)

Edited by Paradigm Shifter

Share this post


Link to post
Share on other sites

GDI is certainly an option. The API is mature and has aged well since it was introduced thirty years ago.

With the latest few rounds of Windows some features have lost hardware acceleration. If you happen to be throwing around tens of thousands of sprites at once (which is NOT recommended, keep that number to a few hundred at most) then GDI may have some CPU-bound performance concerns.

GDI was semi-replaced by GDI+ a decade ago. Microsoft would prefer if you don't use the original GDI any more but there is so much legacy code that they cannot drop support for it. GDI+ has many features like transparency, antialiasing, and more modern compressed image formats.


There are many newer technologies available that offer newer features and are easier to use. For example, if you are working only with GDI you will likely find yourself spending untold hours manipulating images at a low level, decoding graphics files, working with bitmap parameters, and doing lower-level bit-twiddling that could have been avoided by using newer systems that operate at a higher level.

If you are using C# or managed C++ you will likely discover that the .net framework's graphics libraries are extremely easy to use. They use GDI+ internally and also add a large collection of additional utility features.

Another option, the one that Microsoft currently recommends, is to use Direct2D for advanced 2D graphics. It was part of the DirectX suite, earlier called DirectDraw. Most 3D games rely on its components as 'surfaces', giving things like a Direct Draw Surface and the various DDS image file formats. Some nice things about Direct2D are that is is hardware accelerated through the DirectX drivers, and that it manages to work well with GDI, GDI+, WDM, and various other Windows rendering systems. You can mix and match a surface with a GDI device context with very little transition code.

As for your desire to not ship with DirectX redistributables, that is not really an issue any more. DirectX is no longer an independent component, it has been integrated into the Windows SDK. DirectX 10 was part of Vista. DirectX 11was part of Windows 7 and Vista SP2, DirectX 11.1 was part of Windows 8. DirectX 11.2 is part of Windows 8.1. Microsoft announced years ago that they will not back-port new versions of DirectX to old versions of Windows. It is now just another part of the operating system, not a separate component.

 

Thanks a lot frob, that's really good info, much appreciated...

Share this post


Link to post
Share on other sites

GDI is certainly an option. The API is mature and has aged well since it was introduced thirty years ago.

With the latest few rounds of Windows some features have lost hardware acceleration. If you happen to be throwing around tens of thousands of sprites at once (which is NOT recommended, keep that number to a few hundred at most) then GDI may have some CPU-bound performance concerns.

GDI was semi-replaced by GDI+ a decade ago. Microsoft would prefer if you don't use the original GDI any more but there is so much legacy code that they cannot drop support for it. GDI+ has many features like transparency, antialiasing, and more modern compressed image formats.


There are many newer technologies available that offer newer features and are easier to use. For example, if you are working only with GDI you will likely find yourself spending untold hours manipulating images at a low level, decoding graphics files, working with bitmap parameters, and doing lower-level bit-twiddling that could have been avoided by using newer systems that operate at a higher level.

If you are using C# or managed C++ you will likely discover that the .net framework's graphics libraries are extremely easy to use. They use GDI+ internally and also add a large collection of additional utility features.

Another option, the one that Microsoft currently recommends, is to use Direct2D for advanced 2D graphics. It was part of the DirectX suite, earlier called DirectDraw. Most 3D games rely on its components as 'surfaces', giving things like a Direct Draw Surface and the various DDS image file formats. Some nice things about Direct2D are that is is hardware accelerated through the DirectX drivers, and that it manages to work well with GDI, GDI+, WDM, and various other Windows rendering systems. You can mix and match a surface with a GDI device context with very little transition code.

As for your desire to not ship with DirectX redistributables, that is not really an issue any more. DirectX is no longer an independent component, it has been integrated into the Windows SDK. DirectX 10 was part of Vista. DirectX 11was part of Windows 7 and Vista SP2, DirectX 11.1 was part of Windows 8. DirectX 11.2 is part of Windows 8.1. Microsoft announced years ago that they will not back-port new versions of DirectX to old versions of Windows. It is now just another part of the operating system, not a separate component.

 

Can gdi+ do semi transparency, like seeing a blue spherical shield around a space ship?

 

Not sure if by transparency you mean masking for a 2d sprite...

Share this post


Link to post
Share on other sites


Can gdi+ do semi transparency, like seeing a blue spherical shield around a space ship?
 
Not sure if by transparency you mean masking for a 2d sprite...

 

GDI by itself has extremely limited support for transparency. You can copy from one source to a destination ("blitting"). You can use a single key color that is marked as transparent or invisible, basically a "do not copy" color.  Drawing lines and filling areas would only work with a single color and no transparency.  In all cases writing to the destination obliterated whatever data was there.

 

GDI+ allows for alpha channels and alpha blending. So it is much more than simple blitting, you could provide a slider from 0-255 that lets you make a translucent copy on top of the destination. GDI+ also allows alpha blending when drawing lines or filling areas, where GDI did not. You can have a line that fades in, is invisible on one endpoint and fully visible on the other. It also has anti-aliased text and anti-aliased lines, using alpha blending on the edges.  GDI+ allowed you to preserve some of the information rather than completely obliterate the image.

 

So if you want to copy a blue bubble around your space ship, using GDI alone would give you a solid blue circle replacing all the old data.  With GDI+ you can assign a color matrix with a 50% alpha to the image attributes. When you draw the image with that color matrix assigned it will draw as 50% blue and 50% the old color.

Share this post


Link to post
Share on other sites

Using as much pre-built code as possible is good if the final goal is an actual game.  I suggest you take a look at GameMaker Studio, Construct 2, and even Unity.  These don't directly use C++, rather they have scripting languages you can use, and there is much less coding required with these because things like resource management is automatic.  In the case of Unity, it is meant more for 3d, but it has been successfully used for 2d games, and if you were to be interested in 3d later, it is a good idea to learn it.  As far as free versions, Unity is also the winner there, because though it has limitations, they are very unlikely to be a deal breaker, mostly having to do with advanced rendering features many games don't even need.  GameMaker Studio has a free version, but they put limitations on things like resources, so it isn't really useful, as it is more of a trial version, not one you would use for your final game.  Unity Free on the other hand you could use just fine for the final version.

Share this post


Link to post
Share on other sites

This topic is 1503 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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

Sign in to follow this