USESCREEN and transparent

Previous topic - Next topic

ampos

I am using a sprite to draw my menu:

Code (glbasic) Select
USESCREEN -1
DRAWBACKGROUND()
USESCREEN 1
DRAWMENU()
USESCREEN -1
DRAWSPRITE 1,0,0
SHOWSCREEN


My problem is that I can not clear the sprite/menu and make it transparent. I want the zones in the menu_sprite not drawn to be transparent, so the background is shown under my menu_sprite.

BigAnd

#1
I think you have to clear your screen to the colour you use as transparent. By default its usually that bright purple (255,0,128).

spacefractal

Look for the code on the help section.

I Did have same problem, but easy to do.

Just draw a rect using the transparency color. Then it's will clear with transparency.

Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

Slydog

Since the menu appears static, you could always include the background with the menu sprite, and only draw one sprite each frame.
Unless the background isn't static!

Code (glbasic) Select
USESCREEN 1
DRAWBACKGROUND()
DRAWMENU()
USESCREEN -1

WHILE TRUE
  DRAWSPRITE 1,0,0
  SHOWSCREEN
WEND
My current project (WIP) :: TwistedMaze <<  [Updated: 2015-11-25]

ampos

The background is moving, but I just realize that I can draw the moving background on the menu sprite...

Anyway, I will try clearing the menu with 255,0,128... just for trying.

I tried before

clearscreen 0xff000000, 0xffffffff, 0x00000000, 0x00ffffff with some interesting results.

spacefractal

dont use CLEARSCREEN command, its wont work very well, But instead you use DRAWRECT.

USESCREEN 2
SETTRANSPARENCY RGB(0,0,0)
DRAWRECT 0,0,999,999,RGB(0,0,0) // will draw black colour _AND_ transparent alpha

found from (I posted extractly or near the same as you):
http://www.glbasic.com/forum/index.php?topic=6233.0
Do the job.
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/