Thu, 21 Apr 2011 01:53:15 +0000

- author
- cemkalyoncu
- date
- Thu, 21 Apr 2011 01:53:15 +0000
- changeset 20
- cc549c0f8ebd
- parent 1
- 1ef17765f966
- child 21
- 016809939f8a
- permissions
- -rw-r--r--

* geffects >> gorgon::effects

* gre >> gorgon::resource

* gorgonwidgets >> gorgon::widgets

* graphics moved to gorgon::graphics

* no longer using any namespace in headers

* widget layer moved to widgets

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

2 | ||

20 | 3 | namespace gge { namespace effects { |

1 | 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 | } | |

20 | 58 | } } |