Some Nuggets Of Info About Size_x, Size_y


TrevorBradley

Active Member
Joined
Nov 6, 2007
Messages
732
Learned some things tonight, thought I'd share.

size_x and size_y are the scaled percentage of the original graphic in the x and y direction. I've updated the fenixdocs wiki to reflect this (fenixdocs originally said size_x and size_y were measured in pixels).

I'm trying to do smooth scaling of a graphic, zooming in and out smoothly trying to make it bigger or smaller, and I hit a bit of a quandary. There are the two options I see:

1) Create a really large png (eg 600x600), then scale it down small as needed. This was my first choice, but there's a fundamental flaw with this: size_x is an integer, not a float. The jump between size_x = size_y = 30 and size_x = size_y = 29 is huge, about 3 percent (18 pixels!), and causes a jerky shrinking motion.

2) Create a really small png, then scale it up larger as needed. This gets rid of the chunky problem (I noticed size_x above 300 removed all "jumping" effects, but then the image looks pixelated.

I've gone for a compromise, creating several graphics of various smaller sizes and keeping size_x = size_y in the 300-400 range, swapping in and out maps of various sizes as needed. It's a bit pixelated, but smooth.

Rotation finally also works well with this compromise.

I'll leave it up to the reader to figure out what a spinning, smoothly zooming in and out graphic might be used for... :)
 
Just in case you didn't know, if your intention is just to scale both axis equally you can just use the local variable 'size' which will scale both axis at the same time. Size_x and size_y are useful if you want to stretch the image .
Scaling and rotation (particularly in 16bit mode) can really bog down fenix however so use it wisely.
 
ruckage said:
Just in case you didn't know, if your intention is just to scale both axis equally you can just use the local variable 'size' which will scale both axis at the same time. Size_x and size_y are useful if you want to stretch the image .
Scaling and rotation (particularly in 16bit mode) can really bog down fenix however so use it wisely.
Hmm, that's not in fenixdocs at all... works great... I'll see if I can add that.

I've been watching my fps like a hawk... So far graphics aren't the issue, it's the math this time (again...) .... though I notice that sometimes basic primitives (fcircle) not drawn on a map, or drawn outside the rendered area can really bog things down.

I wish I could have avoided the primitives but there's really no way around it for what I'm trying to do. My kingdom for a proper "draw_ellipse"...
 
Last edited by a moderator:
You can use draw_curve() for that, I think. Not sure but I'll settle for half your kingdom if it works.

A lot of things are not in the wiki, sadly. While it currently is one of the most complete Fenix documentation repositories, not a lot of people add to it, i.e. it's almost entirely my work. Thanks for the correction and feel free to add any other stuff you find, like the local variable size.
 
Sandman said:
You can use draw_curve() for that, I think. Not sure but I'll settle for half your kingdom if it works.

A lot of things are not in the wiki, sadly. While it currently is one of the most complete Fenix documentation repositories, not a lot of people add to it, i.e. it's almost entirely my work. Thanks for the correction and feel free to add any other stuff you find, like the local variable size.



I tried draw_curve... It left a lot to be desired... :| There are just too many points in an ellipse for them to be drawn properly.

Hmm, on second consideration I might be able to use them while zoomed **way** in. But I give too much away to what I'm doing.. :)
 
Last edited by a moderator:
Back
Top