SetScale?
BlitzMax Forums/BlitzMax Beginners Area/SetScale?
| ||
I am trying to make the picture bit bigger Background:Timage = Loadimage("Mountain.png") SetScale Background,2,2 or it is Setscale that come first before loading image? |
| ||
I think it's just setscale 2,2 and it is applied to everything after. |
| ||
setscale transform the matrix for rendering 2D like SetOrigin defines the coordinates of the offset for rendering anything that is drawn "after". and : it does not take an image as parameter. It just takes the X and Y factors Local Background:Timage = Loadimage("Mountain.png") Repeat Cls SetScale 2,2 DrawImage BackGround, 0,0 Flip True Until Keydown(KEY_ESCAPE) End |
| ||
Thanks guys and got it working :-) |
| ||
How would I know if Image reach end of the screen then make repeat of image again. I was using just Drawimage but I think Tileimage would be easier even thought it need cover up otherwise it will be tileimage everywhere on the screen! |
| ||
Just a small question @ hotshot: Did you take over the account from someone? Just asking because you are user here for >10 years and are asking so basic things. @End of screen X + image.Width = right side Just check whether that right side is bigger than GraphicsWidth(). The difference could be used to draw it again (offset accordingly) on the left side. bye Ron |
| ||
Just a small question @ hotshot: no. I seem forgot basic things! sorry! I will try that :) |
| ||
SetScale is just like Setcolor, in that if modifies everything you draw afterwards -- so if you want to just increase the size of a single image:Setscale 2,2 Drawimage background,100,100 Setscale 1,1 Drawimage sprite1,100,100 Drawimage sprite2,100,100 ... And as an aside: you can also use SetScale to flip images horizontally or vertically, by using negative values: Setscale -1,-1 will flip the image in both directions. (Although the handle won't move, so you either need to do that explicitly or adjust your drawing location accordingly) |
| ||
Negative SetScale ? I was using negative values for DrawImageRect to get mirror flips. Good to know SetScale can go negative, Xlsior ! |
| ||
You could use setviewport() to clip the tileimage to a region of the screen;setviewport(32,32,200,200) tileimage(image,0,0,0) setviewport(0,0,GraphicsWidth(),GraphicsHeight()) |