Controls.h 1.75 KB
Newer Older
1 2
/* 
 * File:   Controls.h
3
 * Author: Johannes Fischer
4 5 6 7 8 9 10
 *
 * Created on July 13, 2014, 6:40 PM
 */

#ifndef CONTROLS_H
#define	CONTROLS_H

11
#include <SDL/SDL.h>
daFischer's avatar
daFischer committed
12
#include <sstream>
13

14
#include "AudioInterface.h"
15 16
//#include "Video.h"
class Video;
17 18
#include "ProtocolPreferences.h"

19 20 21
#ifndef _STDIO_H
using namespace std;
#endif
22 23 24 25 26 27 28 29 30 31

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

using namespace std;

class Controls {
public:
    Controls(Video* video, AudioInterface* audio);
32
    ~Controls();
33 34 35 36
    void update();
    void registerClick(Uint16 mx, Uint16 my);
    void registerMouseUp();
    void registerMovement(Uint16 mx, Uint16 my);
37
    void draw(SDL_Surface *screen);
38
    
39
    int progress;           //timestamp of next to be filled IndexEntry, -1 if all have been filled
40 41
    
private:
42 43 44 45 46 47 48
    
    void togglePlay();
    void toggleFullscreen();
    void skipTo(int position);
    Uint32 emColor(Uint32);
    void redefineRect(SDL_Rect* rect, int x, int y, int w, int h);
    void changeVolume(float volume);
49
    void changeSpeed(float volume);
daFischer's avatar
daFischer committed
50 51
    void drawScaledText(SDL_Surface* screen, SDL_Surface* text, short x, short y, char factor);
    Uint32 readPixel(SDL_Surface* source, int x, int y);
52 53 54

    Video* video;
    AudioInterface* audio;
55 56
    int y;
    int width, height, screenHeight;
57 58
    int timeLineHeight;
    bool timeLineClicked;
daFischer's avatar
daFischer committed
59
    int mouseX, mouseY;
60 61
    bool volumeClicked;
    float volume;
62 63
    bool speedClicked;
    float speed;
64
    int duration;
65 66 67 68 69
    
    SDL_Surface* surfPlay;
    SDL_Surface* surfVolume;
    SDL_Surface* surfVolume2;
    SDL_Surface* surfFullscreen;
70 71
    SDL_Surface* surfSpeed;
    SDL_Surface* surfSpeed2;
72 73 74 75
};

//#ifdef EMSCRIPTEN
extern "C" bool getOnFullScreenButton();
76
extern "C" bool getOnPlayButton();
77 78 79 80 81
//#endif


#endif	/* CONTROLS_H */