mirror of https://github.com/encounter/SDL.git
testoverlay2: Changed some C runtime calls to be SDL equivalents.
This commit is contained in:
parent
a6af0b8291
commit
f71454c0ad
|
@ -252,7 +252,7 @@ main(int argc, char **argv)
|
||||||
}
|
}
|
||||||
|
|
||||||
while (argc > 1) {
|
while (argc > 1) {
|
||||||
if (strcmp(argv[1], "-fps") == 0) {
|
if (SDL_strcmp(argv[1], "-fps") == 0) {
|
||||||
if (argv[2]) {
|
if (argv[2]) {
|
||||||
fps = SDL_atoi(argv[2]);
|
fps = SDL_atoi(argv[2]);
|
||||||
if (fps == 0) {
|
if (fps == 0) {
|
||||||
|
@ -272,11 +272,11 @@ main(int argc, char **argv)
|
||||||
"The -fps option requires an argument [from 1 to 1000], default is 12.\n");
|
"The -fps option requires an argument [from 1 to 1000], default is 12.\n");
|
||||||
quit(10);
|
quit(10);
|
||||||
}
|
}
|
||||||
} else if (strcmp(argv[1], "-nodelay") == 0) {
|
} else if (SDL_strcmp(argv[1], "-nodelay") == 0) {
|
||||||
nodelay = 1;
|
nodelay = 1;
|
||||||
argv += 1;
|
argv += 1;
|
||||||
argc -= 1;
|
argc -= 1;
|
||||||
} else if (strcmp(argv[1], "-scale") == 0) {
|
} else if (SDL_strcmp(argv[1], "-scale") == 0) {
|
||||||
if (argv[2]) {
|
if (argv[2]) {
|
||||||
scale = SDL_atoi(argv[2]);
|
scale = SDL_atoi(argv[2]);
|
||||||
if (scale == 0) {
|
if (scale == 0) {
|
||||||
|
@ -296,8 +296,8 @@ main(int argc, char **argv)
|
||||||
"The -fps option requires an argument [from 1 to 1000], default is 12.\n");
|
"The -fps option requires an argument [from 1 to 1000], default is 12.\n");
|
||||||
quit(10);
|
quit(10);
|
||||||
}
|
}
|
||||||
} else if ((strcmp(argv[1], "-help") == 0)
|
} else if ((SDL_strcmp(argv[1], "-help") == 0)
|
||||||
|| (strcmp(argv[1], "-h") == 0)) {
|
|| (SDL_strcmp(argv[1], "-h") == 0)) {
|
||||||
PrintUsage(argv[0]);
|
PrintUsage(argv[0]);
|
||||||
quit(0);
|
quit(0);
|
||||||
} else {
|
} else {
|
||||||
|
@ -307,7 +307,7 @@ main(int argc, char **argv)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
RawMooseData = (Uint8 *) malloc(MOOSEFRAME_SIZE * MOOSEFRAMES_COUNT);
|
RawMooseData = (Uint8 *) SDL_malloc(MOOSEFRAME_SIZE * MOOSEFRAMES_COUNT);
|
||||||
if (RawMooseData == NULL) {
|
if (RawMooseData == NULL) {
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Can't allocate memory for movie !\n");
|
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Can't allocate memory for movie !\n");
|
||||||
quit(1);
|
quit(1);
|
||||||
|
@ -317,7 +317,7 @@ main(int argc, char **argv)
|
||||||
handle = SDL_RWFromFile("moose.dat", "rb");
|
handle = SDL_RWFromFile("moose.dat", "rb");
|
||||||
if (handle == NULL) {
|
if (handle == NULL) {
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Can't find the file moose.dat !\n");
|
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Can't find the file moose.dat !\n");
|
||||||
free(RawMooseData);
|
SDL_free(RawMooseData);
|
||||||
quit(2);
|
quit(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -335,21 +335,21 @@ main(int argc, char **argv)
|
||||||
SDL_WINDOW_RESIZABLE);
|
SDL_WINDOW_RESIZABLE);
|
||||||
if (!window) {
|
if (!window) {
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't set create window: %s\n", SDL_GetError());
|
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't set create window: %s\n", SDL_GetError());
|
||||||
free(RawMooseData);
|
SDL_free(RawMooseData);
|
||||||
quit(4);
|
quit(4);
|
||||||
}
|
}
|
||||||
|
|
||||||
renderer = SDL_CreateRenderer(window, -1, 0);
|
renderer = SDL_CreateRenderer(window, -1, 0);
|
||||||
if (!renderer) {
|
if (!renderer) {
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't set create renderer: %s\n", SDL_GetError());
|
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't set create renderer: %s\n", SDL_GetError());
|
||||||
free(RawMooseData);
|
SDL_free(RawMooseData);
|
||||||
quit(4);
|
quit(4);
|
||||||
}
|
}
|
||||||
|
|
||||||
MooseTexture = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_YV12, SDL_TEXTUREACCESS_STREAMING, MOOSEPIC_W, MOOSEPIC_H);
|
MooseTexture = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_YV12, SDL_TEXTUREACCESS_STREAMING, MOOSEPIC_W, MOOSEPIC_H);
|
||||||
if (!MooseTexture) {
|
if (!MooseTexture) {
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't set create texture: %s\n", SDL_GetError());
|
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't set create texture: %s\n", SDL_GetError());
|
||||||
free(RawMooseData);
|
SDL_free(RawMooseData);
|
||||||
quit(5);
|
quit(5);
|
||||||
}
|
}
|
||||||
/* Uncomment this to check vertex color with a YUV texture */
|
/* Uncomment this to check vertex color with a YUV texture */
|
||||||
|
@ -373,7 +373,7 @@ main(int argc, char **argv)
|
||||||
0, 100);
|
0, 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
free(RawMooseData);
|
SDL_free(RawMooseData);
|
||||||
|
|
||||||
/* set the start frame */
|
/* set the start frame */
|
||||||
i = 0;
|
i = 0;
|
||||||
|
|
Loading…
Reference in New Issue