JavaScript:
var breaks = q.desc.split('\n');
var newLines =[];
for(var i =0; i < breaks.length; i ++){
newLines = newLines + breaks[i]+' breakLine ';
}
this.questBitmap.textColor =this.normalColor();
var lines =this.sliceText(newLines,this.contentsWidth());
for(var i =0; i < lines.length; i +=1){
this.questBitmap.drawText(lines[i],0,this.lineY,this.contentsWidth(),this.lineHeight());
this.write();
}
this.drawHorzLine(this.lineY);
this.write();
}
The snippet above is what I am using right now. My plan is to use the 'breakLine' part to identify the breaks and then turn them into actual breaks (which is what I'm having trouble with).
Any ideas?
I think this is what controls the sliceText part:
JavaScript:
Window_Base.prototype.sliceText =function(text, width){
var words = text.split(" ");
if(words.length ===1)
return words;
var result =[];
var current_text = words.shift();
for(var i =0; i < words.length; i +=1){
var word = words[i];
var textW =this.contents.measureTextWidth(current_text +" "+ word);
if(textW > width){
result.push(current_text);
current_text = word;
}else{
current_text +=" "+ word;
}
if(i >= words.length -1)
result.push(current_text)
}
return result
}