1 module main;
2 immutable generate =
3 `
4 module app;
5 
6 import sapp = sokol.app;
7 import log = sokol.log;
8 
9 void main()
10 {
11 	sapp.Desc runner = {
12 		window_title: "sokol-app",
13 		init_cb: &init,
14 		frame_cb: &frame,
15 		cleanup_cb: &cleanup,
16 		width: 640,
17 		height: 480,
18 		win32_console_attach: false,
19 		icon: {sokol_default: true},
20 		logger: {func: &log.func}
21 	};
22 	sapp.run(runner);
23 }
24 
25 extern (C)
26 {
27 	static void init()
28 	{
29 		// TODO: init code goes here
30 	}
31 
32 	static void frame()
33 	{
34 		// TODO: frame code goes here
35 	}
36 
37 	static void cleanup()
38 	{
39 		// TODO: cleanup code goes here
40 	}
41 }
42 `;
43 
44 int main(string[] args)
45 {
46 	import std;
47 
48 	auto sourceFolder = buildPath(getcwd(), "source");
49 	auto appFilePath = buildPath(sourceFolder, "app.d");
50 	if (exists(sourceFolder))
51 	{
52 		writefln!"[ERROR] A dub package already exists in the directory %s."(getcwd());
53 		writeln(
54 			"[ERROR] Please choose an empty directory to initialize your new sokol-d app.");
55 		return -1;
56 	}
57 	mkdir(sourceFolder);
58 	std.file.write(appFilePath, generate);
59 	return 0;
60 }