1280/1024=1?
Blitz3D Forums/Blitz3D Programming/1280/1024=1?
| ||
I there, just this few lines, i don't understand why the result is 1 ! I'm on 1.96 version Graphics3D 640,480,16,0 SetBuffer BackBuffer() camera=CreateCamera() While Not KeyDown( 1 ) RenderWorld ScreenRatio# = 1280/1024 Text 0,0,ScreenRatio# Flip Wend End |
| ||
ScreenRatio# = 1280/1024.0 |
| ||
1280 and 1024 are being interpreted as integers and so integer division is used. You have to tell Blitz that one or both of the values are floating-point, before it will use floating-point division. To do this you need to put ".0" on the end of the number (as Fred shows). |
| ||
OK but the purpose was to determine the screenratio, so screenratio# = GraphicsWidth() / GraphicsHeight() which still give 1, instead of 1280/1024 = 1.25. I just want to know if the screen is 4/3 ratio or 16/9, to accord the camera FOV. Thank's |
| ||
screenratio# = float(GraphicsWidth()) / float(GraphicsHeight()) |
| ||
Also, please try to post stuff like this in the programming forums first. Post in the bug reports section *only* when it's confirmed as being a bug. If BRL has less noise to sieve through we're more likely to get a response to genuine bug reports...Thanks :o) |
| ||
What Fred said. |
| ||
Yes i will. |