ashikai

Veteran
Veteran
Joined
Jun 2, 2015
Messages
456
Reaction score
344
First Language
English
Primarily Uses
N/A
Hi guys!

I'm working on my dialog boxes, and they require the namebox to be tilted slightly (like 10*). I've rotated/tilted a lot of stuff in my time, but I've always been able to use CSS to do it, and then javascript to place the class/style (when needed). MV doesn't like that much, so I'm a little stuck.
Now I've read through some of Pixi's documentation but I'm lost. I read the section on rotating textures, and another section on making a set image spin, but neither of those seem applicable, so I think I might be approaching this wrong.

Can anyone point me in the right direction? I'm using Yanfly's Message Core if that makes a difference.

Thanks!
 

Jonforum

Veteran
Veteran
Joined
Mar 28, 2016
Messages
1,635
Reaction score
1,458
First Language
French
Primarily Uses
RMMV
can you give your code plz
 

ashikai

Veteran
Veteran
Joined
Jun 2, 2015
Messages
456
Reaction score
344
First Language
English
Primarily Uses
N/A
I'm not sure my code would be helpful at this point... But maybe some peudo code?

Code:
// "text" is the variable for the actor name that's being output in this example.
text = text.style.rotate(10); //change the style of the text variable to be rotated 10deg
return text;
I have also tried something like:
Code:
text = text.rotate(Math.PI*2); //haven't done the math for the proper angle
return text;
Pixi's documentation also seems to have a rotation, skew, and transform option, but I'm not entirely sure how to use those...

...Anyway, since this is based off of YEP_MessageCore, I'll include (what I think are) the relevant lines:
Code:
//=============================================================================
// Window_NameBox
//=============================================================================

Yanfly.DisableWebGLMask = false;

function Window_NameBox() {
    this.initialize.apply(this, arguments);
}

Window_NameBox.prototype = Object.create(Window_Base.prototype);
Window_NameBox.prototype.constructor = Window_NameBox;

Window_NameBox.prototype.initialize = function(parentWindow) {
    this._parentWindow = parentWindow;
    Window_Base.prototype.initialize.call(this, 0, 0, 240, this.windowHeight());
    this._text = '';
    this._lastNameText = '';
    this._openness = 0;
    this._closeCounter = 0;
    this.deactivate();
    if (eval(Yanfly.Param.MSGNameBoxClear)) {
      this.backOpacity = 0;
      this.opacity = 0;
    }
    this.hide();
};

Window_NameBox.prototype.windowWidth = function() {
    this.resetFontSettings();
    var dw = this.textWidthEx(this._text);
    dw += this.padding * 2;
    var width = dw + eval(Yanfly.Param.MSGNameBoxPadding)
    return Math.ceil(width);
};

Window_NameBox.prototype.textWidthEx = function(text) {
    return this.drawTextEx(text, 0, this.contents.height);
};

Window_NameBox.prototype.calcNormalCharacter = function(textState) {
    return this.textWidth(textState.text[textState.index++]);
};

Window_NameBox.prototype.windowHeight = function() {
    return this.fittingHeight(1);
};

Window_NameBox.prototype.standardFontFace = function() {
    return $gameSystem.getMessageFontName();
};

Window_NameBox.prototype.standardFontSize = function() {
    return $gameSystem.getMessageFontSize();
};

Window_NameBox.prototype.update = function() {
    Window_Base.prototype.update.call(this);
    if (this.active) return;
    if (this.isClosed()) return;
    if (this.isClosing()) return;
    if (this._closeCounter-- > 0) return;
    if (this._parentWindow.isClosing()) {
      this._openness = this._parentWindow.openness;
    }
    this.close();
};

Window_NameBox.prototype.refresh = function(text, position) {
    this.show();
    this._lastNameText = text;
    this._text = Yanfly.Param.MSGNameBoxText + text;
    this._position = position;
    this.width = this.windowWidth();
    this.createContents();
    this.contents.clear();
    this.resetFontSettings();
    this.changeTextColor(this.textColor(Yanfly.Param.MSGNameBoxColor));
    var padding = eval(Yanfly.Param.MSGNameBoxPadding) / 2;
    this.drawTextEx(this._text, padding, 0, this.contents.width);
    this._parentWindow.adjustWindowSettings();
    this._parentWindow.updatePlacement();
    this.adjustPositionX();
    this.adjustPositionY();
    this.open();
    this.activate();
    this._closeCounter = 4;
    return '';
};

Window_NameBox.prototype.adjustPositionX = function() {
    if (this._position === 1) {
      this.x = this._parentWindow.x;
      this.x += eval(Yanfly.Param.MSGNameBoxBufferX);
    } else if (this._position === 2) {
      this.x = this._parentWindow.x;
      this.x += this._parentWindow.width * 3 / 10;
      this.x -= this.width / 2;
    } else if (this._position === 3) {
      this.x = this._parentWindow.x;
      this.x += this._parentWindow.width / 2;
      this.x -= this.width / 2;
    } else if (this._position === 4) {
      this.x = this._parentWindow.x;
      this.x += this._parentWindow.width * 7 / 10;
      this.x -= this.width / 2;
    } else {
      this.x = this._parentWindow.x + this._parentWindow.width;
      this.x -= this.width;
      this.x -= eval(Yanfly.Param.MSGNameBoxBufferX);
    }
    this.x = this.x.clamp(0, Graphics.boxWidth - this.width);
};

Window_NameBox.prototype.adjustPositionY = function() {
    if ($gameMessage.positionType() === 0) {
      this.y = this._parentWindow.y + this._parentWindow.height;
      this.y -= eval(Yanfly.Param.MSGNameBoxBufferY);
    } else {
      this.y = this._parentWindow.y;
      this.y -= this.height;
      this.y += eval(Yanfly.Param.MSGNameBoxBufferY);
    }
    if (this.y < 0) {
      this.y = this._parentWindow.y + this._parentWindow.height;
      this.y -= eval(Yanfly.Param.MSGNameBoxBufferY);
    }
};

Is that helpful in explaining what I'd like to do?
 

Latest Threads

Latest Profile Posts

Ugh, can't decide what to make next!
The Dystopia
ikW0BYF.png
Recently got RPG Maker MZ. A bit slower with my current PC but I will be getting a new one soon.
evening progress; pretty happy where this is at so i'll take the rest of the night to myself =w=
5NJGyKY.png
It would seem learning JS is not a know it all for making plugins. While it has enabled me to understand what I'm looking at, I still have to find the relevant information in the core scripts. This is much harder than learning JS IMO.

Forum statistics

Threads
118,403
Messages
1,115,673
Members
155,343
Latest member
sograyish
Top