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

Magusalfador

AKA VaroClaw
Veteran
Joined
Jun 15, 2014
Messages
256
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: 12

caethyril

^_^
Veteran
Joined
Feb 21, 2018
Messages
2,373
Reaction score
1,781
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
256
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,373
Reaction score
1,781
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
256
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

unknown.png

A sketch of a character for an upcoming chapter. I am pre-preparing the heck out of this one and future chapters, don't want to spend time figuring the story out again. :blush:
Today *Fix the game UI
RMMZ maxRows make me tired.
The game supports real-time language switching (really interesting).
8laFKAa.png


jBYDFzZ.png


lYbvPth.png

mY99lgU.png

Swag collecting in the new randomly generated area. Now the mini map also shows the randomly generated features... And even illustrates the whole "bubble" system" that I made to manage memory... Though that part's inadvertent. We'll just call that "the fog of war"... Yes, that's what we'll do. Nobody will be the wiser! :kaopride:
not me being not lazy for 5 seconds and drawing another char portrait (her name is hazel)
its_hazel.png
Been a while since the last time I made a song remix. Had a blast making this

Forum statistics

Threads
110,458
Messages
1,053,472
Members
143,551
Latest member
AmberliaDraw
Top