Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/avi_play/src/story_entities/movie_loader.cc @ 6574

Last change on this file since 6574 was 6574, checked in by stefalie, 18 years ago

branches/avi_play: …

File size: 1.5 KB
Line 
1/*
2   orxonox - the future of 3D-vertical-scrollers
3
4   Copyright (C) 2004 orx
5
6   This program is free software; you can redistribute it and/or modify
7   it under the terms of the GNU General Public License as published by
8   the Free Software Foundation; either version 2, or (at your option)
9   any later version.
10
11   ### File Specific:
12   main-programmer: David Hasenfratz, Stefan Lienhard
13   co-programmer:
14*/
15
16#include "movie_loader.h"
17#include "movie_player.h"
18#include "resource_manager.h"
19
20using namespace std;
21
22
23MovieLoader::MovieLoader()
24{
25  this->setClassID(CL_MOVIE_LOADER, "MovieLoader");
26}
27
28MovieLoader::~MovieLoader()
29{
30  PRINTF(4)("Deleted MoviePlayer\n");
31}
32
33
34
35void MovieLoader::loadParams(const TiXmlElement* root)
36{
37
38}
39
40
41ErrorMessage MovieLoader::init()
42{
43
44}
45
46
47ErrorMessage MovieLoader::loadData()
48{
49
50}
51
52
53ErrorMessage MovieLoader::unloadData()
54{
55
56}
57
58bool MovieLoader::start()
59{
60  this->isRunning = true;
61
62  this->run();
63}
64
65bool MovieLoader::stop()
66{
67  this->isRunning = false;
68}
69
70bool MovieLoader::pause() { }
71bool MovieLoader::resume() { }
72
73void MovieLoader::run()
74{
75  // first timestamp for t = 0
76  this->lastFrame = SDL_GetTicks ();
77
78  while( this->isRunning)
79  {
80
81    this->tick();
82
83    movie_player->draw();
84  }
85}
86
87void MovieLoader::tick()
88{
89  // get timestamp
90  currentFrame = SDL_GetTicks();
91
92  // calculate time difference in milliseconds (Uint32)
93  this->dt = currentFrame - this->lastFrame;
94  // calculate time difference in seconds (float)
95  this->dts = (float)this->dt / 1000.0f;
96
97  movie_player->tick(dts);
98
99  this->lastFrame = currentFrame;
100}
Note: See TracBrowser for help on using the repository browser.