Help making a game with transparency

Adam D. Ruppe destructionator at gmail.com
Sat Sep 28 14:33:03 UTC 2019


On Saturday, 28 September 2019 at 08:06:02 UTC, GreatSam4sure 
wrote:
> The last time I try this library on windows 10 it throws 
> errors. Have you try it recently on windows

What errors? I sometimes break it with careless pushes to master 
but it usually works for me.

> I want to know can the windows be customized and does it 
> support styling like JavaFX

simpledisplay creates a blank window, what goes in it is entirely 
up to you (you can even do a flag to skip the titlebar if you 
want, though I recommend against that generally as I find it 
user-hostile). There's three ways to draw in it:

1) the basic functions ScreenPainter provides (drawImage, 
drawRectangle, drawLine, etc), none of which do alpha blending 
and probably never will (though they might do mask-based 
single-color transparent pixels at some point when I get around 
to it or if someone sends me a PR). Nothing fancy here.

2) OpenGL functions. The simplewindow constructor can create a 
context for you for various opengl versions. Old style 
glBegin/glEnd is the default and has prototypes included inline. 
Newer style stuff is opt-in and you may need to load functions 
via an additional library (for example, the nanovega.d lib in 
there does this and includes its own vector graphics API, 
including alpha blending btw) or by dynamically loading them 
yourself (all the pieces are in simpledisplay it just doesn't do 
it all by default). These can get as fancy as you want.

3) Operating system functions. You can get at the window 
id/handle via the impl member of the window and hook the native 
event loop, call native functions, etc. to your heart's desire. 
If you do something that is generally useful and can be done at 
reasonable cost on X11 (Windows and Macintosh are both quite 
capable, it is usually X that ends up being the lowest common 
denominator), send me a PR and I might add it to screenpainter's 
api.


If you're looking for UI widgets like buttons and such, again you 
can DIY or my minigui.d contains a bunch of them. But they only 
contain the ones I have personally used so far and only do the 
styles I personally like and can implement cheaply and easily. 
There's no fancy CSS or animations or anything like that. I 
sometimes consider it but I'm personally pretty meh on them so 
don't expect it any time soon.


But if you all want that, on your schedule, smash that like 
button, comment, subscribe, and be sure to ring that bell so you 
get a notification every time I parrot what people say on Youtube 
at the end of their videos. Then head on over my patreon page and 
give me all your money today. If everyone who downloaded my 
libraries contributed just $3 / month, I'd be able to devote 
myself to expanding these libraries to support more use cases.

But until then, I write these for myself (or, in rare cases, 
someone else writes them for me and contributes it like with 
nanovega) so the functionality tend to focus on what I have used 
myself in the past. Then I post them online since it is easy to 
do so... then if you find them useful, great, and if you don't, 
oh well, there's always SDL or gtkD or html5 in electron (LOL) to 
cover more cases.


More information about the Digitalmars-d-learn mailing list