Help making a game with transparency
Murilo
murilomiranda92 at hotmail.com
Fri Sep 27 21:16:07 UTC 2019
On Friday, 27 September 2019 at 17:53:33 UTC, matheus wrote:
> On Friday, 27 September 2019 at 16:36:14 UTC, Murilo wrote:
>> ...Do you know the arsd library?
>
> Yes but I use mostly terminal.d and others.
>
> On the other hand I use to code games too using SDL and OpenGL.
>
> I know for example in OpenGL you can do:
> glEnable(GL_ALPHA_TEST); to enable alpha channel and set
> transparency.
>
> Matheus.
Thanks, but I don't know how that will fit in my code. I will
show up a code snippet and you tell me how I can use your idea in
it, okay?
import arsd.image, arsd.simpledisplay;
void main()
{
auto memImgShip = loadImageFromFile("ship.png"),
memImgBackground = loadImageFromFile("background.png");
auto imgShip = Image.fromMemoryImage(memImgShip),
imgBackground = Image.fromMemoryImage(memImgBackground);
auto window = new SimpleWindow;
window.eventLoop(10,
{
auto painter = window.draw;
painter.drawImage(Point(0, 0), imgBackground);
painter.drawImage(Point(100, 100), imgShip);
});
}
Here it is, how do I make the ship have a transparent background?
More information about the Digitalmars-d-learn
mailing list