Player.h 956 Bytes
Newer Older
daFischer's avatar
first  
daFischer committed
1 2
/* 
 * File:   Player.h
3
 * Author: Johannes Fischer
daFischer's avatar
first  
daFischer committed
4 5 6 7 8 9 10 11 12 13 14 15 16 17
 *
 * Created on April 30, 2014, 4:30 PM
 */

#ifndef PLAYER_H
#define	PLAYER_H

#ifdef EMSCRIPTEN
#include <emscripten/emscripten.h>
#else
#endif

#include <SDL/SDL.h>
#include <SDL/SDL_mixer.h>
daFischer's avatar
daFischer committed
18
#include <SDL/SDL_ttf.h>
daFischer's avatar
first  
daFischer committed
19 20 21 22 23

#include <stdio.h>
#include <fstream>
#include <time.h>

daFischer's avatar
daFischer committed
24 25 26 27
#include "AudioInterface.h"
#ifdef EMSCRIPTEN
#include "AudioJS.h"
#else
daFischer's avatar
first  
daFischer committed
28
#include "Audio.h"
daFischer's avatar
daFischer committed
29
#endif
daFischer's avatar
first  
daFischer committed
30
#include "Video.h"
31
#include "Controls.h"
daFischer's avatar
first  
daFischer committed
32 33 34 35 36

using namespace std;

class Player {
public:
37
    Player(string filename);
daFischer's avatar
first  
daFischer committed
38 39
    void loop();
    virtual ~Player();
daFischer's avatar
daFischer committed
40 41 42 43 44 45
#ifdef EMSCRIPTEN
    static void loadAsync();
#else
    static bool loadAsync();
#endif
    void videoCallback();
daFischer's avatar
first  
daFischer committed
46
    
daFischer's avatar
daFischer committed
47
    static TTF_Font* font;
daFischer's avatar
daFischer committed
48
    
daFischer's avatar
first  
daFischer committed
49
private:
daFischer's avatar
daFischer committed
50
    AudioInterface *audio;
daFischer's avatar
first  
daFischer committed
51
    Video *video;
52
    Controls* controls;
daFischer's avatar
first  
daFischer committed
53 54 55 56 57 58 59 60
    bool paused;
#ifndef EMSCRIPTEN
    bool quit;
#endif
};

extern Player *player;
void emLoop();
61
void cleanUp();
daFischer's avatar
first  
daFischer committed
62 63 64

#endif	/* PLAYER_H */