]> git.lizzy.rs Git - dragonirc.git/blob - splashscreen.lua
Create LICENSE
[dragonirc.git] / splashscreen.lua
1 local dragon = string.split([[
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   (_ ) /b)  \  '.   :            \___.-'_/ \__/
30   /:/:  ,     ) :        (      /_.'__/-'|_ _ /
31  /:/: __/\ >  __,_.----.__\    /        (/(/(/
32 (_(,_/V .'/--'    _/  __/ |   /
33  VvvV  //`    _.-' _.'     \   \
34    n_n//     (((/->/        |   /
35    '--'         ~='          \  |
36                               | |_,,,
37                               \  \  /
38                                '.__)
39 ]], "\n")
40
41 local title = string.split([[
42  ____                              ___ ____   ____
43 |  _ \ _ __ __ _  __ _  ___  _ __ |_ _|  _ \ / ___|
44 | | | | '__/ _` |/ _` |/ _ \| '_ \ | || |_) | |
45 | |_| | | | (_| | (_| | (_) | | | || ||  _ <| |___
46 |____/|_|  \__,_|\__, |\___/|_| |_|___|_| \_\\____|
47                  |___/
48 ]], "\n")
49
50 local size_dragon = cutie.get_dimensions(dragon)
51 local size_title  = cutie.get_dimensions(title)
52
53 dragonirc.splashscreen = async(function()
54         cutie.set_cursor_shown(false)
55         local promise = Promise()
56         local splashscreen_time = 0
57
58         local interval
59
60         interval = setInterval(function()
61                 splashscreen_time = splashscreen_time + 1 / 60
62
63                 if splashscreen_time > 1 then
64                         promise:resolve()
65                         clearInterval(interval)
66                         return
67                 end
68
69                 cutie.handle_resize()
70                 cutie.set_background({0, 0, 0})
71                 cutie.empty_screen()
72
73                 cutie.set_bold()
74
75                 local size = cutie.get_terminal_size()
76
77                 cutie.set_color(360 * math.max(1 - splashscreen_time * 2 / 3, 0))
78                 cutie.render_at(dragon,
79                         (size[1] - size_dragon[1]) / 2,
80                         (size[2] - size_dragon[2]) / 2
81                 )
82
83                 cutie.set_color({1, 1, 1})
84                 cutie.render_at(title,
85                         (size[1] - size_title[1]) / 2,
86                         size[2] - size_title[2] - 1
87                 )
88
89                 cutie.flush_buffer()
90         end, 1000 / 60)
91
92         await(promise)
93
94         cutie.set_cursor_shown(true)
95 end)