RMMV HELP! Cant load a custom image on a specific window.

Magusalfador

AKA VaroClaw
Veteran
Joined
Jun 15, 2014
Messages
245
Reaction score
43
First Language
English Spanish
Primarily Uses
RMMV
Hi all!!

I want to load an image on a specific window, in this case, on the Status window (Scene_Status). I have the following code as my function:

Code:
Scene_Status.prototype.drawPicture = function(filename, x, y) {
    var bitmap = ImageManager.loadPicture(filename);
    this.contents.blt(bitmap, 0, 0, bitmap.width, bitmap.height, x, y);  
};

And then I call it when you press PGup or PGdown on Scene_Status (cycle actors):

Code:
        Scene_Status.prototype.setCommandWindowHandlers = function() {
        this._commandWindow.setHandler('cancel', this.popScene.bind(this));
        this._commandWindow.setHandler('pagedown', this.nextActor.bind(this));
        this._commandWindow.setHandler('pageup',   this.previousActor.bind(this));
        this.drawPicture("Loading", 0, 0)
};

But I get this error attached:.
It is worth mentioning im using Yanfly status menu core and im calling the drawPicture function from there.


Thank you.
 

Attachments

  • error.JPG
    error.JPG
    69.4 KB · Views: 11

caethyril

^_^
Veteran
Joined
Feb 21, 2018
Messages
2,274
Reaction score
1,684
First Language
EN
Primarily Uses
RMMZ
A scene does not have a contents property by default; you're thinking of a window. :kaoswt:

The blt method (block transfer, a.k.a. "blit") is used to paint [a piece of] an image onto a Bitmap instance. A window's contents is one option; a free-floating Sprite is another option. Depending on exactly what you're doing, you might not even need to use blt (cf rpg_scenes.js, Scene_Title.prototype.createBackground).

In this case it sounds like you should find the appropriate window and blit onto that~
 

Magusalfador

AKA VaroClaw
Veteran
Joined
Jun 15, 2014
Messages
245
Reaction score
43
First Language
English Spanish
Primarily Uses
RMMV
Hi @caethyril !! Thank you so much. I was able to draw the picture because indeed, it has to be done on a widow, not a scene. Now, I have another problem, my image is not drawing completely, Im guessing something about the canvas? The image I want to load is supposed to be full screen, yet, it loads incomplete.

Attached you will find how the image loads, the red indicates what parts of the image are missing.

Do you know what I should be looking at?

Thanks!
 

Attachments

  • image.png
    image.png
    672.2 KB · Views: 6

caethyril

^_^
Veteran
Joined
Feb 21, 2018
Messages
2,274
Reaction score
1,684
First Language
EN
Primarily Uses
RMMZ
Does the window's height/width change after it initializes? If so, the window contents should be created again after resizing...try adding these lines after the window's height/width changes:
JavaScript:
this.createContents();
this.refresh();
Note: this should reference the window that was resized; if you're resizing from a different context, replace this as needed.

Also, some windows recreate their contents as part of their refresh routine, so depending on your window's inheritance chain you might only need to invoke its refresh method.

Hopefully that'll fix it, because I'm not sure what might cause that otherwise... :kaoswt:
 

Magusalfador

AKA VaroClaw
Veteran
Joined
Jun 15, 2014
Messages
245
Reaction score
43
First Language
English Spanish
Primarily Uses
RMMV
The problem is, I know super basic JS and im working over lots of plug ins, Yanfly mostly, so i don't know if the width and height changes. BUT I was able to accomplish what I needed it with the create sprite method.

I still will be trying what you said out of curiosity though.

I appreciate your help, I was able to accomplish something that seem soo hard. =) =)
 

Latest Threads

Latest Profile Posts

Do you like to practice level design? I do hahahaha! It's not from a specific game, it's just some tests...Fase 1.png
I really need a better indicator of where you can jump up and down though I feel... otherwise I like how this turned out for the first part of the first dungeon of the game.
@Shaz needs to make a website for his plugins. (it can be done easily for free with google sites.) I can't find a database of them anywhere!
Dion2.jpg

testing #2

Forum statistics

Threads
109,128
Messages
1,042,379
Members
141,629
Latest member
YOURBESTFRIIEND
Top