Wintermute Engine Forum

Wintermute Engine => Technical forum => Topic started by: piere on April 08, 2012, 03:12:25 AM

Title: Scale windows or static objects
Post by: piere on April 08, 2012, 03:12:25 AM
Hello I am trying to scale windows and static objects but it is not working. For example, I am using this code on left click when I want to scale an image that is normally 100 length in X

image =this.GetWidget("image");
image.ScaleX = 50

I am also using this with windows it doesnt scale anything. Anyone know what to do?
Title: Re: Scale windows or static objects
Post by: eborr on April 08, 2012, 11:46:04 AM
try setting the scalable attribute to true first

Title: Re: Scale windows or static objects
Post by: piere on April 08, 2012, 09:22:58 PM
I do, still nothing
Title: Re: Scale windows or static objects
Post by: piere on April 10, 2012, 04:24:19 AM
Update:   I feel that the ".Length" command is more of what I want that the ScaleX command, Howeer I cannot get this to work either. Ive done it on entities, static objects, and windows and nothing works... Anyone have any more tips?
Title: Re: Scale windows or static objects
Post by: Mnemonic on April 10, 2012, 05:19:24 PM
UI objects have .Width and .Height properties.
Title: Re: Scale windows or static objects
Post by: 2.0 on April 16, 2012, 03:10:58 PM
I am also using this with windows it doesnt scale anything. Anyone know what to do?

You need to slightly modify sources of the game. For example, to enable ScaleX, ScaleY and AlphaColor parameters for Button objects you need to change HRESULT CUIButton::Display(int OffsetX, int OffsetY) method in UIButton.cpp

There you need to place

Code: [Select]
if(image) image->Draw(ImageX +((m_Press||m_OneTimePress)&&back?1:0), ImageY +((m_Press||m_OneTimePress)&&back?1:0), m_PixelPerfect?this:NULL, m_ScaleX, m_ScaleY, m_AlphaColor);

instead of

Code: [Select]
if(image) image->Draw(ImageX +((m_Press||m_OneTimePress)&&back?1:0), ImageY +((m_Press||m_OneTimePress)&&back?1:0), m_PixelPerfect?this:NULL);

Mnemonic, in this connection also I have a question for you. For what reason you cut off a functional of interface objects in comparison with other objects (entities) whereas they have the general ancestor and in principle can be more flexible.