Lights in 2D? Why? Because it looks cool and BMAX should have had them from the start.
The module can be plugged in to any existing application with very little modification.
NOTE: A change must be made to the official directx.mod (d3d7.bmx), BRL did not define the lighting methods correctly.
Features:-
- DX and OGL (Win and OSX)
- World Ambient Light
- Up to 8 individual Lights
- Point Light or Spot
- Ambient Color (with Alpha)
- Diffusive Color (with Alpha)
- Specular Color (with Alpha)
- Range
- Position (3d)
- Direction (3d Vector)
- Attentuation (Constant, Linear and Quadratic)
- On/Off States
- Falloff
- Coneangles (Phi & Theta, Theta as % of Phi)
** Dot3 may be added if there is a need for it.
Download Demo : http://indiepath.com/public/light_example.rar
Screenshot :

Code for this example :
The module can be plugged in to any existing application with very little modification.
NOTE: A change must be made to the official directx.mod (d3d7.bmx), BRL did not define the lighting methods correctly.
Features:-
- DX and OGL (Win and OSX)
- World Ambient Light
- Up to 8 individual Lights
- Point Light or Spot
- Ambient Color (with Alpha)
- Diffusive Color (with Alpha)
- Specular Color (with Alpha)
- Range
- Position (3d)
- Direction (3d Vector)
- Attentuation (Constant, Linear and Quadratic)
- On/Off States
- Falloff
- Coneangles (Phi & Theta, Theta as % of Phi)
** Dot3 may be added if there is a need for it.
Download Demo : http://indiepath.com/public/light_example.rar
Screenshot :

Code for this example :
Strict Import indiepath.projmatrix Import Indiepath.lights2d Import Indiepath.AnimImageFast SetGraphicsDriver GLMax2DDriver() 'SetGraphicsDriver D3D7Max2DDriver() SeedRnd(MilliSecs()) Graphics 800,600,0 Global Proj1:ProjectionMatrix = ProjectionMatrix.Initialise(640,480) iLight.Initialise() iLight.GlobalAmbientSet($FF555555) Global Light1:iLight = iLight.Create(0,POINT_LIGHT) Light1.AmbientSet([ 1.0, 1.0, 1.0, 1.0]) Light1.SpecularSet([ 0.8, 0.8, 0.8, 1.0]) Light1.DiffuseSet([1.0,1.0,1.0,1.0]) Light1.Attenuate(0,0.001,0.0001) Light1.Falloff(1) Light1.Direction(1,0,-0.1) Light1.Range(100) Light1.Lit(True) Global Light2:iLight = iLight.Create(1,POINT_LIGHT) Light2.AmbientSet([ 0.4, 4.0, 1.0, 1.0]) Light2.SpecularSet([ 0.5, 0.5, 0.8, 1.0]) Light2.DiffuseSet([0.8,0.8,1.0,1.0]) Light2.Attenuate(1,0.001,0.0001) Light2.Lit(True) SetBlend(ALPHABLEND) Global Blocks:TAnimIMage = TAnimImage.Load("blocks.png",32,32,0,16) Local iii=0 ' ############################################################################ While Not KeyHit(KEY_ESCAPE) Cls DrawBlocks() Local x#,y# Proj1.TranslateMouse(x,y) Light1.Position( [ x, y, 0.0, 1.0]) Local lx# = 0.5 * (GraphicsWidth() + GraphicsHeight()*Cos(iii)) Local ly# = 0.5 * (GraphicsHeight() + GraphicsHeight()*Sin(iii)) Light2.Position([ lx, ly, 10.0, 1.0]) iii :+ 1.0 Flip Wend ' ############################################################################ Function DrawBlocks() Local ii:Int = 0 For Local x = 0 To 19 For Local y = 0 To 14 Blocks.Draw(x * 32, y * 32, 32,32,ii) ii:+1 If ii > 15 Then ii = 0 Next Next End Function