prGuiButton Image Scaling

When posting bug reports, please remember to provide example code that reproduces the bug + Monkey and Pyro version information!
quankiquanki
Posts: 8
Joined: Sat Sep 17, 2016 3:52 am

prGuiButton Image Scaling

Postby quankiquanki » Tue Oct 04, 2016 3:36 am

I was trying to scale a prGuiButton (button only uses an image, no label) using SetScale but I noticed that setting the scale does not affect the image size at all. It does affect the touch area correctly so I think this could be a bug. I am using Pyro v1.01n

I easily fixed it by adding the _scaleX and _scaleY variables to the prDraw9Patch method call within prGuiButtons Draw method:

Code: Select all

prDraw9Patch drawList,image,_surface.PatchData,0,0,Width,Height,_scaleX,_scaleY,0,0


I also noticed that some other gui components (e.g. prGuiInputBox and prGuiSliderKnob) also do not have the _scaleX and _scaleY variables added to their prDraw9Patch call. I am not sure if all this was intended or not.
User avatar
Tony Smits
Posts: 117
Joined: Sat Jun 20, 2015 9:45 pm
Contact:

Re: prGuiButton Image Scaling

Postby Tony Smits » Wed Oct 05, 2016 2:12 am

Thanks! I will have a look at this...
Bye!
Tony
User avatar
Tony Smits
Posts: 117
Joined: Sat Jun 20, 2015 9:45 pm
Contact:

Re: prGuiButton Image Scaling

Postby Tony Smits » Wed Oct 12, 2016 1:51 pm

Are you sure you are using Pyro v1.01n? i can't replicate the problem. Do you have a project for me to test it?
Bye!
Tony
quankiquanki
Posts: 8
Joined: Sat Sep 17, 2016 3:52 am

Re: prGuiButton Image Scaling

Postby quankiquanki » Fri Oct 14, 2016 4:30 am

Here is a minimal project which should display the bug. I have double checked and I am using Pyro v1.01n. The bug happens when you use SetScale() to scale a button that uses a loaded image. The loaded image will not be scaled down but the touch area does.
Attachments
button-scaling.zip
(15 KiB) Downloaded 17 times
User avatar
Tony Smits
Posts: 117
Joined: Sat Jun 20, 2015 9:45 pm
Contact:

Re: prGuiButton Image Scaling

Postby Tony Smits » Mon Oct 17, 2016 5:47 pm

Okay, I had a look at it. You are right! Simply adding the scales to the draw command solves your problem for now but the bug runs deeper so I need a bit more time to fix this. Weird things happen when the button uses the 9patch data but in your case it should be fine.
Bye!
Tony
APC
Posts: 23
Joined: Sun Nov 29, 2015 1:29 pm
Location: USA
Contact:

Re: prGuiButton Image Scaling

Postby APC » Sun Jan 29, 2017 11:52 am

Hello Tony.

I don't know if you fixed this issue already.


The SurfaceIdleMode.SetImage

Code: Select all

btpen.SurfaceIdleMode.SetImage spr.GetImage("pencil")
does not work anymore , I found out in the templates that you changed to:

Code: Select all

btpen.Surface.DrawData(prGuiState.Idle).SetImage spr.GetImage("pencil")


Also

Code: Select all

btpen.SurfaceDownMode.SetScale 0.98, 0.98
does not work anymore!

It will be nice to know when these changes happens or at least to have a deprecation warning or note.

By the way I see a lot of functionality similar to Pyro 2 , this is good because Monkey 2 is far from being a released product , so I have to stick to Monkey 1, Pyro1 both supporting Mojo 2.
Image
http://apd-games.com/
MacBook Pro OS X El Capitan
XCode Version 7
iPhone 6 running iOS 9
iPad Mini running iOS 9
Galaxy S5
Dell Latitude Windows 10
Palm Pre, Palm Pre2
User avatar
Tony Smits
Posts: 117
Joined: Sat Jun 20, 2015 9:45 pm
Contact:

Re: prGuiButton Image Scaling

Postby Tony Smits » Sat Feb 18, 2017 6:06 pm

Bye!
Tony

Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 1 guest