remove some warnings
authorThomas Pietrzak <thomas.pietrzak@gmail.com>
Wed, 1 Jun 2011 15:16:37 +0000 (15:16 +0000)
committerThomas Pietrzak <thomas.pietrzak@gmail.com>
Wed, 1 Jun 2011 15:16:37 +0000 (15:16 +0000)
git-svn-id: svn+ssh://thomaspietrzak.com/var/svn/rep@20 47cf9a05-e0a8-4ed5-9e9b-101a649bc004

Haptic Metronome/Haptic Metronome.suo
Haptic Metronome/Haptic Metronome/Haptic Metronome.vcxproj
Haptic Metronome/Haptic Metronome/Haptic Metronome.vcxproj.filters
src/Mixer.cpp
src/PaintGame.cpp
src/Serial.cpp
src/Track.cpp
src/main.cpp

index 6db2e2cbbb797790d03d3691cb61c6e9c8307b08..6080ca3c055c7efe7d3269a9482a23664743a295 100644 (file)
Binary files a/Haptic Metronome/Haptic Metronome.suo and b/Haptic Metronome/Haptic Metronome.suo differ
index dfe52a4e573ef296d1ca31b80205daa4650b7f53..1ec5140a4bfeff3a52bbbb9d78bebf08d56fea5d 100644 (file)
   </PropertyGroup>\r
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">\r
     <ClCompile>\r
-      <WarningLevel>Level3</WarningLevel>\r
+      <WarningLevel>Level4</WarningLevel>\r
       <Optimization>Disabled</Optimization>\r
       <PreprocessorDefinitions>_MBCS;%(PreprocessorDefinitions);WIN32;FULLSCREEN</PreprocessorDefinitions>\r
+      <DisableSpecificWarnings>4996</DisableSpecificWarnings>\r
     </ClCompile>\r
     <Link>\r
       <GenerateDebugInformation>true</GenerateDebugInformation>\r
@@ -79,7 +80,6 @@
   </ItemDefinitionGroup>\r
   <ItemGroup>\r
     <ClInclude Include="..\..\include\Config.hpp" />\r
-    <ClInclude Include="..\..\include\List.hpp" />\r
     <ClInclude Include="..\..\include\Metronome.hpp" />\r
     <ClInclude Include="..\..\include\MetronomeAudio.hpp" />\r
     <ClInclude Include="..\..\include\MetronomeHaptic.hpp" />\r
index 958c602a8d12a44099c32c5ebb1e01f100f744c4..62ad99a8ccef7461484cdd3757fece8d69908510 100644 (file)
@@ -21,9 +21,6 @@
     <ClInclude Include="..\..\include\Config.hpp">\r
       <Filter>Header Files</Filter>\r
     </ClInclude>\r
-    <ClInclude Include="..\..\include\List.hpp">\r
-      <Filter>Header Files</Filter>\r
-    </ClInclude>\r
     <ClInclude Include="..\..\include\MIDIReader.hpp">\r
       <Filter>Header Files</Filter>\r
     </ClInclude>\r
index 538095b4dcbd4e2b6f6bc18e2662f1a89c13d7bb..7c6e562264d6cfb4897bdbd444e7406d1228652f 100644 (file)
@@ -134,7 +134,7 @@ bool Mixer::addSound(const String &s, const String &filename)
        {
                snd = _sounds[s];
        }
-       catch(ExceptionNodeDontExist &e)
+       catch(ExceptionNodeDontExist &)
        {
                _sounds.addNode(s, new Sound);
                snd = _sounds[s];
@@ -153,7 +153,7 @@ void Mixer::playSound(const String &s)
        {
                snd = _sounds[s];
        }
-       catch(ExceptionNodeDontExist &e)
+       catch(ExceptionNodeDontExist &)
        {
                _sounds.addNode(s, new Sound(s));
                snd = _sounds[s];
index e2b3b27b5b982955e52292b3499756534ea26059..c94205b8b6308a3d34be9dd9bc5dc2b39d65517e 100644 (file)
@@ -22,8 +22,8 @@ Uint32 start;
 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;
@@ -81,7 +81,6 @@ void init()
                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;
@@ -89,12 +88,6 @@ void init()
                                //break;
                        }
                }
-/*             if (!modes[i])
-               {
-                       cout << "Resolution wanted not available" << endl;
-                       resolution_x = 1024;
-                       resolution_y = 768;
-               }*/
        }
   
 #if 0//SDL_VERSION_ATLEAST(1,3,0)
@@ -153,11 +146,8 @@ void init()
   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;
 
@@ -212,17 +202,7 @@ void initPaint()
 
 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;
 
@@ -257,7 +237,7 @@ void draw(const Track &t, char diff)
        //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;
@@ -281,7 +261,7 @@ void draw(const Track &t, char diff)
 
        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++)
        {
@@ -333,7 +313,7 @@ void draw(const Track &t, char diff)
 
        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);
@@ -406,7 +386,7 @@ void drawCube(float pos, float size, float colorx, float colory, float colorz)
 
 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);
@@ -480,7 +460,7 @@ void handleKeyOff(keys k, Uint32 currenttime)
                return;
        fromKeyboard.setEndTimestamp(currenttime);
        cout << fromKeyboard << endl;
-       fromKeyboard.log("Play", logfile);
+       fromKeyboard.log("Pull", logfile);
 
        fromKeyboard.setTimestamp(currenttime);
        fromKeyboard.setEndTimestamp(-1);
@@ -523,20 +503,9 @@ void handleStrokeOff(Uint32 currenttime)
 
 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))
        {
@@ -582,21 +551,6 @@ bool processEvents()
                                                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;
index 78983249392dcee86e5fbe0d009b0bd1ef02be13..e5272633656fd8c315391d3f53102cc249cca389 100644 (file)
@@ -1,6 +1,6 @@
 #include "Serial.hpp"\r
 \r
-Serial::Serial(char *portName)\r
+Serial::Serial(char *)\r
 :_connected(false)\r
 {\r
 }\r
index b5295a0301a23f09efec05402e79c6bdd33507de..044ff1d16096d8c0f5007312da3e6974612f70d5 100644 (file)
@@ -13,7 +13,7 @@ using namespace std;
 
 extern Texture* texturesteel, *texturefrett;
 extern FILE *logfile;
-extern float SECONDSIZE;
+extern double SECONDSIZE;
 extern GLfloat VIEWLENGTH;
 
 Track::Track()
@@ -74,8 +74,11 @@ Track::Track(Uint8 nbbuttons, Uint8 repetitions, Uint8 nbspeeds, Uint32 *speeds)
                addTempo(tick, timestamp, tempo);
                vector<Uint8> configs;
 
+               //SECURITY
+               if (nbbuttons > 8)
+                       nbbuttons = 8;
                //creates a block with repetitions of all the patterns (excluding the empty pattern)
-               for (int i = 1 ; i < (int)pow(2.0, (double)nbbuttons) ; i++)
+               for (Uint8 i = 1 ; i < (int)pow(2.0, (double)nbbuttons) ; i++)
                        for (int j = 0 ; j < repetitions ; j++)
                                configs.push_back(i);
 
index 44dd25cf2d81885b53ac1ced84e76fb8c866a21c..a72c74e6ede71afde35b4d681fd6425a0737ad33 100644 (file)
@@ -31,7 +31,7 @@ GameType gametype;
 #include <SDL/SDL_mixer.h>
 #endif*/
 
-float SECONDSIZE = 0.050f;
+double SECONDSIZE = 0.050f;
 FILE *logfile = NULL;
 
 void handleStrokeOff()