File: animations.cpp

package info (click to toggle)
qonk 0.3.1-1
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 2,076 kB
  • ctags: 2,026
  • sloc: cpp: 14,978; sh: 3,464; makefile: 200
file content (38 lines) | stat: -rw-r--r-- 1,052 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// Copyright 2005 by Anthony Liekens anthony@liekens.net

#include "animations.h"
#include "timer.h"
#include "planets.h"
#include "coordinate.h"
#include "canvas.h"

void
AnimationQueue::render(Uint32 time) {
  for( iterator i = begin(); i != end(); i++ ) {
    Animation* animation = (Animation*)( i->second );
    animation->render(time);
  }
}

SonarAnimation::SonarAnimation() {
}

SonarAnimation::SonarAnimation( Planet* planet, const Uint32& color, const int& size, const Uint32& startTime, const Uint32& endTime, bool circle ) {
  this->circle = circle;
  this->planet = planet;
  r = ( color & 0xFF0000 ) >> 16;
  g = ( color & 0x00FF00 ) >> 8;
  b = ( color & 0x0000FF );
//  this->color = color;
  this->size = size;
  this->startTime = startTime;
  this->endTime = endTime;
}

void
SonarAnimation::render(Uint32 time) {
  if( ( time > startTime ) && ( time < endTime ) ) {
    double percentage = (double)( time - startTime ) / ( endTime - startTime );
    Canvas::drawSonar(planet->getLocation(), size, percentage, r, g, b, circle);
  }
}