mirror of
https://github.com/4ian/GDevelop.git
synced 2025-10-15 10:19:04 +00:00
Tiny fixes on TextRuntimeObject and its renderers
This commit is contained in:
@@ -4,7 +4,7 @@ gdjs.TextRuntimeObjectCocosRenderer = function(runtimeObject, runtimeScene)
|
||||
|
||||
this._text = new cc.LabelTTF(" ", "Arial", 38);
|
||||
this._text.disableStroke();
|
||||
|
||||
|
||||
var renderer = runtimeScene.getLayer("").getRenderer();
|
||||
renderer.addRendererObject(this._text, runtimeObject.getZOrder());
|
||||
this._convertYPosition = renderer.convertYPosition;
|
||||
@@ -25,7 +25,6 @@ gdjs.TextRuntimeObjectCocosRenderer.prototype.ensureUpToDate = function() {
|
||||
|
||||
gdjs.TextRuntimeObjectCocosRenderer.prototype.updateStyle = function() {
|
||||
this._text.setFontSize(this._object._characterSize);
|
||||
this._text.setFontName(this._object._fontName);
|
||||
this._text.setFontFillColor(cc.color(this._object._color[0],
|
||||
this._object._color[1], this._object._color[2]));
|
||||
this._text.setFontName(this._object._fontName);
|
||||
|
@@ -28,12 +28,12 @@ gdjs.TextRuntimeObjectPixiRenderer.prototype.ensureUpToDate = function() {
|
||||
};
|
||||
|
||||
gdjs.TextRuntimeObjectPixiRenderer.prototype.updateStyle = function() {
|
||||
style = {align:"left"};
|
||||
var fontName = "\"gdjs_font_" + this._object._fontName + "\"";
|
||||
var style = { align:"left" };
|
||||
style.font = "";
|
||||
if ( this._object._italic ) style.font += "italic ";
|
||||
if ( this._object._bold ) style.font += "bold ";
|
||||
//if ( this._object._underlined ) style.font += "underlined "; Not supported :/
|
||||
style.font += this._object._characterSize+"px"+" "+this._object._fontName;
|
||||
style.font += this._object._characterSize + "px " + fontName;
|
||||
style.fill = "rgb("+this._object._color[0]+","+this._object._color[1]+","+this._object._color[2]+")";
|
||||
this._text.style = style;
|
||||
};
|
||||
|
@@ -16,14 +16,11 @@ gdjs.TextRuntimeObject = function(runtimeScene, objectData)
|
||||
gdjs.RuntimeObject.call(this, runtimeScene, objectData);
|
||||
|
||||
this._characterSize = objectData.characterSize;
|
||||
this._fontName = "Arial";
|
||||
this._fontName = objectData.font || 'Arial';
|
||||
this._bold = objectData.bold;
|
||||
this._italic = objectData.italic;
|
||||
this._underlined = objectData.underlined;
|
||||
this._color = [objectData.color.r, objectData.color.g, objectData.color.b];
|
||||
if ( objectData.font !== "" ) {
|
||||
this._fontName = "\"gdjs_font_"+objectData.font+"\"";
|
||||
}
|
||||
|
||||
this._str = objectData.string;
|
||||
|
||||
|
Reference in New Issue
Block a user