[SOLVED] Window_Base.contents and blt

Sorry for being ignorant and I hope what I'm asking makes sense, but does Window_Base.contents have some kind of padding around its edges?

I am trying to use blt to draw a bitmap within it, and it seems to get cut off if I set the x value flush against the parent object's boundaries.

I tried examining the contents in the console but there doesn't seem to be a padding property to adjust:
window_base_contents.PNG


Can anybody enlighten me?

As always, thanks in advance.
.standardPadding is a function that will return the padding for the window.
Standard is 18, I think. It's on Window_Base though, not on the bitmap
.standardPadding is a function that will return the padding for the window.
Standard is 18, I think. It's on Window_Base though, not on the bitmap

Thanks, @standardplayer !

I already have padding for the Window_Base set to 0, and it is still getting cut off so I that's why I suspect that it has to do with a property within the contents object- I just can't figure out what it is.

Temporarily, I have just off set the x position of everything I'm drawing by 2 px, which seems to work:
window_base_contents_blt_cut_off.PNG
window_base_contents_blt_offset.PNG


But I still want to figure out what is going on for future implementation.

I appreciate the advice though!
Did you recreate the contents?
After the window is initialized, if you've changed the padding or size, you'll want to do a
.createContents() call. I'm not sure how and where you're currently changing the padding, but if it's post-window creation, you'll want to do a createContents to reset it, bc that's what recreates the bitmap for that window.
Did you recreate the contents?
After the window is initialized, if you've changed the padding or size, you'll want to do a
.createContents() call. I'm not sure how and where you're currently changing the padding, but if it's post-window creation, you'll want to do a createContents to reset it, bc that's what recreates the bitmap for that window.

@standardplayer - I'm doing it in the initialize function of the class extension which is the parent of all the additional windows I'm creating:
hudObject class.png


I'll look into createContents though. Thanks!
Did you recreate the contents?
After the window is initialized, if you've changed the padding or size, you'll want to do a
.createContents() call. I'm not sure how and where you're currently changing the padding, but if it's post-window creation, you'll want to do a createContents to reset it, bc that's what recreates the bitmap for that window.

@standardplayer - I just put createContents() at the end of my initialization commands, but, unfortunately, the cut off is still occuring:
hudObjects_initialize_createContents.PNG


Anyway, I'm going to keep examining the problem. Thanks for the suggestion though.
I'd need to see more about what you're doing to really be able to guess at a solution.
But anything you're adding to the contents, you'd want to do after calling createContents.
Also, don't change the padding by the property. Change the actual .standardPadding function, or else other parts of the program will still get the value it returns.

If changing the standardPadding function to return 0 solves your problem, that actually negates the need to call createContents

EDIT: In fact, as a rule if you see properties on RPG Maker object prefixed with an _ underscore, they're usually treated like 'private' properties, in that there is generally a function somewhere on that object that will be called by other parts, to get that value.
Of course the property itself has no access modifier, but other elements for example aren't calling the ._padding property, they're often calling the .standardPadding() function to get the padding value.
I'd need to see more about what you're doing to really be able to guess at a solution.
But anything you're adding to the contents, you'd want to do after calling createContents.
Also, don't change the padding by the property. Change the actual .standardPadding function, or else other parts of the program will still get the value it returns.

If changing the standardPadding function to return 0 solves your problem, that actually negates the need to call createContents

EDIT: In fact, as a rule if you see properties on RPG Maker object prefixed with an _ underscore, they're usually treated like 'private' properties, in that there is generally a function somewhere on that object that will be called by other parts, to get that value.
Of course the property itself has no access modifier, but other elements for example aren't calling the ._padding property, they're often calling the .standardPadding() function to get the padding value.

@standardplayer - This could be it!

Looking at rpg_windows.js, I can see what you mean:
carbon (6).png


A further question (I hope it makes sense)- if I change standardPadding() and put it in my hudObject class, will I need to include all these other functions as well in hudObject or does the modified standardPadding() carry up to the Window_Base prototype that I am extending?

Thank you much!
Any change you make to the Window_Base prototype itself will carry up the chain since your Hud class is inheriting it, yes.
Changing the Window_Base prototype itself will almost certainly have unintended side effects, because every other Window class in the RPG Maker objects have it as their prototype.

That being said, many of these child classes overwrite stuff that they inherit, anyway.

So my answer is that, if your other window classes are going to extend HudObject, it's at least safe for you to make these changes on the HudObject class
@standardplayer - nvm. It worked! Thank you.
Thread closed p

Original thread: https://forums.rpgmakerweb.com/threads/solved-window_base-contents-and-blt.122791/