Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/avi_play/src/subprojects/importer/movie_player_test.cc @ 6382

Last change on this file since 6382 was 6382, checked in by hdavid, 18 years ago

branches\avi_play: removed memory leak

File size: 1.8 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
13   co-programmer: ...
14
15   this file extends the framework file, so it renders what i want.
16*/
17
18#include <stdlib.h>
19
20#include "framework.h"
21#include "movie_player.h"
22
23MoviePlayer* movie_player;
24float start_time;
25
26void Framework::moduleInit(int argc, char** argv)
27{
28  if( argc <= 1)
29  {
30    printf("Wrong arguments try following notations:\n");
31    printf("./movie_player_test [media_file]\n");
32    exit(0);
33  }
34
35  movie_player = new MoviePlayer(argv[1]);
36  movie_player->printInformation();
37 
38  //start_time = atoi(argv[2]);
39  start_time = 0;
40}
41
42void Framework::moduleEventHandler(SDL_Event* event)
43{
44  switch (event->type)
45  {
46    case SDL_KEYDOWN:
47      switch (event->key.keysym.sym)
48      {
49        case SDLK_1:
50          movie_player->start(start_time);
51          break;
52        case SDLK_2:
53          movie_player->resume();
54          break;
55        case SDLK_3:
56          movie_player->pause();
57          break;
58        case SDLK_4:
59          movie_player->stop();
60          break;
61        case SDLK_9:
62          movie_player->setSpeed(movie_player->getSpeed() - 0.5);
63          PRINTF(0)("speed: %f\n", movie_player->getSpeed());
64          break;
65        case SDLK_0:
66          movie_player->setSpeed(movie_player->getSpeed() + 0.5);
67          PRINTF(0)("speed: %f\n", movie_player->getSpeed());
68          break;
69      }
70  }
71}
72
73void Framework::moduleTick(float dt)
74{
75  movie_player->tick(dt);
76}
77
78void Framework::moduleDraw(void) const
79{
80  movie_player->draw();
81}
82
83
84void Framework::moduleHelp(void) const
85{
86
87}
Note: See TracBrowser for help on using the repository browser.