README.adoc 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. = Forest2D
  2. A 2d tile-based cross platform game engine
  3. written primarily in Lua using the Lua-SDL2 binding.
  4. It is intended for simple 2d tile-based games providing
  5. graphics, audio, collision detection, sprites,
  6. tilemaps, gui, animation and more. +
  7. Forest2D depends greatly on Lua-SDL2 and the entire API can be called after initialization:
  8. [source,lua]
  9. local Forest2D = require "Forest2D"
  10. Forest2D:Init()
  11. == Dependences
  12. * *Lua* (5.2 or 5.3), required
  13. * *Lua-SDL2*, required
  14. * The lua *paths* module, required
  15. * *C* compiler, required
  16. * *GNU Make*, for building
  17. == Building
  18. Install all dependences and compile with
  19. [source,sh]
  20. ----
  21. cd Forest2D
  22. make
  23. ----
  24. == Usage
  25. you can call and use the Forest2D.lua file like so
  26. [source,lua]
  27. ----
  28. local Forest2D = require "Forest2D"
  29. Forest2D:Init()
  30. Forest2D.WINDOW_WIDTH = 640
  31. Forest2D.WINDOW_HEIGHT = 480
  32. window = Forest2D:CreateSDLWindow("mywindow", "icon.bmp")
  33. local Renderer = Forest2D:CreateSDLRenderer(window)
  34. local EventHandler = Forest2D.EventHandler.New(2) --2 milisecond delay between events
  35. --main loop
  36. while true do
  37. EventHandler.GetActiveEvents()
  38. if EventHandler.EventStatus[EVENT_SDLQUIT].Active
  39. or EventHandler.EventStatus[EVENT_ESCKEY_PRESSED].Active
  40. then goto QUIT end
  41. --game code
  42. Renderer:present()
  43. Renderer:clear()
  44. end
  45. ::QUIT::
  46. Forest2D:Quit()
  47. ----
  48. == Notes
  49. Currently a file called Pixel.bmp must be present in the same directory as the Forest2D program for GUI functionality to work.
  50. If you do not have this file just create a 1x1 white bitmap image called Pixel.bmp for this purpose.
  51. == Documentation
  52. See Manual.adoc for more information.