'How can i display partly-transparent pictures in Graphics.h

For creating a small game for a competition in class we are using graphics.h

I wanna make a small platformer and I need transparent backgrounds for the player sprites.

How can i accomplish this?

I am using visual studio 2015 community edition and win10.



Solution 1:[1]

You can use readimagefile(); to add partly-transparent gif (or other format which allows transparency and is compatible with readimagefile).

You cannot use getimage or putimage without losing transparency.

NOTE: this method is slow because the code directly read the image file from the drive which slows down the code .

Solution 2:[2]

If you must use graphics.h you need to install Turbo C/C++, which you cannot install on recent version of Windows. To install Turbo C++, you need to install DOSBox on Windows, and then install Turbo C++ inside DosBox.

If you can use Visual C++, you need to learn Windows GDI programming.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Littm
Solution 2 Ajay