^..^
6th May 2005 14:47 UTC
Make Texer size fit to screen width/height
I know this is just a rather stupid and small problem, but i just can't think of how to solve it. :cry:
In texerII i want to have lets say 10 elements (n=10) in a row (eg. along the x-axis). Now i want each one to be adjacent to the next one however the screenwidht is. I know that i can avoid those nasty gaps by aspect-ratio-correcting the 'sizex'-value. But i just can't think of the code... :mad:
Thanks in advance!!
ASD5A
6th May 2005 18:39 UTC
this should solve your prob:
in init:n=32;bmpb=63.7;
in frame:t=t-0.01;n0=(n-1)/n;
//bmpb=breite des genutzten texer2 bitmaps in pixel-ca.0.3 wegen rundungsfehler;
//bmpb=width of the used texer2 bitmaps in pixel-~0.3 because of rounding failures;
in point:
x=(2*i-1)*n0;y=sin(i*3.14159*5+t)*0.1;
sizex=w/n*1/bmpb;
sizey=0.5-0.5*sin(i*3.14159*5+t*1.2);
eheiney
6th May 2005 18:43 UTC
Well, let's see here:
So, if the window's dimensions are, let's say, 200x200, you'd want the row of texers to be the same in size, and have the same amount of distance in between each texer, as if the window were, let's say, 16784x200?
I don't know if I read that right or not. If not, just ignore my stupidity. :p
Tuggummi
6th May 2005 19:25 UTC
For particle size fix on resolution you simply use the w & h variables. You can just use sizex=w*verysmallnumber ; sizey=h*verysmallnumber, but this way you'll end up with "squished" non-aspect-ratio corrected particles (your squares will be rectangles and your circles ellipses). Also you could use sizex=w*h*veryfuckingsmallnumber ; sizey=sizex ; this way it compares to the whole resolution and resizes your particles accordingly, but it's a tricky business and it might not work in "quirky" resolutions.
In any case, you need to use w and/or h, how you do it is up to you :p
My method is simply to "compare" the viewers resolution to my own and adjust the size based on that value.
^..^
6th May 2005 19:32 UTC
thanks a lot guys! haven't had a chance to look at your ideas cause im just about going out... will have a closer look later!
vielen dank! Bin grad auf dem Sprung, konnte mir das also noch nich genau durchlesen. Werd's aber später nachholen!
TomyLobo
6th May 2005 21:26 UTC
read the expression help ;)
iw, ih - texer bitmap size
w, h - avs window size
if you dont care about squished pixels you just do this:
frame: szx=w/iw*<constant>; szy=h/ih*<constant>;
point: sizex=szx; sizey=szy;
^..^
6th May 2005 22:25 UTC
Originally posted by TomyLobo
iw, ih - texer bitmap size
ouch! that hurts! But thanks, problem solved!!!! :)
I was bothering about that for quite some time, and it turned out to be so disgracing simple...
Thanks you all for your input! :up: