Command for drawing repeating images?
Monkey Forums/Monkey Programming/Command for drawing repeating images?
| ||
Hi, I am curious if there is a command(s) that can be used to draw repeating images to match a certain width (or height)? pseudocode: DrawImage(image,startPosX, startPosY,EndPosX, EndPosY) (A hack around this would be to create a very wide picture and then only draw parts of the picture if the width you want to render is less than the image width.) Thanks for any help! |
| ||
There is something in bananas/Richard_Betson/TileImage/ which i think is what you're after. |
| ||
Thanks for the suggestion. I realised that I only needed to do this on app start up, so I used an other example (for collision detection I believe) where I actually create a button in realtime based on the display size of the device running the app. |
| ||
A quick and dirty image tile function would be like this (not tested)Function DrawTileImage(image:Image,x:Int,y:Int,width:Int,height:Int) Local Width:Int = width/image.Width Local Height:Int = height/image.Height For local x:int = 0 until Width For local y:Int = 0 until Height DrawImage image,x*image.Width,y*image.height Next Next End Function You could also throw in a SetScissors to better cull the area. |