Wed, 17 Nov 2010 07:48:28 +0000

- author
- cemkalyoncu
- date
- Wed, 17 Nov 2010 07:48:28 +0000
- changeset 1
- 1ef17765f966
- child 20
- cc549c0f8ebd
- permissions
- -rw-r--r--

* Moving to trunk step 2

1 | 1 | #include "LayerMover.h" |

2 | ||

3 | namespace geffects { | |

4 | void LayerMover::Setup(Point From, Point To, int Time) { | |

5 | ||

6 | from=From; | |

7 | current=from; | |

8 | to=To; | |

9 | ||

10 | Target->X=from.x; | |

11 | Target->Y=from.y; | |

12 | this->progressed=0; | |

13 | ||

14 | if(Time) { | |

15 | speed.x=(float)(to.x-from.x)/Time; | |

16 | speed.y=(float)(to.y-from.y)/Time; | |

17 | this->Play(); | |

18 | } else { | |

19 | speed.x=0; | |

20 | speed.y=0; | |

21 | current=from=to; | |

22 | Target->X=to.x; | |

23 | Target->Y=to.y; | |

24 | } | |

25 | } | |

26 | ||

27 | bool LayerMover::isFinished() { | |

28 | return current.x==to.x && current.y==to.y; | |

29 | } | |

30 | ||

31 | void LayerMover::Process(int Time) { | |

32 | if(from.x>to.x) { | |

33 | current.x=from.x+Time*speed.x; | |

34 | ||

35 | if(current.x<to.x) | |

36 | current.x=to.x; | |

37 | } else { | |

38 | current.x=from.x+Time*speed.x; | |

39 | if(current.x>to.x) | |

40 | current.x=to.x; | |

41 | } | |

42 | Target->X=current.x; | |

43 | ||

44 | ||

45 | if(from.y>to.y) { | |

46 | current.y=from.y+Time*speed.y; | |

47 | ||

48 | if(current.y<to.y) | |

49 | current.y=to.y; | |

50 | } else { | |

51 | current.y=from.y+Time*speed.y; | |

52 | if(current.y>to.y) | |

53 | current.y=to.y; | |

54 | } | |

55 | Target->Y=current.y; | |

56 | ||

57 | } | |

58 | } |