flavor bar

This commit is contained in:
Kyle
2018-10-19 20:00:30 -07:00
parent befe85bfeb
commit e9a17f2eb9
2 changed files with 19 additions and 16 deletions

BIN
data/borders/bar.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 285 B

View File

@@ -70,7 +70,7 @@
<input id="textSize" type="number" min="0" max="100" value="37" step="0.5"></input> <input id="textSize" type="number" min="0" max="100" value="37" step="0.5"></input>
<br/> <br/>
Pixels Between Paragraphs Pixels Between Paragraphs
<input id="textShift" type="number" min="0" max="300" value="0"></input> <input id="textShift" type="number" min="0" max="300" value="13"></input>
<br/> <br/>
Shift All Text Down Shift All Text Down
<input id="textDown" type="number" min="0" max="300" value="0"></input> <input id="textDown" type="number" min="0" max="300" value="0"></input>
@@ -400,7 +400,7 @@ for (i = 0; i < dynamicImageList.length; i ++) {
window[imgName] = new Image() window[imgName] = new Image()
} }
//Load static images //Load static images
var staticImageList = ["artistBrush", "foil", "stampGradient", "multiGradient", "rareStamp", "cardMask", "artMask"] var staticImageList = ["artistBrush", "foil", "stampGradient", "multiGradient", "rareStamp", "cardMask", "artMask", "bar"]
for (i = 0; i < staticImageList.length; i ++) { for (i = 0; i < staticImageList.length; i ++) {
var imgName = "img" + staticImageList[i].charAt(0).toUpperCase() + staticImageList[i].slice(1) var imgName = "img" + staticImageList[i].charAt(0).toUpperCase() + staticImageList[i].slice(1)
window[imgName] = new Image() window[imgName] = new Image()
@@ -644,7 +644,7 @@ function bottomInfoM15() {
} else { } else {
card.fillStyle = "white" card.fillStyle = "white"
} }
var shiftInfo = 445 var shiftInfo = 442
canvas.style.letterSpacing = "0.8px" canvas.style.letterSpacing = "0.8px"
card.font = "19.5px relaymedium" card.font = "19.5px relaymedium"
var bottomLine = document.getElementById("inputSet").value + " \u00b7 " + document.getElementById("inputLanguage").value var bottomLine = document.getElementById("inputSet").value + " \u00b7 " + document.getElementById("inputLanguage").value
@@ -655,23 +655,29 @@ function bottomInfoM15() {
card.font = "19.5px relaymedium" card.font = "19.5px relaymedium"
card.fillText(document.getElementById("inputNumber").value, 49, m15InfoY - 20) card.fillText(document.getElementById("inputNumber").value, 49, m15InfoY - 20)
card.fillText(document.getElementById("inputRarity").value, artistBrushShift - 1, m15InfoY - 20) card.fillText(document.getElementById("inputRarity").value, artistBrushShift - 1, m15InfoY - 20)
if (445 < artistBrushShift + card.measureText(document.getElementById("inputRarity").value).width && document.getElementById("creatureCheckbox").checked == false) { if (442 < artistBrushShift + card.measureText(document.getElementById("inputRarity").value).width && document.getElementById("creatureCheckbox").checked == false) {
shiftInfo = artistBrushShift + card.measureText(document.getElementById("inputRarity").value).width + 5 shiftInfo = artistBrushShift + card.measureText(document.getElementById("inputRarity").value).width + 5
} }
canvas.style.letterSpacing = "-0.1px" canvas.style.letterSpacing = "-0.1px"
card.font = "24px matrixbsc" card.font = "24px matrixbsc"
card.fillText(document.getElementById("inputArtist").value, artistBrushShift + 21, m15InfoY + 2) card.fillText(document.getElementById("inputArtist").value, artistBrushShift + 21, m15InfoY + 2)
if (445 < artistBrushShift + 21 + card.measureText(document.getElementById("inputArtist").value).width && document.getElementById("creatureCheckbox").checked == true) { if (442 < artistBrushShift + 21 + card.measureText(document.getElementById("inputArtist").value).width && document.getElementById("creatureCheckbox").checked == true) {
shiftInfo = artistBrushShift + card.measureText(document.getElementById("inputArtist").value).width + 26 shiftInfo = artistBrushShift + card.measureText(document.getElementById("inputArtist").value).width + 26
} }
//This is where "CC —" is hardcoded. The only reason is to prevent users from easily typing in the trademark and copyright that's usually on real cards. It's also there so I can see if a card was created with my program, it makes me feel good :) //This is where "CC —" is hardcoded. The only reason is to prevent users from easily typing in the trademark and copyright that's usually on real cards. It's also there so I can see if a card was created with my program, it makes me feel good :)
if (document.getElementById("inputInfo").value != "") { if (document.getElementById("inputInfo").value != "") {
canvas.style.letterSpacing = "0px" canvas.style.letterSpacing = "0px"
card.font = "17px mplantin" card.font = "17px mplantin"
var bottomInfo = "CC \u2014 " + document.getElementById("inputInfo").value
if (bottomInfo == "CC \u2014 secretcode") {
var date = new Date()
var year = date.getFullYear()
bottomInfo = "\u2122 & \u00a9 " + year + " Wizards of the Coast"
}
if (document.getElementById("creatureCheckbox").checked == true) { if (document.getElementById("creatureCheckbox").checked == true) {
card.fillText("CC \u2014 " + document.getElementById("inputInfo").value, shiftInfo, m15InfoY + 3) card.fillText(bottomInfo, shiftInfo, m15InfoY + 3)
} else { } else {
card.fillText("CC \u2014 " + document.getElementById("inputInfo").value, shiftInfo, m15InfoY - 17) card.fillText(bottomInfo, shiftInfo, m15InfoY - 17)
} }
} }
} }
@@ -753,6 +759,10 @@ function drawText(text, xCoord, yCoord) {
} else if (megaSplit[0] == "lineNoSpace") { } else if (megaSplit[0] == "lineNoSpace") {
textXShift = 0 textXShift = 0
y += textSize + 1 y += textSize + 1
} else if (megaSplit[0] == "bar") {
card.drawImage(imgBar, canvas.width / 2 - imgBar.width / 2, y + textSize + lineSpace + 5)
textXShift = 0
y += 2 * lineSpace + textSize + 3
} else { } else {
card.drawImage(manaSymbolImages[manaSymbolCode.indexOf(megaSplit[0])], x + textXShift + textSize * 0.054, y + textSize * 0.19, textSize * 0.77, textSize * 0.77) card.drawImage(manaSymbolImages[manaSymbolCode.indexOf(megaSplit[0])], x + textXShift + textSize * 0.054, y + textSize * 0.19, textSize * 0.77, textSize * 0.77)
textXShift += textSize * 0.84 textXShift += textSize * 0.84
@@ -786,17 +796,10 @@ function drawText(text, xCoord, yCoord) {
} }
} }
} }
//Make things go back to normal :)
card.textAlign="left"
} }
//Toggles the visibility of predetermined sections of the input boxes //Toggles the visibility of predetermined sections of the input boxes
function toggleVisibility(targetClass, self, selfClass, hiddenClass, shownClass) { function toggleVisibility(targetClass, self, selfClass, hiddenClass, shownClass) {
var alreadyShown = document.getElementsByClassName(selfClass) var alreadyShown = document.getElementsByClassName(selfClass)