1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
# Jin(min version)
[中文版](README_zh.md)
A game framework for making 2D games in lua.
## Screenshot



## Guide
You can download Jin from the [releases page](https://github.com/neonum/jin/releases). 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:
```batch
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:
```lua
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:
```lua
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:
```lua
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](doc/api.md) for reference.
## Modules
* Graphics
* Filesystem
* Keyboard
* Mouse
* Timer
* Audio[WIP]
* Network[WIP]
## License
See [LICENSE](LICENSE) for details.
|