aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2015-10-08 03:28:01 -0400
committerTeddy Wing2015-10-08 03:28:01 -0400
commit09db561ca2a016b5cefb07c9782c8f823e8e4e03 (patch)
tree606c1162f045028c3b2146da1bbce90413bb6472
parent300c1e989ac2e6ff9b8a2afe5ad71237d7882b78 (diff)
downloadvim-space-vlaze-09db561ca2a016b5cefb07c9782c8f823e8e4e03.tar.bz2
leaderboard#RenderLeaderboard: Show headline and scores
Output our "Leaderboard" header. Two lines needed to be surrounded in double quotes since they contain single quotes and backslashes needed to be escaped in those strings. Output player name and high score value. Not very pretty unfortunately. Using hard-coded left padding where it would be nice to calculate padding needed to center the name and score. Also would like to right-align score numerals but leaving it as an enhancement as there are more pressing things to do for now.
-rw-r--r--autoload/space_vlaze/leaderboard.vim44
1 files changed, 23 insertions, 21 deletions
diff --git a/autoload/space_vlaze/leaderboard.vim b/autoload/space_vlaze/leaderboard.vim
index cc551e3..155b537 100644
--- a/autoload/space_vlaze/leaderboard.vim
+++ b/autoload/space_vlaze/leaderboard.vim
@@ -61,25 +61,27 @@ function! space_vlaze#leaderboard#RenderLeaderboard()
call space_vlaze#game#SetupWindow()
-_ ____ ____ ___ ____ ____ ___ ____ ____ ____ ___
-| |___ |__| | \ |___ |__/ |__] | | |__| |__/ | \
-|___ |___ | | |__/ |___ | \ |__] |__| | | | \ |__/
-
-
- __ __
-/\ \ /\ \
-\ \ \ __ __ \_\ \ __ _ __
- \ \ \ __ /'__`\ /'__`\ /'_` \ /'__`\ /\`'__\
- \ \ \L\ \/\ __/ /\ \L\.\_ /\ \L\ \ /\ __/ \ \ \/
- \ \____/\ \____\\ \__/.\_\\ \___,_\\ \____\ \ \_\
- \/___/ \/____/ \/__/\/_/ \/__,_ / \/____/ \/_/
-
- __ __
- /\ \ /\ \
- \ \ \____ ___ __ _ __ \_\ \
- \ \ '__`\ / __`\ /'__`\ /\`'__\ /'_` \
- \ \ \L\ \/\ \L\ \/\ \L\.\_ \ \ \/ /\ \L\ \
- \ \_,__/\ \____/\ \__/.\_\ \ \_\ \ \___,_\
- \/___/ \/___/ \/__/\/_/ \/_/ \/__,_ /
-
+ call setline( 1, ' __ __ ')
+ call setline( 2, ' /\ \ /\ \ ')
+ call setline( 3, ' \ \ \ __ __ \_\ \ __ _ __ ')
+ call setline( 4, " \\ \\ \\ __ /'__`\\ /'__`\\ /'_` \\ /'__`\\ /\\`'__\\ ")
+ call setline( 5, ' \ \ \L\ \/\ __/ /\ \L\.\_ /\ \L\ \ /\ __/ \ \ \/ ')
+ call setline( 6, ' \ \____/\ \____\\ \__/.\_\\ \___,_\\ \____\ \ \_\ ')
+ call setline( 7, ' \/___/ \/____/ \/__/\/_/ \/__,_ / \/____/ \/_/ ')
+ call setline( 8, ' __ __ ')
+ call setline( 9, ' /\ \ /\ \ ')
+ call setline(10, ' \ \ \____ ___ __ _ __ \_\ \ ')
+ call setline(11, " \\ \\ '__`\\ / __`\\ /'__`\\ /\\`'__\\ /'_` \\ ")
+ call setline(12, ' \ \ \L\ \/\ \L\ \/\ \L\.\_ \ \ \/ /\ \L\ \ ')
+ call setline(13, ' \ \_,__/\ \____/\ \__/.\_\ \ \_\ \ \___,_\ ')
+ call setline(14, ' \/___/ \/___/ \/__/\/_/ \/_/ \/__,_ / ')
+ call setline(15, ' ')
+ call setline(16, '')
+
+ let i = 17
+ for score in scores
+ call setline(i, ' ' . player_name[0] . ' ' . score)
+
+ let i += 1
+ endfor
endfunction