Cristiano
New member
- Joined
- May 15, 2018
- Messages
- 27
Hello, friends.
This topic is related to Monkey-X. I’m trying to use light, but nothing happens. I’m doing a very simple sample. What could be wrong? Could it be related to my computer? It’s an old – more than 5 years – HP notebook with integrated video. But I found a link with a sample over the internet and the lights work fine… Here’s my code.
This topic is related to Monkey-X. I’m trying to use light, but nothing happens. I’m doing a very simple sample. What could be wrong? Could it be related to my computer? It’s an old – more than 5 years – HP notebook with integrated video. But I found a link with a sample over the internet and the lights work fine… Here’s my code.
Code:
Import mojo2
Import mojo2.glutil
Function Main()
New X()
End
Class X Extends App
Field canvas:Canvas,img:Image
Method OnCreate()
SetDeviceWindow(320,240,False)
canvas = New Canvas
img=Image.Load("monkey://data/bg.png",0,0,Image.Filter)
canvas.SetAmbientLight .2,.2,.2
End Method
Method OnUpdate()
End Method
Method OnRender()
canvas.Clear
canvas.SetLightType 0,1
canvas.SetLightColor 0,.5,.5,.5
canvas.SetLightPosition 0,MouseX(),MouseY(),-50
canvas.SetLightRange 0,200
For Local l:Int=0 To 639 Step 128
For Local c:Int= 0 To 479 Step 128
canvas.DrawImage img,l,c
Next
next
canvas.Flush()
End Method
End Class