Page 1 of 1

Urgent: Using Layers

Posted: Thu Jan 19, 2012 8:25 pm
by djrikki
Hi,

I am trying to use the command CreateLayer, problem is I cannot get rid of the background colour.

CreateDisplay(1, {Color = #YELLOW)
CreateLayer(10,10,240,70, {Color = #BLACK, Mask, Layers = True} )
SelectLayer(1)
Cls()
SetFontColor(#RED)
TextOut(#CENTER,#CENTER,"hello")
EndSelect()
OpenDisplay(1)
ShowLayer(1)
Wait(200)

How do I get this simple example to simply show Red Text sat on a yellow display?

Require an answer asap... tonight would help!!

Re: Urgent: Using Layers

Posted: Thu Jan 19, 2012 9:41 pm
by jalih
Some simple example on basic layer usage... Hope it helps!

Example just creates two layers: "HelloBox" and "HelloText" and does something with them.

Code: Select all

@DISPLAY {Width = 640, Height = 480, Title = "Simple Layer test"}

EnableLayers()

SetFillStyle(#FILLCOLOR)
Box(#CENTER, #CENTER, 300, 200, #RED, { Name = "HelloBox", AnchorX = 0.5, AnchorY = 0.5, RoundLevel = 25, Hidden = True })
SelectLayer("HelloBox")
SetFont(#SANS, 50)
SetFontColor(#WHITE)
SetFontStyle(#ANTIALIAS)
TextOut(#CENTER, #CENTER, "Hello World!")
EndSelect()

SetFont(#SANS, 54)
SetFontColor(#RED)
TextOut(#CENTER, #CENTER, "Hello World!", { Name = "HelloText", AnchorX = 0.5, AnchorY = 0.5, Hidden = True })

ShowLayer("HelloBox", #CENTER, #TOPOUT)
ShowLayer("HelloText",  #CENTER, #TOPOUT) 

Local ang = 0
Local transp = 0
Local dtransp = 2
Local y = -200

Repeat
	y = y + 2
	y = Wrap(y, -200, 680)
	ang = ang + 2
	ang = Wrap(ang, 0, 360)
	transp = transp + dtransp
	If transp >= 255 Or transp <= 0 Then dtransp = -dtransp

	VWait()
	SetLayerStyle("HelloBox", { Y = y, Rotate = ang, Transparency = transp}) 
	SetLayerStyle("HelloText", { Y = y } )  
Forever