googlecodetogithub / libgdx-users

Automatically exported from code.google.com/p/libgdx-users
0 stars 0 forks source link

Ninepatch scaling problem #22

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Just make an OrtographicCamera with W and H: 15x10
2. Use a ninepatch image 24x24
3. Just show it on the screen

What is the expected output? What do you see instead?
There should have been a very smooth looking image with the predefined size for 
ninepatch image, however I get very large and pixalted looking image. But if I 
scale the camera view up to 1500x1000 then the ninepatch image looks correct.

What version of the product are you using? On what operating system?
Not sure which version of libgdx I'm using, I only know the date downloaded: 
07.07.2012. Windows 7 64bit

Please provide any additional information below.
I have attached my game. Just change the values CAMERA_WIDTH and CAMERA_HEIGHT 
values in WorldRenderer.java to 15x10 you'll see that the nine patch will 
rendered incorrectly, then change those values to 1500x1000 then it will be 
rendered correctly. The function where I call the ninepatch is called 
"restartMenu()" which is in the same file.

Oh for the google upload the game project file was to big here is link to my 
server:
http://morf.lv/my_game.rar (~47Mb)

Original issue reported on code.google.com by raivu...@gmail.com on 15 Jul 2012 at 9:35

GoogleCodeExporter commented 9 years ago
This problem is due to the lack of functions which modify the patches' scale. 
since a patch is unable to scale its texture a patches texture will look 
different from resolution to resolution. In order to rectify this, I have 
extended the ninepatch class, adding functions which modify the X and Y scale 
of the texture.
The extended class is at https://gist.github.com/3119086 .
Do whatever you wish with it.

Original comment by Clay.Swe...@gmail.com on 15 Jul 2012 at 11:28

GoogleCodeExporter commented 9 years ago
First of, thanks for the extension

I have one question, where exactly function getPatches() should be located, my 
project doesn't recognize it? Should I some how pass the "patches" variable 
from NinePatch.java?

Original comment by raivu...@gmail.com on 15 Jul 2012 at 11:44

GoogleCodeExporter commented 9 years ago
Yup, Now I definitely found out that getPatches() function is deleted from new 
NinePatch.java revision. I'm just going to alter the NinePatch.java source a 
little bit and hopefully it should work. Thanks.

Original comment by raivu...@gmail.com on 16 Jul 2012 at 9:50

GoogleCodeExporter commented 9 years ago
A 47mb game isn't the executable example I was hoping for. Any chance you can 
make a single file + image that shows the problem?

Original comment by nathan.s...@gmail.com on 16 Jul 2012 at 11:11

GoogleCodeExporter commented 9 years ago
Also this is the libgdx-users issue tracker, not the libgdx issue tracker.

Original comment by nathan.s...@gmail.com on 16 Jul 2012 at 11:12

GoogleCodeExporter commented 9 years ago
hehe, yeah I noticed :D I Just issued in real tracker. I honestly didn't know 
there are two. I just saw the logo, you know...

Original comment by raivu...@gmail.com on 17 Jul 2012 at 12:37