File size: 3,851 Bytes
1e40c2a |
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 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 |
const BOTTOM_BUTTONS_Y = cwh(CANVAS_HEIGHT - BAR_HEIGHT - 10);
const BOTTOM_FONT = cwh(20) + "px Arial";
function drawMainMenu() {
// music
if (firstTimeOnMainMenu && !muteMusic) {
music.play();
firstTimeOnMainMenu = false;
}
// buttons
if (!mobile) {
if (onButton("mm_playGame")) canvas.drawImage(img_mainMenu_playGame, 0, BAR_HEIGHT);
else if (onButton("mm_loadGame")) canvas.drawImage(img_mainMenu_loadGame, 0, BAR_HEIGHT);
else if (onButton("mm_levelSelect")) canvas.drawImage(img_mainMenu_levelSelect, 0, BAR_HEIGHT);
else if (onButton("mm_moreGames")) canvas.drawImage(img_mainMenu_moreGames, 0, BAR_HEIGHT);
else canvas.drawImage(img_mainMenu, 0, BAR_HEIGHT);
} else {
canvas.drawImage(img_mainMenu, os.x, cwh(BAR_HEIGHT) + os.y, cwh(MENU_IMG_WIDTH), cwh(MENU_IMG_HEIGHT));
}
/*
// bottom text - label
canvas.fillStyle = "black";
canvas.font = BOTTOM_FONT;
canvas.textAlign = "left";
canvas.fillText("MORE FROM THE SERIES:", 128, BOTTOM_BUTTONS_Y);
// bottom text - twhg2
if (onButton("mm_twhg2"))
canvas.fillStyle = LS_BUTTON_HOVER_COLOR;
else
canvas.fillStyle = "black";
canvas.font = "bold " + BOTTOM_FONT;
canvas.textAlign = "left";
canvas.fillText("TWHG2", 393, BOTTOM_BUTTONS_Y);
// bottom text - sep 0
drawSep(482, 533);
// bottom text - twhg3
if (onButton("mm_twhg3"))
canvas.fillStyle = LS_BUTTON_HOVER_COLOR;
else
canvas.fillStyle = "black";
canvas.font = "bold " + BOTTOM_FONT;
canvas.textAlign = "left";
canvas.fillText("TWHG3", 497, BOTTOM_BUTTONS_Y);
// bottom text - sep 1
drawSep(585, 533);
// bottom text - twhg4
if (onButton("mm_twhg4"))
canvas.fillStyle = LS_BUTTON_HOVER_COLOR;
else
canvas.fillStyle = "black";
canvas.font = "bold " + BOTTOM_FONT;
canvas.textAlign = "left";
canvas.fillText("TWHG4", 600, BOTTOM_BUTTONS_Y);
// coming soon
if (onButton("mm_twhg2"))
drawComingSoon(430);
else if (onButton("mm_twhg3"))
drawComingSoon(534);
else if (onButton("mm_twhg4"))
drawComingSoon(637);
*/
}
/*
function drawSep(x, y) {
const SEP_SIZE = 10;
const SEP_OUTLINE_SIZE = 3;
canvas.beginPath();
canvas.arc(x, y, SEP_SIZE / 2, 0, 2 * Math.PI, false);
canvas.fillStyle = ENEMY_FILL_COLOR_0;
canvas.fill();
canvas.lineWidth = SEP_OUTLINE_SIZE;
canvas.strokeStyle = ENEMY_OUTLINE_COLOR_0;
canvas.stroke();
}
function drawComingSoon(x) {
var y = 515;
var triangle = 15;
var rectWidth = 280;
var rectHeight = 40;
var strokeWidth = 2;
var shadowOffset = 7;
// shadow
canvas.beginPath();
canvas.moveTo(x + shadowOffset, y + shadowOffset);
canvas.lineTo(x - triangle + shadowOffset, y - triangle + shadowOffset);
canvas.lineTo(x - rectWidth / 2 + shadowOffset, y - triangle + shadowOffset);
canvas.lineTo(x - rectWidth / 2 + shadowOffset, y - triangle - rectHeight + shadowOffset);
canvas.lineTo(x + rectWidth / 2 + shadowOffset, y - triangle - rectHeight + shadowOffset);
canvas.lineTo(x + rectWidth / 2 + shadowOffset, y - triangle + shadowOffset);
canvas.lineTo(x + triangle + shadowOffset, y - triangle + shadowOffset);
canvas.closePath();
canvas.fillStyle = MENU_SHADOW_COLOR;
canvas.fill();
// main bubble
canvas.beginPath();
canvas.moveTo(x, y);
canvas.lineTo(x - triangle, y - triangle);
canvas.lineTo(x - rectWidth / 2, y - triangle);
canvas.lineTo(x - rectWidth / 2, y - triangle - rectHeight);
canvas.lineTo(x + rectWidth / 2, y - triangle - rectHeight);
canvas.lineTo(x + rectWidth / 2, y - triangle);
canvas.lineTo(x + triangle, y - triangle);
canvas.closePath();
canvas.fillStyle = "#fff";
canvas.fill();
canvas.lineWidth = strokeWidth;
canvas.strokeStyle = "#000";
canvas.stroke();
// text
canvas.fillStyle = "black";
canvas.font = "bold " + BOTTOM_FONT;
canvas.textAlign = "center";
canvas.fillText("HTML5 COMING SOON...", x, y - 28);
}
*/ |