Skip to content
/ Jin Public

A 2D game framework for simplifying game making process in Lua.

License

Notifications You must be signed in to change notification settings

chaifix/Jin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Jin

中文版
A game framework for making 2D games in lua.

Screenshot

doc/screenshot/a.png doc/screenshot/b.png doc/screenshot/c.gif

Guide

You can download Jin from the releases page. To run the game, you need set the first argument as your game directory. For example, if your game is in a directory called mygame, you would run the following command:

jin mygame

If you want to open debug mode, set the second argument to -d. You need make a main.lua file inside game directory, which is entry of the game. If you want to config window size, fps and title, create a config.lua file inside game directory. The configure file would be like this:

return{
    width  = 512, 
    height = 512, 
    fps    = 60, 
    title  = "my title"
}

To create your game, you need create 4 functions(optional) in main.lua. They are:

jin.core.load()       -- run before game loop 
jin.core.onEvent(e)   -- called every event loop 
jin.core.onUpdate(dt) -- called every frame 
jin.core.onDraw()     -- called every frame 

Here is a small example which draws a filled circle and prints "hello, world" on screen:

function jin.core.onEvent(e) 
    if e.type == "quit" then 
        jin.core.quit() 
    end 
end 

function jin.core.onDraw() 
    jin.graphics.circle("fill", 10, 10, 20)
    jin.graphics.write("hello, world", 100, 100, 16, 1, 20)
end 

See doc/api.md for reference.

Modules

  • Graphics
  • Filesystem
  • Keyboard
  • Mouse
  • Timer
  • Audio[WIP]
  • Network[WIP]

License

See LICENSE for details.

About

A 2D game framework for simplifying game making process in Lua.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages