Commit 6f60d1e6 authored by daFischer's avatar daFischer

Added images for the Controls. Annotations generally work now

parent b654a836
......@@ -71,7 +71,6 @@ void Audio::togglePlay(){
{
//Play the audio file
alSourcePlay(source);
printf("play2\n");
}
else
{
......@@ -133,3 +132,9 @@ bool Audio::hasFailed()
{
return failed;
}
bool Audio::isPlaying() {
ALint state;
alGetSourcei(source,AL_SOURCE_STATE,&state);
return state==AL_PLAYING;
}
......@@ -39,6 +39,7 @@ public:
int getDuration();
bool hasFailed();
void changeVolume(float volume);
bool isPlaying();
private:
bool failed;
......
......@@ -31,3 +31,7 @@ void AudioInterface::changeVolume(float volume){
bool AudioInterface::hasFailed(){
return true;
}
bool AudioInterface::isPlaying() {
return false;
}
......@@ -8,7 +8,9 @@
#ifndef AUDIOINTERFACE_H
#define AUDIOINTERFACE_H
#include <stdio.h>
#ifndef _STDIO_H
using namespace std;
#endif
using namespace std;
......@@ -22,6 +24,7 @@ public:
virtual int getDuration();
virtual bool hasFailed();
virtual void changeVolume(float volume);
virtual bool isPlaying();
};
......
......@@ -49,4 +49,10 @@ void AudioJS::changeVolume(float volume){
},volume);
}
bool AudioJS::isPlaying(){
return EM_ASM_INT({
return x_audio.paused;
},0)==0;
}
#endif
......@@ -17,7 +17,9 @@
#include "AudioInterface.h"
#ifndef _STDIO_H
using namespace std;
#endif
class AudioJS: public AudioInterface{
public:
......@@ -28,6 +30,7 @@ public:
int getDuration();
bool hasFailed();
void changeVolume(float volume);
bool isPlaying();
private:
int duration;
......
......@@ -7,6 +7,326 @@
#include "ColorConverter.h"
char ColorConverter::colors[256][4] = {{255, 255, 255, 255}, // white
{255, 255, 255, 192},
{255, 255, 255, 128},
{255, 255, 255, 64},
{64, 64, 64, 255},
// darkGray
{64, 64, 64, 192},
{64, 64, 64, 128},
{64, 64, 64, 64},
{128, 128, 128, 255},
// gray
{128, 128, 128, 192},
{128, 128, 128, 128},
{128, 128, 128, 64},
{192, 192, 192, 255},
// lightGray
{192, 192, 192, 192},
{192, 192, 192, 128},
{192, 192, 192, 64},
{0, 0, 0, 255},
// black
{0, 0, 0, 192},
{0, 0, 0, 128},
{0, 0, 0, 64},
{255, 200, 0, 255},
// orange
{255, 200, 0, 192},
{255, 200, 0, 128},
{255, 200, 0, 64},
{255, 175, 175, 255},
// pink
{255, 175, 175, 192},
{255, 175, 175, 128},
{255, 175, 175, 64},
{0, 0, 255, 255},
// blue
{0, 0, 255, 192},
{0, 0, 255, 128},
{0, 0, 255, 64},
{255, 0, 0, 255},
// red
{255, 0, 0, 192},
{255, 0, 0, 128},
{255, 0, 0, 64},
{0, 255, 0, 255},
// green
{0, 255, 0, 192},
{0, 255, 0, 128},
{0, 255, 0, 64},
{255, 0, 255, 255},
// magenta
{255, 0, 255, 192},
{255, 0, 255, 128},
{255, 0, 255, 64},
{255, 255, 0, 255},
// yellow
{255, 255, 0, 192},
{255, 255, 0, 128},
{255, 255, 0, 64},
{0, 255, 255, 255},
// cyan
{0, 255, 255, 192},
{0, 255, 255, 128},
{0, 255, 255, 64},
{0, 0, 153, 255},
// dark blue
{0, 0, 153, 192},
{0, 0, 153, 128},
{0, 0, 153, 64},
{102, 102, 255, 255},
// light blue
{102, 102, 255, 192},
{102, 102, 255, 128},
{102, 102, 255, 64},
{204, 204, 255, 255},
// very light blue
{204, 204, 255, 192},
{204, 204, 255, 128},
{204, 204, 255, 64},
{255, 102, 102, 255},
// light red
{255, 102, 102, 192},
{255, 102, 102, 128},
{255, 102, 102, 64},
{255, 204, 204, 255},
// very light red
{255, 204, 204, 192},
{255, 204, 204, 128},
{255, 204, 204, 64},
{0, 102, 0, 255},
// dark green
{0, 102, 0, 192},
{0, 102, 0, 128},
{0, 102, 0, 64},
{102, 255, 102, 255},
// light green
{102, 255, 102, 192},
{102, 255, 102, 128},
{102, 255, 102, 64},
{204, 255, 204, 255},
// very light green
{204, 255, 204, 192},
{204, 255, 204, 128},
{204, 255, 204, 64},
{102, 0, 102, 255},
// dark rose
{102, 0, 102, 192},
{102, 0, 102, 128},
{102, 0, 102, 64},
{255, 0, 255, 255},
// rose
{255, 0, 255, 192},
{255, 0, 255, 128},
{255, 0, 255, 64},
{255, 102, 255, 255},
// light rose
{255, 102, 255, 192},
{255, 102, 255, 128},
{255, 102, 255, 64},
{255, 204, 255, 255},
// very light rose
{255, 204, 255, 192},
{255, 204, 255, 128},
{255, 204, 255, 64},
{102, 102, 0, 255},
// dark yellow
{102, 102, 0, 192},
{102, 102, 0, 128},
{102, 102, 0, 64},
{255, 255, 102, 255},
// light yellow
{255, 255, 102, 192},
{255, 255, 102, 128},
{255, 255, 102, 64},
{255, 255, 204, 255},
// very light yellow
{255, 255, 204, 192},
{255, 255, 204, 128},
{255, 255, 204, 64},
{0, 0, 102, 255},
// dark turquoise
{0, 0, 102, 192},
{0, 0, 102, 128},
{0, 0, 102, 64},
{102, 255, 255, 255},
// light turquoise
{102, 255, 255, 192},
{102, 255, 255, 128},
{102, 255, 255, 64},
{204, 255, 255, 255},
// very light turquoise
{204, 255, 255, 192},
{204, 255, 255, 128},
{204, 255, 255, 64},
{153, 0, 255, 255},
// violet
{153, 0, 255, 192},
{153, 0, 255, 128},
{153, 0, 255, 64},
{102, 0, 153, 255},
// dark violet
{102, 0, 153, 192},
{102, 0, 153, 128},
{102, 0, 153, 64},
{153, 102, 255, 255},
// blueish light violet
{153, 102, 255, 192},
{153, 102, 255, 128},
{153, 102, 255, 64},
{204, 102, 255, 255},
// redish light violet
{204, 102, 255, 192},
{204, 102, 255, 128},
{204, 102, 255, 64},
{204, 102, 0, 255},
// light brown
{204, 102, 0, 192},
{204, 102, 0, 128},
{204, 102, 0, 64},
{255, 102, 51, 255},
// dark orange
{255, 102, 51, 192},
{255, 102, 51, 128},
{255, 102, 51, 64},
{255, 204, 153, 255},
// light orange
{255, 204, 153, 192},
{255, 204, 153, 128},
{255, 204, 153, 64},
{255, 215, 0, 255},
// gold
{255, 215, 0, 192},
{255, 215, 0, 128},
{255, 215, 0, 64},
{240, 230, 140, 255},
// khaki
{240, 230, 140, 192},
{240, 230, 140, 128},
{240, 230, 140, 64},
{218, 165, 32, 255},
// goldenrod
{218, 165, 32, 192},
{218, 165, 32, 128},
{218, 165, 32, 64},
{245, 245, 220, 255},
// beige
{245, 245, 220, 192},
{245, 245, 220, 128},
{245, 245, 220, 64},
{255, 228, 181, 255},
// moccasin
{255, 228, 181, 192},
{255, 228, 181, 128},
{255, 228, 181, 64},
{255, 99, 71, 255},
// tomato
{255, 99, 71, 192},
{255, 99, 71, 128},
{255, 99, 71, 64},
{255, 140, 0, 255},
// darkorange
{255, 140, 0, 192},
{255, 140, 0, 128},
{255, 140, 0, 64},
{220, 20, 60, 255},
// crimson
{220, 20, 60, 192},
{220, 20, 60, 128},
{220, 20, 60, 64},
{70, 130, 180, 255},
// steelblue
{70, 130, 180, 192},
{70, 130, 180, 128},
{70, 130, 180, 64},
{65, 105, 225, 255},
// royalblue
{65, 105, 225, 192},
{65, 105, 225, 128},
{65, 105, 225, 64},
{123, 104, 238, 255},
// medslateblue
{123, 104, 238, 192},
{123, 104, 238, 128},
{123, 104, 238, 64},
{127, 255, 212, 255},
// aquamarine
{127, 255, 212, 192},
{127, 255, 212, 128},
{127, 255, 212, 64},
{0, 255, 127, 255},
// springgreen
{0, 255, 127, 192},
{0, 255, 127, 128},
{0, 255, 127, 64},
{150, 205, 50, 255},
// yellowgreen
{150, 205, 50, 192},
{150, 205, 50, 128},
{150, 205, 50, 64},
{216, 191, 216, 255},
// thistle
{216, 191, 216, 192},
{216, 191, 216, 128},
{216, 191, 216, 64},
{245, 222, 179, 255},
// wheat
{245, 222, 179, 192},
{245, 222, 179, 128},
{245, 222, 179, 64},
{160, 82, 45, 255},
// siena
{160, 82, 45, 192},
{160, 82, 45, 128},
{160, 82, 45, 64},
{233, 150, 122, 255},
// darksalmon
{233, 150, 122, 192},
{233, 150, 122, 128},
{233, 150, 122, 64},
{165, 42, 42, 255},
// brown
{165, 42, 42, 192},
{165, 42, 42, 128},
{165, 42, 42, 64},
{210, 105, 30, 255},
// chocolate
{210, 105, 30, 192},
{210, 105, 30, 128},
{210, 105, 30, 64},
{244, 164, 96, 255},
// sandybrown
{244, 164, 96, 192},
{244, 164, 96, 128},
{244, 164, 96, 64},
{255, 20, 147, 255},
// deeppink
{255, 20, 147, 192},
{255, 20, 147, 128},
{255, 20, 147, 64},
{255, 105, 180, 255},
// hotpink
{255, 105, 180, 192},
{255, 105, 180, 128},
{255, 105, 180, 64},
{221, 160, 221, 255},
// plum
{221, 160, 221, 192},
{221, 160, 221, 128},
{221, 160, 221, 64},
{186, 85, 211, 255},
// medorchid
{186, 85, 211, 192},
{186, 85, 211, 128},
{186, 85, 211, 64},
{112, 128, 144, 255},
// slategray
{112, 128, 144, 192},
{112, 128, 144, 128},
{112, 128, 144, 64}};
ColorConverter::ColorConverter() {
}
......@@ -51,11 +371,19 @@ int ColorConverter::decodeColor8(int num){
return color;
}
void ColorConverter::getAnnotationColor(int colorValue, char* red, char* green, char* blue, char* alpha){
unsigned int ColorConverter::getAnnotationColor(int colorValue, SDL_PixelFormat* format){
*red = colors[colorValue][0];
*green = colors[colorValue][1];
*blue = colors[colorValue][2];
*alpha = colors[colorValue][3];
unsigned int a,r,g,b;
r = colors[colorValue][0];
g = colors[colorValue][1];
b = colors[colorValue][2];
a = colors[colorValue][3];
return SDL_MapRGBA(format,r,g,b,a);
#ifdef EMSCRIPTEN
printf("%d,%d,%d,%d\n",r,g,b,a);
return (b<<24)|(g<<16)|(r<<8)|a;
#else
return (a<<24)|(r<<16)|(g<<8)|b;
#endif
}
......@@ -15,331 +15,27 @@
class ColorConverter {
public:
ColorConverter();
void getAnnotationColor(int colorValue, char* redRef, char* greenRef, char* blueRef, char* alphaRef);
static unsigned int getAnnotationColor(int colorValue, SDL_PixelFormat* format);
int decodeColor(unsigned char* bytes, int byteNum, SDL_PixelFormat* format);
int decodeColor8(int num);
private:
char colors[256][4]/* = {{255, 255, 255, 255}, // white
{255, 255, 255, 192},
{255, 255, 255, 128},
{255, 255, 255, 64},
{64, 64, 64, 255},
// darkGray
{64, 64, 64, 192},
{64, 64, 64, 128},
{64, 64, 64, 64},
{128, 128, 128, 255},
// gray
{128, 128, 128, 192},
{128, 128, 128, 128},
{128, 128, 128, 64},
{192, 192, 192, 255},
// lightGray
{192, 192, 192, 192},
{192, 192, 192, 128},
{192, 192, 192, 64},
{0, 0, 0, 255},
// black
{0, 0, 0, 192},
{0, 0, 0, 128},
{0, 0, 0, 64},
{255, 200, 0, 255},
// orange
{255, 200, 0, 192},
{255, 200, 0, 128},
{255, 200, 0, 64},
{255, 175, 175, 255},
// pink
{255, 175, 175, 192},
{255, 175, 175, 128},
{255, 175, 175, 64},
{0, 0, 255, 255},
// blue
{0, 0, 255, 192},
{0, 0, 255, 128},
{0, 0, 255, 64},
{255, 0, 0, 255},
// red
{255, 0, 0, 192},
{255, 0, 0, 128},
{255, 0, 0, 64},
{0, 255, 0, 255},
// green
{0, 255, 0, 192},
{0, 255, 0, 128},
{0, 255, 0, 64},
{255, 0, 255, 255},
// magenta
{255, 0, 255, 192},
{255, 0, 255, 128},
{255, 0, 255, 64},
{255, 255, 0, 255},
// yellow
{255, 255, 0, 192},
{255, 255, 0, 128},
{255, 255, 0, 64},
{0, 255, 255, 255},
// cyan
{0, 255, 255, 192},
{0, 255, 255, 128},
{0, 255, 255, 64},
{0, 0, 153, 255},
// dark blue
{0, 0, 153, 192},
{0, 0, 153, 128},
{0, 0, 153, 64},
{102, 102, 255, 255},
// light blue
{102, 102, 255, 192},
{102, 102, 255, 128},
{102, 102, 255, 64},
{204, 204, 255, 255},
// very light blue
{204, 204, 255, 192},
{204, 204, 255, 128},
{204, 204, 255, 64},
{255, 102, 102, 255},
// light red
{255, 102, 102, 192},
{255, 102, 102, 128},
{255, 102, 102, 64},
{255, 204, 204, 255},
// very light red
{255, 204, 204, 192},
{255, 204, 204, 128},
{255, 204, 204, 64},
{0, 102, 0, 255},
// dark green
{0, 102, 0, 192},
{0, 102, 0, 128},
{0, 102, 0, 64},
{102, 255, 102, 255},
// light green
{102, 255, 102, 192},
{102, 255, 102, 128},
{102, 255, 102, 64},
{204, 255, 204, 255},
// very light green
{204, 255, 204, 192},
{204, 255, 204, 128},
{204, 255, 204, 64},
{102, 0, 102, 255},
// dark rose
{102, 0, 102, 192},
{102, 0, 102, 128},
{102, 0, 102, 64},
{255, 0, 255, 255},
// rose
{255, 0, 255, 192},
{255, 0, 255, 128},
{255, 0, 255, 64},
{255, 102, 255, 255},
// light rose
{255, 102, 255, 192},
{255, 102, 255, 128},
{255, 102, 255, 64},
{255, 204, 255, 255},
// very light rose
{255, 204, 255, 192},
{255, 204, 255, 128},
{255, 204, 255, 64},
{102, 102, 0, 255},
// dark yellow
{102, 102, 0, 192},
{102, 102, 0, 128},
{102, 102, 0, 64},
{255, 255, 102, 255},
// light yellow
{255, 255, 102, 192},
{255, 255, 102, 128},
{255, 255, 102, 64},
{255, 255, 204, 255},
// very light yellow
{255, 255, 204, 192},
{255, 255, 204, 128},
{255, 255, 204, 64},
{0, 0, 102, 255},
// dark turquoise
{0, 0, 102, 192},
{0, 0, 102, 128},
{0, 0, 102, 64},
{102, 255, 255, 255},
// light turquoise
{102, 255, 255, 192},
{102, 255, 255, 128},
{102, 255, 255, 64},
{204, 255, 255, 255},
// very light turquoise
{204, 255, 255, 192},
{204, 255, 255, 128},
{204, 255, 255, 64},
{153, 0, 255, 255},
// violet
{153, 0, 255, 192},
{153, 0, 255, 128},
{153, 0, 255, 64},
{102, 0, 153, 255},
// dark violet
{102, 0, 153, 192},
{102, 0, 153, 128},
{102, 0, 153, 64},
{153, 102, 255, 255},
// blueish light violet
{153, 102, 255, 192},
{153, 102, 255, 128},
{153, 102, 255, 64},
{204, 102, 255, 255},
// redish light violet
{204, 102, 255, 192},
{204, 102, 255, 128},
{204, 102, 255, 64},
{204, 102, 0, 255},
// light brown
{204, 102, 0, 192},
{204, 102, 0, 128},
{204, 102, 0, 64},
{255, 102, 51, 255},
// dark orange
{255, 102, 51, 192},
{255, 102, 51, 128},
{255, 102, 51, 64},
{255, 204, 153, 255},
// light orange
{255, 204, 153, 192},
{255, 204, 153, 128},
{255, 204, 153, 64},
{255, 215, 0, 255},
// gold
{255, 215, 0, 192},
{255, 215, 0, 128},
{255, 215, 0, 64},
{240, 230, 140, 255},
// khaki
{240, 230, 140, 192},
{240, 230, 140, 128},
{240, 230, 140, 64},
{218, 165, 32, 255},
// goldenrod
{218, 165, 32, 192},
{218, 165, 32, 128},
{218, 165, 32, 64},
{245, 245, 220, 255},
// beige
{245, 245, 220, 192},
{245, 245, 220, 128},
{245, 245, 220, 64},
{255, 228, 181, 255},
// moccasin
{255, 228, 181, 192},
{255, 228, 181, 128},
{255, 228, 181, 64},
{255, 99, 71, 255},
// tomato
{255, 99, 71, 192},
{255, 99, 71, 128},
{255, 99, 71, 64},
{255, 140, 0, 255},
// darkorange
{255, 140, 0, 192},
{255, 140, 0, 128},
{255, 140, 0, 64},
{220, 20, 60, 255},
// crimson
{220, 20, 60, 192},
{220, 20, 60, 128},
{220, 20, 60, 64},
{70, 130, 180, 255},
// steelblue
{70, 130, 180, 192},
{70, 130, 180, 128},
{70, 130, 180, 64},
{65, 105, 225, 255},
// royalblue
{65, 105, 225, 192},
{65, 105, 225, 128},
{65, 105, 225, 64},
{123, 104, 238, 255},
// medslateblue
{123, 104, 238, 192},
{123, 104, 238, 128},
{123, 104, 238, 64},
{127, 255, 212, 255},
// aquamarine
{127, 255, 212, 192},
{127, 255, 212, 128},
{127, 255, 212, 64},
{0, 255, 127, 255},
// springgreen
{0, 255, 127, 192},
{0, 255, 127, 128},
{0, 255, 127, 64},
{150, 205, 50, 255},
// yellowgreen
{150, 205, 50, 192},