Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / rotating

Author
Message
westray
22
Years of Service
User Offline
Joined: 10th Oct 2002
Location: Falkirk,Scotland
Posted: 26th Dec 2008 13:11
Say I want to rotate an object through 90deg.Can I call a function with a while loop in it that increments the angle of the object by say 1deg every iteration of the while loop and show this rotation on screen.In other words can the function be made to wait 1 frame between each iteration of the while loop and show the result at that moment.
study
15
Years of Service
User Offline
Joined: 12th Dec 2008
Location:
Posted: 26th Dec 2008 13:40
I think you can write something like this:

if you want it alternate ( every one ) you need another bool variable in while loop.make Not the variable before running degree ++ and then check if its 1, if yes run degree ++ and dbYRotateobject if its 0 skip them ( but you need for while loop degree <= 180 )
I have not used this code and im not sure it works but you can do in this way.
westray
22
Years of Service
User Offline
Joined: 10th Oct 2002
Location: Falkirk,Scotland
Posted: 26th Dec 2008 14:09
This will not work.When you call this function the while loop will run and turn the object 90deg.On the next sync the object will have turned a complete 90deg.i.e will have jumped from 0 to 90
study
15
Years of Service
User Offline
Joined: 12th Dec 2008
Location:
Posted: 26th Dec 2008 14:34
Oh yes you're right, You want to rotate slowly?
if yes i think setting a timer can help.
SunDawg
19
Years of Service
User Offline
Joined: 21st Dec 2004
Location: Massachusetts
Posted: 26th Dec 2008 17:56 Edited at: 26th Dec 2008 17:59
This ought to do what you want:


I commented it well enough that you should be able to figure it out, but if you are still confused about something, just ask.

Oh, I see you wanted it as a function. That raises a couple of questions. Do you want the program to halt and wait for the object to rotate, or do you want to continue running while it does so?


My site, for various stuff that I make.
jezza
16
Years of Service
User Offline
Joined: 8th Mar 2008
Location: Bham, UK
Posted: 26th Dec 2008 21:48
use the original code snippet, but change the while to an if.
sydbod
16
Years of Service
User Offline
Joined: 14th Jun 2008
Location: Just look at the picture
Posted: 27th Dec 2008 00:46 Edited at: 27th Dec 2008 01:05
You can try something like this


I have not checked if there are any errors in it, it is only meant as a guide to what the code can look similar to.
Zuka
16
Years of Service
User Offline
Joined: 21st Apr 2008
Location: They locked me in the insane asylum.
Posted: 28th Dec 2008 23:59
whoa, it's a DISCRAPENCY!
sydbod
16
Years of Service
User Offline
Joined: 14th Jun 2008
Location: Just look at the picture
Posted: 29th Dec 2008 03:09 Edited at: 29th Dec 2008 03:15
Uggggg!!!! it is actually a DISCREPANCY, rather than a DISCRAPENCY or a DISCREPENCY.

Never said I could spell

I suppose the real important part is only "does it work".

EDIT: One wonders if westray found any of the suggestions helpful?

Login to post a reply

Server time is: 2024-11-25 10:00:40
Your offset time is: 2024-11-25 10:00:40