Init scoreboard script
This commit is contained in:
@@ -15,16 +15,32 @@ let pausedColour = COLOUR_RED;
|
||||
|
||||
let scoreboardKey = SDLK_TAB;
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
bindEventHandler("OnResourceReady", thisResource, function(event, resource) {
|
||||
scoreBoardTitleFont = lucasFont.createDefaultFont(22.0, "Roboto", "Regular");
|
||||
scoreBoardListFont = lucasFont.createDefaultFont(12.0, "Roboto", "Light");
|
||||
});
|
||||
function initScoreBoardScript() {
|
||||
logToConsole(LOG_DEBUG, "[Asshat.ScoreBoard]: Initializing scoreboard script ...");
|
||||
scoreBoardTitleFont = initScoreBoardTitleFont();
|
||||
scoreBoardListFont = initScoreBoardListFont();
|
||||
logToConsole(LOG_DEBUG, "[Asshat.ScoreBoard]: Scoreboard script initialized!");
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function processScoreboardRendering() {
|
||||
function initScoreBoardTitleFont() {
|
||||
return lucasFont.createDefaultFont(22.0, "Roboto", "Regular");
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function initScoreBoardListFont() {
|
||||
return lucasFont.createDefaultFont(12.0, "Roboto", "Light");
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function processScoreBoardRendering() {
|
||||
if(renderScoreBoard) {
|
||||
if(isKeyDown(SDLK_TAB)) {
|
||||
if(scoreBoardListFont != null && scoreBoardTitleFont != null) {
|
||||
let scoreboardStart = (game.height/2)-(Math.floor(getClients().length/2)*20);
|
||||
let titleSize = scoreBoardTitleFont.measure("PLAYERS", game.width, 0.0, 1.0, 10, false, false);
|
||||
@@ -80,4 +96,6 @@ function processScoreboardRendering() {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user