Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

branches/avi_play: …

File size: 1.9 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
18#include "movie_player.h"
19#include "load_param.h"
20#include "resource_manager.h"
21
22
23using namespace std;
24
25
26MovieLoader::MovieLoader(const TiXmlElement* root)
27{
28  this->setClassID(CL_MOVIE_LOADER, "MovieLoader");
29
30  movie_player = new MoviePlayer();
31  this->loadParams(root);
32}
33
34MovieLoader::~MovieLoader()
35{
36  PRINTF(4)("Deleted MoviePlayer\n");
37}
38
39
40
41void MovieLoader::loadParams(const TiXmlElement* root)
42{
43  StoryEntity::loadParams(root);
44
45  LoadParam(root, "name", this, MovieLoader, loadMovie);
46}
47
48void MovieLoader::loadMovie(const char* filename)
49{
50  movie_player->loadMovie(filename);
51
52  PRINTF(0)("loaded Movie %s", filename);
53}
54
55
56ErrorMessage MovieLoader::init()
57{
58
59}
60
61
62ErrorMessage MovieLoader::loadData()
63{
64
65}
66
67
68ErrorMessage MovieLoader::unloadData()
69{
70
71}
72
73bool MovieLoader::start()
74{
75  this->isRunning = true;
76
77  //this->run();
78}
79
80bool MovieLoader::stop()
81{
82  this->isRunning = false;
83}
84
85bool MovieLoader::pause() { }
86bool MovieLoader::resume() { }
87
88void MovieLoader::run()
89{
90  // first timestamp for t = 0
91  this->lastFrame = SDL_GetTicks ();
92
93  while( this->isRunning)
94  {
95
96    this->tick();
97
98    //movie_player->draw();
99  }
100}
101
102void MovieLoader::tick()
103{
104  // get timestamp
105  currentFrame = SDL_GetTicks();
106
107  // calculate time difference in milliseconds (Uint32)
108  this->dt = currentFrame - this->lastFrame;
109  // calculate time difference in seconds (float)
110  this->dts = (float)this->dt / 1000.0f;
111
112  movie_player->tick(dts);
113
114  this->lastFrame = currentFrame;
115}
Note: See TracBrowser for help on using the repository browser.