-----=====fb_lighting_object=====-----

=====Overview=====
This is a simple lighting object by notthecheatr.  It's not really finished yet (I'd like to add
ambient lighting so various lighting situations like caves or outdoors can be simulated, for
example) but I thought I'd release it to give an example of how this works.

A better programmer than I could probably make this object much more efficient and perhaps
even more useful;  it's taken me a while just to get it to where it is.  It might be helpful for someone, anyways.  A light object is rendered each time it changes intensity or colour;  rendering it is much slower than actually drawing it to the screen (which is simply done with a
Put Alpha method), so generally it will be much faster if the colour/intensity don't change too
often.  Generally you'd instruct it to draw itself inside your game loop (it currently only draws to
the screen, though you can easily change that if you want), rendering before you enter the loop;
the light object is automatically re-rendered when the colour or intensity changes.

A simple example is included, with a light that you can move around and change the colour
or intensity of.

Note:  With all the messing around I've been doing, I'm still finding bugs.  The code is not perfect,
and occasionally when modifying the intensity or fadeoff you'll get something really bad.  This is
not by any means perfect, nor will it be until I (or someone else) find where those bugs are.  As
far as I can tell, though, if you keep the light within a decent size (i.e., don't make it super huge)
it seems to stay bug-free.  Therefore, I've limited the light such that it cannot get any larger
than 1024x1024 pixels in size.  This is a practical limit;  you can remove it easily if you're smart enough, but I'll warn you that you might get odd bugs if you try to use lights that big.  So far,
keeping the limit where it is, I haven't been able to reproduce the bugs in the example program.
Hopefully that will be good enough.  Generally you won't need lights much huger than that,
anyways.


=====Documentation=====
Methods:
  Constructor - This is called with each lighting object you create.
  Destructor - When the lighting object is destroyed (e.g. when your program ends), this is called.

  render() - This renders the object.  Normally you only call this when you first create the light.
    It's automatically called when you change a parameter of the light that would require the
    light to be redrawn.

  draw() - This actually draws the object on the screen.  Call this in your game loop
    or  whatever.  The light will be drawn at the internal coordinates which you can change
    via the properties x and y.

  lightOn()
  lightOff()
  lightToggle() - This is a very fast way to stop the light from drawing itself.  It only affects
    calls to draw().  You can turn the light on and off this way.


Properties:

  intensity As uInteger - This is the intensity of the light, basically how bright it is but it has
    more meaning than that.  As you increase it the light becomes brighter and falls within
    a larger range;  decreasing it makes the light seem less bright (it's actually all just
    simulated with the alpha channel).  This value is limited within a certain range due
    to bugs that occur when it or the fadeoff value leave that range;  thus, after you
    change it's value, check the new value.  Do not assume anything about its value
    after you set it.  If the intensity is modified successfully, the light will be re-rendered.

  colour As uInteger - This is the colour of the light, obviously - it can be any 32-bit value,
    but only the lower 24 bits are used (since the top 8 represent the alpha, which is
    computed when rendering).  Changing the colour causes the light to be automatically
    re-rendered.

  fadeOff As Double - This is the fadeoff of the light.  This affects the area over which
    the light falls in a very simple way:  when calculating the distance from the light
    source to each pixel, the true distance is multiplied by the fadeoff value to get
    a pseudo-distance.  Thus, fadeoff values larger than one will make the light fall
    off much faster while fadeoff values smaller than one (but larger than 0) will make
    the light fall off more slowly.  Like intensity, fadeoff is limited within a range to
    prevent strange bugs.  Do not make any assumptions about the fadeoff value
    after you set it;  if you need to know what it is, check it.  Successfully setting the
    fadeoff value to something different from its previous value will cause the light
    to be rerendered automatically.

  x As Integer
  y As Integer - Coordinates at which to draw the light (on the screen or in a buffer):
    these let you draw your light anywhere on the screen.  Because drawing is handled
    internally, the light object is also able to update the coordinates so the light doesn't
    appear to move on the screen when the buffer is made larger.

One important thing to note is that the buffer the light is rendered to will automatically be
made larger if it needs to be when intensity is increased or fadeoff is decreased (since the area the light covers will be made larger).  If you want to make it large ahead of time so it won't be
too small later, use the setBufferSize method.  This method will only let you set it larger than
its original size, though, so if you want to make it as small as you possibly can (with the current
values for fadeoff and intensity), use the tightenBuffer method.

A usage example is included.