So, like the title says, I'm trying to see if I can use two different fonts within a window. I've got the YEP Font Loader installed and I'd like to base it off the logic of "if the system colour is being used, then use this font, otherwise use that font." The only thing is that I'm really not sure how to go about checking if text being drawn is using the system colour or not.
This is what I've got so far but with no real results. It's just loading up the 'else' font. I know I don't have the if statement properly stated, so that's what I'd like some help on.
Currently I'm trying it out in a custom Window_Status screen.
Here's the full code, just for good measure. Keep in mind I'm not a slick programmer, so it might be a liiiiiittle sloppy compared to the pros out there, haha.
Thanks in advance!
This is what I've got so far but with no real results. It's just loading up the 'else' font. I know I don't have the if statement properly stated, so that's what I'd like some help on.
Code:
Window_Base.prototype.standardFontFace = function() {
if (this.changeTextColor(this.systemColor()) == true){
return 'ChromoxomeRegular';
} else {
return 'ComicNeueAngularBold';
}
};
Currently I'm trying it out in a custom Window_Status screen.
Here's the full code, just for good measure. Keep in mind I'm not a slick programmer, so it might be a liiiiiittle sloppy compared to the pros out there, haha.
// Window_Status
//
// The window for displaying full status on the status screen.
function Window_Status() {
this.initialize.apply(this, arguments);
}
Window_Base.prototype.standardFontFace = function() {
if (this.changeTextColor(this.systemColor()) == true){
return 'ChromoxomeRegular';
} else {
return 'ComicNeueAngularBold';
}
};
Window_Status.prototype = Object.create(Window_Selectable.prototype);
Window_Status.prototype.constructor = Window_Status;
Window_Status.prototype.initialize = function() {
var width = Graphics.boxWidth;
var height = Graphics.boxHeight;
Window_Selectable.prototype.initialize.call(this, 0, 0, width, height);
this._actor = null;
this.refresh();
this.activate();
};
Window_Status.prototype.setActor = function(actor) {
if (this._actor !== actor) {
this._actor = actor;
this.refresh();
}
};
Window_Status.prototype.refresh = function() {
this.contents.clear();
if (this._actor) {
var lineHeight = this.lineHeight();
this.drawBlock1(lineHeight * 0);
//this.drawHorzLine(lineHeight * 1);
this.drawBlock2(lineHeight * 1.25);
//this.drawHorzLine(lineHeight * 6);
this.drawBlock3(lineHeight * 7);
// this.drawHorzLine(lineHeight * 13);
this.drawBlock4(lineHeight * 14);
}
};
Window_Status.prototype.drawBlock1 = function(y) {
//this.drawActorClass(this._actor, 192, y);
//this.drawActorNickname(this._actor, 432, y);
this.drawActorName(this._actor, 6, y);
this.drawActorFace(this._actor, 6, 42);
this.drawBasicInfo(168, y);
};
Window_Status.prototype.drawBlock2 = function(y) {
// this.drawBasicInfo(204, y);
this.drawEquipments(432, y);
};
Window_Status.prototype.drawBlock3 = function(y) {
this.drawParameters(48, y);
this.drawExpInfo(456, y);
};
Window_Status.prototype.drawBlock4 = function(y) {
this.drawProfile(6, y);
};
Window_Status.prototype.drawHorzLine = function(y) {
var lineY = y + this.lineHeight() / 2 - 1;
this.contents.paintOpacity = 48;
this.contents.fillRect(0, lineY, this.contentsWidth(), 2, this.lineColor());
this.contents.paintOpacity = 255;
};
Window_Status.prototype.lineColor = function() {
return this.normalColor();
};
Window_Status.prototype.drawBasicInfo = function(x, y) {
var lineHeight = this.lineHeight();
this.drawActorLevel(this._actor, x, y + lineHeight * 0);
this.drawActorIcons(this._actor, x, y + lineHeight * 1);
this.drawActorHp(this._actor, x, y + lineHeight * 2);
this.drawActorMp(this._actor, x, y + lineHeight * 3);
};
Window_Status.prototype.drawParameters = function(x, y) {
var lineHeight = this.lineHeight();
for (var i = 0; i < 6; i++) {
var paramId = i + 2;
var y2 = y + lineHeight * i;
this.changeTextColor(this.systemColor());
this.drawText(TextManager.param(paramId), x, y2, 160);
this.resetTextColor();
this.drawText(this._actor.param(paramId), x + 160, y2, 60, 'right');
}
};
Window_Status.prototype.drawExpInfo = function(x, y) {
var lineHeight = this.lineHeight();
var expTotal = TextManager.expTotal.format(TextManager.exp);
var expNext = TextManager.expNext.format(TextManager.level);
var value1 = this._actor.currentExp();
var value2 = this._actor.nextRequiredExp();
var value1length = this.textWidth(value1);
var expNextlength = this.textWidth(expNext);
if (this._actor.isMaxLevel()) {
//value1 = '-------';
value2 = 'MAXED OUT!';
}
this.drawText(expTotal, x, y + lineHeight * 0, 270);
this.drawText(value1, x, y + lineHeight * 1, 270, 'left');
this.drawText(expNext, x + value1length, y + lineHeight * 1, 25,'left', this.changeTextColor('#FFAA5C'));
this.drawText(value2, x + value1length + (expNextlength * 1.5), y + lineHeight * 1, 270, 'left', this.resetTextColor());
};
Window_Status.prototype.drawEquipments = function(x, y) {
var equips = this._actor.equips();
var count = Math.min(equips.length, this.maxEquipmentLines());
for (var i = 0; i < count; i++) {
this.drawItemName(equips, x, y + this.lineHeight() * i);
}
};
Window_Status.prototype.drawProfile = function(x, y) {
this.drawTextEx(this._actor.profile(), x, y);
};
Window_Status.prototype.maxEquipmentLines = function() {
return 6;
};
//
// The window for displaying full status on the status screen.
function Window_Status() {
this.initialize.apply(this, arguments);
}
Window_Base.prototype.standardFontFace = function() {
if (this.changeTextColor(this.systemColor()) == true){
return 'ChromoxomeRegular';
} else {
return 'ComicNeueAngularBold';
}
};
Window_Status.prototype = Object.create(Window_Selectable.prototype);
Window_Status.prototype.constructor = Window_Status;
Window_Status.prototype.initialize = function() {
var width = Graphics.boxWidth;
var height = Graphics.boxHeight;
Window_Selectable.prototype.initialize.call(this, 0, 0, width, height);
this._actor = null;
this.refresh();
this.activate();
};
Window_Status.prototype.setActor = function(actor) {
if (this._actor !== actor) {
this._actor = actor;
this.refresh();
}
};
Window_Status.prototype.refresh = function() {
this.contents.clear();
if (this._actor) {
var lineHeight = this.lineHeight();
this.drawBlock1(lineHeight * 0);
//this.drawHorzLine(lineHeight * 1);
this.drawBlock2(lineHeight * 1.25);
//this.drawHorzLine(lineHeight * 6);
this.drawBlock3(lineHeight * 7);
// this.drawHorzLine(lineHeight * 13);
this.drawBlock4(lineHeight * 14);
}
};
Window_Status.prototype.drawBlock1 = function(y) {
//this.drawActorClass(this._actor, 192, y);
//this.drawActorNickname(this._actor, 432, y);
this.drawActorName(this._actor, 6, y);
this.drawActorFace(this._actor, 6, 42);
this.drawBasicInfo(168, y);
};
Window_Status.prototype.drawBlock2 = function(y) {
// this.drawBasicInfo(204, y);
this.drawEquipments(432, y);
};
Window_Status.prototype.drawBlock3 = function(y) {
this.drawParameters(48, y);
this.drawExpInfo(456, y);
};
Window_Status.prototype.drawBlock4 = function(y) {
this.drawProfile(6, y);
};
Window_Status.prototype.drawHorzLine = function(y) {
var lineY = y + this.lineHeight() / 2 - 1;
this.contents.paintOpacity = 48;
this.contents.fillRect(0, lineY, this.contentsWidth(), 2, this.lineColor());
this.contents.paintOpacity = 255;
};
Window_Status.prototype.lineColor = function() {
return this.normalColor();
};
Window_Status.prototype.drawBasicInfo = function(x, y) {
var lineHeight = this.lineHeight();
this.drawActorLevel(this._actor, x, y + lineHeight * 0);
this.drawActorIcons(this._actor, x, y + lineHeight * 1);
this.drawActorHp(this._actor, x, y + lineHeight * 2);
this.drawActorMp(this._actor, x, y + lineHeight * 3);
};
Window_Status.prototype.drawParameters = function(x, y) {
var lineHeight = this.lineHeight();
for (var i = 0; i < 6; i++) {
var paramId = i + 2;
var y2 = y + lineHeight * i;
this.changeTextColor(this.systemColor());
this.drawText(TextManager.param(paramId), x, y2, 160);
this.resetTextColor();
this.drawText(this._actor.param(paramId), x + 160, y2, 60, 'right');
}
};
Window_Status.prototype.drawExpInfo = function(x, y) {
var lineHeight = this.lineHeight();
var expTotal = TextManager.expTotal.format(TextManager.exp);
var expNext = TextManager.expNext.format(TextManager.level);
var value1 = this._actor.currentExp();
var value2 = this._actor.nextRequiredExp();
var value1length = this.textWidth(value1);
var expNextlength = this.textWidth(expNext);
if (this._actor.isMaxLevel()) {
//value1 = '-------';
value2 = 'MAXED OUT!';
}
this.drawText(expTotal, x, y + lineHeight * 0, 270);
this.drawText(value1, x, y + lineHeight * 1, 270, 'left');
this.drawText(expNext, x + value1length, y + lineHeight * 1, 25,'left', this.changeTextColor('#FFAA5C'));
this.drawText(value2, x + value1length + (expNextlength * 1.5), y + lineHeight * 1, 270, 'left', this.resetTextColor());
};
Window_Status.prototype.drawEquipments = function(x, y) {
var equips = this._actor.equips();
var count = Math.min(equips.length, this.maxEquipmentLines());
for (var i = 0; i < count; i++) {
this.drawItemName(equips, x, y + this.lineHeight() * i);
}
};
Window_Status.prototype.drawProfile = function(x, y) {
this.drawTextEx(this._actor.profile(), x, y);
};
Window_Status.prototype.maxEquipmentLines = function() {
return 6;
};
Thanks in advance!