/* orxonox - the future of 3D-vertical-scrollers Copyright (C) 2004 orx This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. ### File Specific: main-programmer: David Hasenfratz, Stefan Lienhard co-programmer: */ #include "movie_loader.h" #include "movie_player.h" #include "load_param.h" #include "resource_manager.h" using namespace std; MovieLoader::MovieLoader(const TiXmlElement* root) { this->setClassID(CL_MOVIE_LOADER, "MovieLoader"); movie_player = new MoviePlayer(); this->loadParams(root); } MovieLoader::~MovieLoader() { PRINTF(4)("Deleted MoviePlayer\n"); } void MovieLoader::loadParams(const TiXmlElement* root) { StoryEntity::loadParams(root); LoadParam(root, "name", this, MovieLoader, loadMovie); } void MovieLoader::loadMovie(const char* filename) { movie_player->loadMovie(filename); PRINTF(0)("loaded Movie %s", filename); } ErrorMessage MovieLoader::init() { } ErrorMessage MovieLoader::loadData() { } ErrorMessage MovieLoader::unloadData() { } bool MovieLoader::start() { this->isRunning = true; this->run(); } bool MovieLoader::stop() { this->isRunning = false; } bool MovieLoader::pause() { } bool MovieLoader::resume() { } void MovieLoader::run() { // first timestamp for t = 0 this->lastFrame = SDL_GetTicks (); while( this->isRunning) { this->tick(); //movie_player->draw(); } } void MovieLoader::tick() { // get timestamp currentFrame = SDL_GetTicks(); // calculate time difference in milliseconds (Uint32) this->dt = currentFrame - this->lastFrame; // calculate time difference in seconds (float) this->dts = (float)this->dt / 1000.0f; movie_player->tick(dts); this->lastFrame = currentFrame; }