Can you Rotate an image?
Monkey Forums/Monkey Programming/Can you Rotate an image?
| ||
Can you Rotate an image? |
| ||
Hardcoal I suggest you read the docs and the api - a lot of your questions will be answered there. Two ways to rotate images: * Use the Matrix command: Function Rotate( angle# ) * Use the DrawImage command: Function DrawImage( image:Image, x#, y#, rotation#, scaleX#, scaleY#, frame=0 ) |
| ||
belive me I look alot before i ask. but maybe if ill ask the basic quastions someone else wouldnt need too. thanks |
| ||
belive me I look alot before i ask. Thats good... maybe you are looking in the wrong place. For graphics commands, go to the Welcome to Monkey section, then click on Modules reference, click on mojo.graphics. You will then see a list of graphics commands. And you can see the Rotate command right there. The "hard" one to find was the second DrawImage command, but since you were talking about images I would have looked at the DrawImage command too. Oh and here is how to use the Matrix command, before you ask ;) PushMatrix Translate 20,20 ' draw at 20, 20 Rotate 90 ' rotate 90 degrees DrawImage image,0,0 PopMatrix |
| ||
Oh and here is how to use the Matrix command, before you ask ;) To elaborate on therevills's example, I'll just mention that PushMatrix takes a "snapshot" of your current translation/rotation/scale, etc. and PopMatrix reverts back to that snapshot. It's so that you can do a heap of rotations and scaling for a series of rendering commands (one in this case), then revert to your old values. |
| ||
The issue is that there are no simple examples in this pack of examples. I didnt know that for example the commend DrawImage has two versions. One with rotate and one without. Im a guy who doesnt like to read a manual from start to end. I like to see simple examples and conclude from that how commands works. They should add on monkey code examples also a basic section Like Rotating an Image. and other things. Offcourse im not looking at the right place.. thats the problem. i need to look everywhere just to find something simple like rotate image. Ive checked mojo graphics offrcourse still no exmaples just plane explainations which are not clear at all. I must mention. all those problem never been in Blitz3D, Max etc.. It was easy to learn.. many begginers would not know what to do and will obbend this launguage or suffer what i had to learn. Im really prograssing now in my monkey studies. but I spend hours for nonesense that could be saved if explaination was streight followed by simple basic demos. Sorry for type mistakes. I have not installed Offic yet :p thanks for all again |
| ||
The best thing is to study it. Not everybody is motivated enough to just do it. A friend of mine just learned the docs and the examples shipped with monkey and he has great progress with no limits. This is the same i did and most of us did. For mojo you can do it like this: Import mojo Field Direction:Float = 0 Method OnUpdate:Void() If(Direction >= 100) Direction -= 360 Else Direction += 1 End End Method OnRender:Void() DrawImage(Self.Img,DeviceWidth/2,DeviceHeight/2,Direction,1.0,1.0,0) End greetz |
| ||
Yea but your freind had you as well right :) |
| ||
I have to admit the docs are hard to find, and difficult to dig through. |
| ||
I agree that the docs are definitely lacking and things are hard to find. There are a couple of times when I have spent WAY too much time on something that should have only taken a few minutes to get because it was a bunch of trial and error. |
| ||
another simple quastion i have while were at it. How do i write in the same line two diffrent commands? Example: A=23 : B=34 : etc... what is the seperator for that in monkey? |
| ||
Since Monkey v43 you use the semi-colon:a = 23 ; b = 34 Previously a white space was good enough... |