How do you draw a icon command that matches the selectable shape?

As the title says
bMFAoS9
There is far too little info to go by here.
What selectable?
How are you drawing the icon in the first place ? Where (scene, window, condition) ?
Any plugins you're using that we should know about ?
@ad3qex12 Are you asking for a "line of JavaScript code that draws the book icon in this image" you provided?
There is far too little info to go by here.
What selectable?
How are you drawing the icon in the first place ? Where (scene, window, condition) ?
Any plugins you're using that we should know about ?
The background light window of the book icon indicating that icon is being selected is the selectable shape
@ad3qex12 Are you asking for a "line of JavaScript code that draws the book icon in this image" you provided?

I don't know which code defines the box containing the book icon.
The width and height should be 32x32 pixel according to rpg_windows.js:

Window_Base._iconWidth = 32;
Window_Base._iconHeight = 32;

I found Window_Selectable.prototype.itemRect, but changing this.itemWidth() and this.itemHeight doesn't work
Since you haven't actually answered my questions, here is some generic advice:

Look into window selectable and the parts that draw the cursor specifically.
The background light window of the book icon indicating that icon is being selected is the selectable shape
If I understand your sentence correctly then what you want is simply impossible - because you simply misunderstood how icons are drawn.

Icons are always pictures. The engine draws a 32x32 pixel segment of the iconsheet picture - but it has absolutely no way to determine what shape is in that picture.
So the engine can be set to draw a frame around the entire icon, but it cannot draw a frame in the form of the book displayed on that icon.

The icon height and width you found define the grid that the engine uses to determine which part of the icon sheet to take as the icon - changing those numbers will change the grid completely, resulting in icons that are often partially broken because the grid no longer fits.

Drawing a square frame around an icon will require changes in the code of the screen where the icon is drawn, it has nothing to do with the icon itself. And these changes usually require the screen to be restructured because the frame around the icon would be larger than the icon alone.


What is theoretically possible is to change the code in a way that a selected icon uses a different picture to be drawn from. Then you would need two icon sheets, and modify the icons on the second iconsheet with an image program to have a different look like an outline around the item displayed on the icon. But again that would be part of the picture drawn - the engine itself is still unable to analyse what is drawn and recognize forms or frames.
If I understand your sentence correctly then what you want is simply impossible - because you simply misunderstood how icons are drawn.

Icons are always pictures. The engine draws a 32x32 pixel segment of the iconsheet picture - but it has absolutely no way to determine what shape is in that picture.
So the engine can be set to draw a frame around the entire icon, but it cannot draw a frame in the form of the book displayed on that icon.

The icon height and width you found define the grid that the engine uses to determine which part of the icon sheet to take as the icon - changing those numbers will change the grid completely, resulting in icons that are often partially broken because the grid no longer fits.

Drawing a square frame around an icon will require changes in the code of the screen where the icon is drawn, it has nothing to do with the icon itself. And these changes usually require the screen to be restructured because the frame around the icon would be larger than the icon alone.


What is theoretically possible is to change the code in a way that a selected icon uses a different picture to be drawn from. Then you would need two icon sheets, and modify the icons on the second iconsheet with an image program to have a different look like an outline around the item displayed on the icon. But again that would be part of the picture drawn - the engine itself is still unable to analyse what is drawn and recognize forms or frames.
Since you haven't actually answered my questions, here is some generic advice:

Look into window selectable and the parts that draw the cursor specifically.


Thank you for your advice, it's finally done!

Original thread: https://forums.rpgmakerweb.com/threads/how-do-you-draw-a-icon-command-that-matches-the-selectable-shape.109417/