Dear Cerberus X User!
As we prepare to transition the forum ownership from Mike to Phil (TripleHead GmbH), we need your explicit consent to transfer your user data in accordance with our amended Terms and Rules in order to be compliant with data protection laws.
Please read the new Terms and Rules below, check the box to agree, and click "Accept" to continue enjoying your Cerberus X Forum experience. The deadline for consent is April 5, 2024.
Do not accept the amended Terms and Rules if you do not wish your personal data to be transferred to the future forum owner!
Accepting ensures:
- Continued access to your account with a short break for the actual transfer.
- Retention of your data under the same terms.
Without consent:
- You don't have further access to your forum user account.
- Your account and personal data will be deleted after April 5, 2024.
- Public posts remain, but usernames indicating real identity will be anonymized. If you disagree with a fictitious name you have the option to contact us so we can find a name that is acceptable to you.
We hope to keep you in our community and see you on the forum soon!
All the best
Your Cerberus X Team
Strict
Import mojo2
Class myClass Extends App
Field canvas:Canvas
Field fore_img:Image
Field fore_cnvs:Canvas
Field back_img:Image
Field back_cnvs:Canvas
Field block_img:Image
Method OnCreate:Int()
' load in default demo tile
block_img = Image.Load("t3.png")
' Set up random for ground
fore_img = New Image(400,400,0,0)
fore_cnvs = New Canvas(fore_img)
fore_cnvs.Clear(0,0,0,0)
fore_cnvs.SetColor 0,0,0,1
Local i:Int=0
While i<20
fore_cnvs.DrawRect(Rnd(400),Rnd(400),32,32)
i=i+1
Wend
fore_cnvs.Flush()
' set up background
back_img = New Image(400,400,0,0)
back_cnvs = New Canvas(back_img)
back_cnvs.SetAmbientLight(0.5,0.5,0.5,0.5)
back_cnvs.SetLightPosition(0,100,100,-100)
back_cnvs.SetLightColor(0,1,.5,1)
back_cnvs.SetLightRange(0,400)
back_cnvs.SetLightType(0,1)
' back_cnvs.SetShadowMap(fore_img)
back_cnvs.Flush()
SetUpdateRate(60)
canvas = New Canvas
Return 0
End
Method DrawBack:Void()
back_cnvs.Clear(0,0,0,0)
Local y:Int=0
While y<400
Local x:Int=0
While x<400
back_cnvs.DrawImage block_img,x,y
x=x+128
Wend
y=y+128
Wend
End
Method OnUpdate:Int()
Return 0
End
Method OnRender:Int()
' Clear the canvas with a black color.
canvas.Clear (0,0.5,0)
' position light
back_cnvs.SetLightPosition(0,MouseX(),MouseY(),-100)
' draw background
DrawBack()
back_cnvs.Flush()
' draw back and fore to cnvs
canvas.DrawImage back_img,0,0
canvas.DrawImage fore_img,0,0
' draw cnvs
canvas.Flush
Return 0
End
End
Function Main:Int()
New myClass
Return 0
End
' Set up random for ground
fore_img = New Image(400,400,0,0)
fore_cnvs = New Canvas(fore_img)
fore_cnvs.Clear(1,1,1)
fore_cnvs.SetColor 0,0,0
Local i:Int=0
While i<20
fore_cnvs.DrawRect(Rnd(400),Rnd(400),32,32)
i=i+1
Wend
fore_cnvs.Flush()
I have a feeling that their don't. That M.S. planned to make them work but didn't finish the implementation.Do Shadows work with Canvas's or just Renderers?