项目作者: jkbz64

项目描述 :
Lua 2D graphics module
高级语言: C++
项目地址: git://github.com/jkbz64/Zadymka.git
创建时间: 2017-11-12T11:49:46Z
项目社区:https://github.com/jkbz64/Zadymka

开源协议:MIT License

下载


Zadymka Build Status

Work in progress

Zadymka is a simple 2D graphics (and Input) module. It also has built-in ImGui support.

Language C++14

Technology Chart

Window / Context / Input GLFW 3
Rendering OpenGL 3.3
OpenGL extensions GLAD
Math glm
Lua Binding sol2
Font loading Freetype2
Image loading stb_image
Other ImGui

Building

Before building install GLFW3 / Freetype2 / any lua version( 5.2 and 5.3 were the only one I tested so far though) libraries. Header libraries will be cloned recursively, so you don’t have to ship them yourself.

  1. git clone --recursive https://github.com/jkbz64/Zadymka.git
  2. cd Zadymka
  3. mkdir build && cd build
  4. cmake .. //-DEXAMPLES=ON to copy examples to build directory
  5. make -j4

Usage

  1. Copy Zadymka.dll or .so along with other .dll's(freetype.dll and glfw3.dll(maybe?)) to the project directory
  2. local Zadymka = require('Zadymka') in your code
  3. Zadymka.init() or Zadymka.Graphics.init() to init graphics module (may be done automagically in the future)
  4. You are ready to go :)

Check out examples directory to see Zadymka usage.

Quickstart

  1. local Graphics = require('Zadymka.Graphics')
  2. Graphics.init()
  3. local window = Graphics.Window:new()
  4. window:create(800, 600, 'title', window.Style.Windowed)
  5. window.title = 'some title'
  6. local font = Graphics.Font:new()
  7. font:loadFromFile('arial.ttf')
  8. local text = Graphics.Text:new()
  9. text:setString('test')
  10. text:setPosition(100, 100)
  11. while window.isOpen do
  12. window:clear(125, 125, 125, 255) -- Clear window
  13. window:draw(text)
  14. window:drawRect(0, 0, 100, 100, 255, 0, 0, 255)
  15. window:display()
  16. end
  17. Graphics.deinit()

Docs?

.. Not now? I guess?
If you want to know usertypes/bindings check out src/(module name).cpp’s.