Skip to content
Permalink
Browse files

Fix bug 2034: replace printf by SDL_Log in tests; update loopwave VS …

…solution: copy missing dependency
  • Loading branch information
ferzkopp committed Aug 15, 2013
1 parent 67367be commit 65728477afc7883959afe23c7651b0fdc3e67763
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
@@ -105,7 +105,8 @@
<SubSystem>Windows</SubSystem>
</Link>
<PostBuildEvent>
<Command>copy "$(SolutionDir)\SDL\$(Platform)\$(Configuration)\SDL2.dll" "$(TargetDir)\SDL2.dll"</Command>
<Command>copy "$(SolutionDir)\SDL\$(Platform)\$(Configuration)\SDL2.dll" "$(TargetDir)\SDL2.dll"
copy "$(SolutionDir)\..\test\sample.wav" "$(TargetDir)\sample.wav"</Command>
</PostBuildEvent>
<PostBuildEvent>
<Message>Copy SDL</Message>
@@ -139,7 +140,8 @@
<SubSystem>Windows</SubSystem>
</Link>
<PostBuildEvent>
<Command>copy "$(SolutionDir)\SDL\$(Platform)\$(Configuration)\SDL2.dll" "$(TargetDir)\SDL2.dll"</Command>
<Command>copy "$(SolutionDir)\SDL\$(Platform)\$(Configuration)\SDL2.dll" "$(TargetDir)\SDL2.dll"
copy "$(SolutionDir)\..\test\sample.wav" "$(TargetDir)\sample.wav"</Command>
</PostBuildEvent>
<PostBuildEvent>
<Message>Copy SDL</Message>
@@ -174,7 +176,8 @@
<SubSystem>Windows</SubSystem>
</Link>
<PostBuildEvent>
<Command>copy "$(SolutionDir)\SDL\$(Platform)\$(Configuration)\SDL2.dll" "$(TargetDir)\SDL2.dll"</Command>
<Command>copy "$(SolutionDir)\SDL\$(Platform)\$(Configuration)\SDL2.dll" "$(TargetDir)\SDL2.dll"
copy "$(SolutionDir)\..\test\sample.wav" "$(TargetDir)\sample.wav"</Command>
</PostBuildEvent>
<PostBuildEvent>
<Message>Copy SDL</Message>
@@ -208,7 +211,8 @@
<SubSystem>Windows</SubSystem>
</Link>
<PostBuildEvent>
<Command>copy "$(SolutionDir)\SDL\$(Platform)\$(Configuration)\SDL2.dll" "$(TargetDir)\SDL2.dll"</Command>
<Command>copy "$(SolutionDir)\SDL\$(Platform)\$(Configuration)\SDL2.dll" "$(TargetDir)\SDL2.dll"
copy "$(SolutionDir)\..\test\sample.wav" "$(TargetDir)\sample.wav"</Command>
</PostBuildEvent>
<PostBuildEvent>
<Message>Copy SDL</Message>
@@ -109,7 +109,8 @@
<SubSystem>Windows</SubSystem>
</Link>
<PostBuildEvent>
<Command>copy "$(SolutionDir)\SDL\$(Platform)\$(Configuration)\SDL2.dll" "$(TargetDir)\SDL2.dll"</Command>
<Command>copy "$(SolutionDir)\SDL\$(Platform)\$(Configuration)\SDL2.dll" "$(TargetDir)\SDL2.dll"
copy "$(SolutionDir)\..\test\sample.wav" "$(TargetDir)\sample.wav"</Command>
</PostBuildEvent>
<PostBuildEvent>
<Message>Copy SDL</Message>
@@ -143,7 +144,8 @@
<SubSystem>Windows</SubSystem>
</Link>
<PostBuildEvent>
<Command>copy "$(SolutionDir)\SDL\$(Platform)\$(Configuration)\SDL2.dll" "$(TargetDir)\SDL2.dll"</Command>
<Command>copy "$(SolutionDir)\SDL\$(Platform)\$(Configuration)\SDL2.dll" "$(TargetDir)\SDL2.dll"
copy "$(SolutionDir)\..\test\sample.wav" "$(TargetDir)\sample.wav"</Command>
</PostBuildEvent>
<PostBuildEvent>
<Message>Copy SDL</Message>
@@ -178,7 +180,8 @@
<SubSystem>Windows</SubSystem>
</Link>
<PostBuildEvent>
<Command>copy "$(SolutionDir)\SDL\$(Platform)\$(Configuration)\SDL2.dll" "$(TargetDir)\SDL2.dll"</Command>
<Command>copy "$(SolutionDir)\SDL\$(Platform)\$(Configuration)\SDL2.dll" "$(TargetDir)\SDL2.dll"
copy "$(SolutionDir)\..\test\sample.wav" "$(TargetDir)\sample.wav"</Command>
</PostBuildEvent>
<PostBuildEvent>
<Message>Copy SDL</Message>
@@ -212,7 +215,8 @@
<SubSystem>Windows</SubSystem>
</Link>
<PostBuildEvent>
<Command>copy "$(SolutionDir)\SDL\$(Platform)\$(Configuration)\SDL2.dll" "$(TargetDir)\SDL2.dll"</Command>
<Command>copy "$(SolutionDir)\SDL\$(Platform)\$(Configuration)\SDL2.dll" "$(TargetDir)\SDL2.dll"
copy "$(SolutionDir)\..\test\sample.wav" "$(TargetDir)\sample.wav"</Command>
</PostBuildEvent>
<PostBuildEvent>
<Message>Copy SDL</Message>
@@ -117,13 +117,13 @@ PrintKey(SDL_Keysym * sym, SDL_bool pressed, SDL_bool repeat)
static void
PrintText(char *text)
{
unsigned char *spot, expanded[1024];
char *spot, expanded[1024];

expanded[0] = '\0';
for ( spot = text; *spot; ++spot )
{
size_t length = SDL_strlen(expanded);
SDL_snprintf(expanded + length, sizeof(expanded) - length, "\\x%.2x", *spot);
SDL_snprintf(expanded + length, sizeof(expanded) - length, "\\x%.2x", (unsigned char)*spot);
}
SDL_Log("Text (%s): \"%s%s\"\n", expanded, *text == '"' ? "\\" : "", text);
}
@@ -134,10 +134,13 @@ main(int argc, char *argv[])
SDL_Window *window;
SDL_Event event;
int done;

/* Enable standard application logging */
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);

/* Initialize SDL */
if (SDL_Init(SDL_INIT_VIDEO) < 0) {
fprintf(stderr, "Couldn't initialize SDL: %s\n", SDL_GetError());
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError());
return (1);
}

@@ -146,7 +149,7 @@ main(int argc, char *argv[])
SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
640, 480, 0);
if (!window) {
fprintf(stderr, "Couldn't create 640x480 window: %s\n",
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create 640x480 window: %s\n",
SDL_GetError());
quit(2);
}
@@ -166,7 +169,7 @@ main(int argc, char *argv[])
switch (event.type) {
case SDL_KEYDOWN:
case SDL_KEYUP:
PrintKey(&event.key.keysym, event.key.state, event.key.repeat);
PrintKey(&event.key.keysym, (event.key.state == SDL_PRESSED) ? SDL_TRUE : SDL_FALSE, (event.key.repeat) ? SDL_TRUE : SDL_FALSE);
break;
case SDL_TEXTINPUT:
PrintText(event.text.text);
@@ -80,9 +80,12 @@ main(int argc, char *argv[])
{
int i;

/* Enable standard application logging */
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);

/* Load the SDL library */
if (SDL_Init(SDL_INIT_AUDIO) < 0) {
fprintf(stderr, "Couldn't initialize SDL: %s\n", SDL_GetError());
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError());
return (1);
}

@@ -91,7 +94,7 @@ main(int argc, char *argv[])
}
/* Load the wave file into memory */
if (SDL_LoadWAV(argv[1], &wave.spec, &wave.sound, &wave.soundlen) == NULL) {
fprintf(stderr, "Couldn't load %s: %s\n", argv[1], SDL_GetError());
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't load %s: %s\n", argv[1], SDL_GetError());
quit(1);
}

@@ -109,24 +112,19 @@ main(int argc, char *argv[])
#endif /* HAVE_SIGNAL_H */

/* Show the list of available drivers */
printf("Available audio drivers: ");
SDL_Log("Available audio drivers:");
for (i = 0; i < SDL_GetNumAudioDrivers(); ++i) {
if (i == 0) {
printf("%s", SDL_GetAudioDriver(i));
} else {
printf(", %s", SDL_GetAudioDriver(i));
}
SDL_Log("%i: %s", i, SDL_GetAudioDriver(i));
}
printf("\n");

/* Initialize fillerup() variables */
if (SDL_OpenAudio(&wave.spec, NULL) < 0) {
fprintf(stderr, "Couldn't open audio: %s\n", SDL_GetError());
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't open audio: %s\n", SDL_GetError());
SDL_FreeWAV(wave.sound);
quit(2);
}

printf("Using audio driver: %s\n", SDL_GetCurrentAudioDriver());
SDL_Log("Using audio driver: %s\n", SDL_GetCurrentAudioDriver());

/* Let the audio run */
SDL_PauseAudio(0);

0 comments on commit 6572847

Please sign in to comment.