= Forest2D
A 2d tile-based cross platform game engine
written primarily in Lua using the Lua-SDL2 binding.

It is intended for simple 2d tile-based games providing
graphics, audio, collision detection, sprites,
tilemaps, gui, animation and more. +
Forest2D depends greatly on Lua-SDL2 and the entire API can be called after initialization:
[source,lua]
local Forest2D = require "Forest2D"
Forest2D:Init()

== Dependences

* *Lua* (5.2 or 5.3), required
* *Lua-SDL2*, required
* The lua *paths* module, required
* *C* compiler, required
* *GNU Make*, for building

== Building

Install all dependences and compile with

[source,sh]
----
cd Forest2D
make
----

== Usage

you can call and use the Forest2D.lua file like so
[source,lua]
----
local Forest2D = require "Forest2D"
Forest2D:Init()
Forest2D.WINDOW_WIDTH = 640
Forest2D.WINDOW_HEIGHT = 480
window = Forest2D:CreateSDLWindow("mywindow", "icon.bmp")
local Renderer = Forest2D:CreateSDLRenderer(window)
local EventHandler = Forest2D.EventHandler.New(2) --2 milisecond delay between events

--main loop
while true do
    EventHandler.GetActiveEvents()
    if EventHandler.EventStatus[EVENT_SDLQUIT].Active
    or EventHandler.EventStatus[EVENT_ESCKEY_PRESSED].Active
    then goto QUIT end

    --game code

    Renderer:present()
    Renderer:clear()
end

::QUIT::
Forest2D:Quit()
----

== Notes

Currently a file called Pixel.bmp must be present in the same directory as the Forest2D program for GUI functionality to work.
If you do not have this file just create a 1x1 white bitmap image called Pixel.bmp for this purpose.

== Documentation

See Manual.adoc for more information.
