2D Lightning & Kerning

Previous topic - Next topic

S.O.P.M.

Hello guys,

I wonder how to make good light effects in a 2D game. Then I thought I can make a kind of mask for each light that has a gradient from completely transparent to non transparent pixels. The result you can see in the attached file (you can move the lights by mouse). It looks quite good for the first try but it seems that GLBasic doesn't use the entire transparency range. The gradient suddenly stops before the last very transparent pixels and so I have these annoying edges. It still doesn't look like a natural light. I could use several masks that can be combined to make various light shapes but I always have these edges. So anybody an idea for a workaround?

The second thing is the font kerning option. I know this was thematised before but I think this is still important to change. As you can see in this demo the lettering "Lightning Demo" doesn't look nice. That is because the font kerning option always uses a single pixel space between the letters. 1 pixel space looks good for small fonts which 1 or maybe 2 pixel thickness. But in this case it would be really helpful to just have the option to make the space bigger. I am sure this would be really easy and fast to implement. And yes, I know there's a workaround for this but it cannot use in every situation. So please Gernot, think about it!

Thanks,
S.O.P.M.
Notebook PC Samsung E372 Core i5 @ 2,6 GHz; 4 GB RAM; Win 7 Home Premium

fivesprites

For the alpha issue, try using:

ALPHATESTING 0.001


//Andy

S.O.P.M.

Omg this works very well, thank you so much! I did not know about the ALPHATESTING command O_O
Notebook PC Samsung E372 Core i5 @ 2,6 GHz; 4 GB RAM; Win 7 Home Premium

fivesprites

More than welcome :)

//Andy

Moru

The font kerning distance can be adjusted with the fontlibrary from PeeJay after some changes I did. Yes I finally put together a new homepage and I think I got the latest code there too... Let me know if anything breaks, haven't touched it in quite a while :-)

Bitmap font routines

S.O.P.M.

Wow, that's some nice work. But I assume it could be too slow on mobile devices which I would like to code for. The DrawText Function processes every single char with GLBasic commands and I think this will become slow when printing too much text at a time. So I still want to request to have this implemented as standard. 0 = no kerning, X = kerning + additional pixel space
Notebook PC Samsung E372 Core i5 @ 2,6 GHz; 4 GB RAM; Win 7 Home Premium

Albert

With ALPHATEST it looks quite cool!

Moru

When using text in games, you print to an off-screen buffer. No need to print every letter each VBL. Just draw it once and then paste the image to the screen every frame.

S.O.P.M.

Oh cool, so that's faster? I didn't consider this before, will give it a try as far as I understand right. With off-screen buffer you mean a virtual screen?
Notebook PC Samsung E372 Core i5 @ 2,6 GHz; 4 GB RAM; Win 7 Home Premium