Changing the size of an icon

RoseRainblood

Veteran
Veteran
Joined
Nov 29, 2018
Messages
73
Reaction score
8
First Language
English
Primarily Uses
RMMV
Hi all!

I'm trying to change the size of the default 32x32 icons to 64x64 in a line of js code:

Code:
var icon = $dataSkills[onActivate.skills[i]].iconIndex;
                this.drawIcon(icon, x, y);
I don't want all the icons in my game to be 64x64 by the way. Only these icons from $dataSkills in this part of the code.

Would super appreciate any help! <3
 

TSR

The Northern Frog
Veteran
Joined
Nov 14, 2019
Messages
279
Reaction score
244
First Language
French
Primarily Uses
RMMV
Hello, you have to redraw the drawicon function and change the 2 last parameters of the blt method (destination width and destination height)
Code:
    var icon = $dataSkills[onActivate.skills[i]].iconIndex;
    var bitmap = ImageManager.loadSystem('IconSet');
    var pw = Window_Base._iconWidth;
    var ph = Window_Base._iconHeight;
    var sx = icon% 16 * pw;
    var sy = Math.floor(icon / 16) * ph;
    this.contents.blt(bitmap, sx, sy, pw, ph, x, y, 64, 64);
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
2,604
Reaction score
1,961
First Language
English
Primarily Uses
RMMV
I would probably write a new function, drawSkillIcon, which is identical to drawIcon but change the line

Code:
this.contents.blt(bitmap, sx, sy, pw, ph, x, y);
to

Code:
this.contents.blt(bitmap, sx, sy, pw, ph, x, y, pw*2, ph*2);
Then change the line to call drawSkillIcon instead. Then it'll draw the icon twice as large as usual for skills.
 

MushroomCake28

KAMO Studio
Global Mod
Joined
Nov 18, 2015
Messages
3,729
Reaction score
4,685
First Language
English
Primarily Uses
RMMZ
Do you want your icons to really be 64x64 pixels, or keep the default ones at 32x32 and simply zoom in at x2 (drawing them at 64x64 on the canvas)?
 
Last edited:

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
2,604
Reaction score
1,961
First Language
English
Primarily Uses
RMMV
I'd assume the latter since the former would require edits to the actual icon sheet as well, and having two different sizes of icon on the same sheet would be rather unwieldy.
 

RoseRainblood

Veteran
Veteran
Joined
Nov 29, 2018
Messages
73
Reaction score
8
First Language
English
Primarily Uses
RMMV
Thanks everyone. This works at resizing them! Only issue is that they the resized icons are a bit blurry in-game for some reason. They look fine in Photoshop at 64x64 or 200% zoom.

Do you guys know if there's anything I can do to make them not blurry or is there no way around it? (I have pixel art icons btw)
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
2,604
Reaction score
1,961
First Language
English
Primarily Uses
RMMV
That's probably to do with the bitmap transfer method MV uses, which is different from how Photoshop's zoom works. I don't think you can easily get around that unless you create the icons at 64x64 in the first place.
 

RoseRainblood

Veteran
Veteran
Joined
Nov 29, 2018
Messages
73
Reaction score
8
First Language
English
Primarily Uses
RMMV
Hmm... yeah. Looks like I'll need to create them at 64x64 then. I've just made a second icon sheet and I've changed the ImageManager load to the name of that file. Looks like it's not as simple as just doing that though as the icons are cropped.
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
2,604
Reaction score
1,961
First Language
English
Primarily Uses
RMMV
Yeah, you'll have to set pw and ph to 64 as well to have them crop properly.
 

RoseRainblood

Veteran
Veteran
Joined
Nov 29, 2018
Messages
73
Reaction score
8
First Language
English
Primarily Uses
RMMV
Awesome! Looks like I've got it working now! Thanks so much!
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
2,604
Reaction score
1,961
First Language
English
Primarily Uses
RMMV
Glad to be of assistance!
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

Day 9 of giveaways! 8 prizes today :D
He mad, but he cute :kaopride:

Our latest feature is an interview with... me?!

People4_2 (Capelet off and on) added!

Just beat the last of us 2 last night and starting jedi: fallen order right now, both use unreal engine & when I say i knew 80% of jedi's buttons right away because they were the same buttons as TLOU2 its ridiculous, even the same narrow hallway crawl and barely-made-it jump they do. Unreal Engine is just big budget RPG Maker the way they make games nearly identical at its core lol.

Forum statistics

Threads
106,040
Messages
1,018,476
Members
137,824
Latest member
dobratemporal
Top