using namespace std;
GLfloat VIEWLENGTH = 250.f;
-extern float SECONDSIZE;
-float posz = 0;
+extern double SECONDSIZE;
+double posz = 0;
Texture *texturebois, *texturefond, *texturesteel, *texturefrett;
int resolution_x, resolution_y;
for (i=0 ; modes[i] ; i++)
{
SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "Resolution available: %d x %d\n", modes[i]->w, modes[i]->h);
- //if (modes[i]->w== 1600 && modes[i]->h == 900) //> resolution_x)//
if (modes[i]->w * modes[i]->h > resolution_x * resolution_x)
{
resolution_x = modes[i]->w;
//break;
}
}
-/* if (!modes[i])
- {
- cout << "Resolution wanted not available" << endl;
- resolution_x = 1024;
- resolution_y = 768;
- }*/
}
#if 0//SDL_VERSION_ATLEAST(1,3,0)
resolution_y = 768;
#endif
SDL_Surface * screen;
-// if (!(screen = SDL_SetVideoMode(resolution_x, resolution_y, 0, flags)))
if (!(screen = SDL_SetVideoMode(resolution_x, resolution_y, 0, flags)))
throw "Impossible to change the video mode";
-// resolution_x = 1600;
-// resolution_y = 900;
GLdouble ratio = (GLdouble) screen->w / screen->h;
void draw(const Track &t, char diff)
{
-/*#ifdef WIN32
- struct { int tv_sec, tv_usec; } now;
- DWORD tim = timeGetTime ();
- now.tv_sec = tim / 1000;
- now.tv_usec = (tim % 1000) * 1000;
-#else
- struct timeval now;
- gettimeofday(&now, NULL);
-#endif*/
Uint32 currenttime = SDL_GetTicks() - start;
- //(now.tv_sec - start.tv_sec) * 1000 + (now.tv_usec - start.tv_usec) / 1000;
posz = -SECONDSIZE * currenttime;
//cout << "posz=" << posz << endl;
gluLookAt(0, POSITION_HEIGHT, posz + POSITION_EYE, 0, 0, posz + POSITION_CENTER, 0.0f, 1.0f, 0.0f);
// gluLookAt(posx-50, posy, posz-POSITION, 0, 0,posz-POSITION, 0.0,1.0,0.0);
- GLfloat light_position[] = { 0.0, 10.0f , posz, 1.0f };
+ GLfloat light_position[] = { 0.0f, 10.0f , float(posz), 1.0f };
glLightfv(GL_LIGHT1, GL_POSITION, light_position);
// cout << "End: " << t.getEndOfTrack() << endl;
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
- glTranslatef(0, 0, posz);
+ glTranslatef(0.f, 0.f, float(posz));
//draw the strings
for (int i = 0 ; i < 5 ; i++)
{
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
- glTranslatef(0, 0, posz);
+ glTranslatef(0.f, 0.f, float(posz));
//Draw the position bar
glBegin(GL_QUADS);
glColor3f(0.8f, 0.8f, 0.8f);
void drawLong(float pos, float size, float length, float colorx, float colory, float colorz)
{
- float l = length*SECONDSIZE;
+ float l = length * float(SECONDSIZE);
glEnable(GL_TEXTURE_2D);
texturesteel->useTexture();
glBegin(GL_QUADS);
return;
fromKeyboard.setEndTimestamp(currenttime);
cout << fromKeyboard << endl;
- fromKeyboard.log("Play", logfile);
+ fromKeyboard.log("Pull", logfile);
fromKeyboard.setTimestamp(currenttime);
fromKeyboard.setEndTimestamp(-1);
bool processEvents()
{
-/*#ifdef WIN32
- struct { int tv_sec, tv_usec; } now;
- DWORD tim = timeGetTime ();
- now.tv_sec = tim / 1000;
- now.tv_usec = (tim % 1000) * 1000;
-#else
- struct timeval now;
- gettimeofday(&now, NULL);
-#endif*/
Uint32 currenttime = SDL_GetTicks() - start;
- //(now.tv_sec - start.tv_sec) * 1000 + (now.tv_usec - start.tv_usec) / 1000;
SDL_Event event;
-// bool quitProgram = false;
while (SDL_PollEvent (&event))
{
Mixer::getInstance()->setMusicVolume(Mixer::getInstance()->getMusicVolume() - 10);
Mixer::getInstance()->setSoundVolume(Mixer::getInstance()->getSoundVolume() - 10);
break;
-/* case SDLK_a:
- handleKeyOn(KEY0);
- break;
- case SDLK_z:
- handleKeyOn(KEY1);
- break;
- case SDLK_e:
- handleKeyOn(KEY2);
- break;
- case SDLK_r:
- handleKeyOn(KEY3);
- break;
- case SDLK_t:
- handleKeyOn(KEY4);
- break;*/
case SDLK_SPACE:
handleStrokeOn(currenttime);
break;