-
Notifications
You must be signed in to change notification settings - Fork 0
/
nimlove.nimble
79 lines (67 loc) · 1.83 KB
/
nimlove.nimble
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
72
73
74
75
76
77
78
79
import std / [os, strformat]
# Package
version = "0.0.1"
author = "Marvin"
description = "Super Simple 2D game framework for beginners and all lovers of the simplicity of love2d."
license = "MIT"
srcDir = "src"
# Dependencies
requires "nim >= 1.6.0"
# not needed, if we switch to the official stdlib-binaryheap
# https://github.com/Nycto/AStarNim
requires "binaryheap"
# https://github.com/nim-lang/sdl2
requires "sdl2" # nims offical sdl2 wrapper
# todo: add astar
# tasks
# todo: just read the examples folder
let runnableExamples = @[
"game",
"animation",
"tiles",
"mouse",
"performance",
"pixel",
"empty",
"gameobjects",
"button",
"font",
"protocol",
"serialisation",
"astar_ex",
"pathfind",
"intro",
"path2",
"mousemiddle",
"worldmap"
]
task r, "run the game":
# get 3rd argument
echo &"my task {commandLineParams()}"
let args = commandLineParams()
let lastArg = args.len - 1
let arg = args[lastArg]
# check if argument is in examples
if arg in runnableExamples:
exec "nim -r c ./examples/" & arg & "/" & arg & ".nim"
exec "rm ./examples/" & arg & "/" & arg
else:
echo "Please specify an example to run"
echo "Available examples:"
for example in runnableExamples:
echo " " & example
task compall , "compile all examples":
for example in runnableExamples:
exec "nim c ./examples/" & example & "/" & example & ".nim"
exec "rm ./examples/" & example & "/" & example
task rall, "run all examples":
for example in runnableExamples:
exec "nim -r c ./examples/" & example & "/" & example & ".nim"
exec "rm ./examples/" & example & "/" & example
task git, "commit changes":
exec "git add ."
let args = commandLineParams()
let lastArg = args.len - 1
let arg = args[lastArg]
exec ("git commit -m \""& arg & "\" ")
exec "git push"