more robust failure logic

git-svn-id: svn://anubis/gvsu@318 45c1a28c-8058-47b2-ae61-ca45b979098e
This commit is contained in:
josh 2008-12-06 20:23:33 +00:00
parent 226c88774d
commit de91797a58

View File

@ -32,32 +32,32 @@ int main(int argc, char * argv[])
if (my_rank == 0)
{
bool window_success = createWindow(width, height, &screen, &pixels);
if (!window_success)
return -1;
for (int y = 0; y < height; y++)
if (window_success)
{
for (int x = 0; x < width; x++)
for (int y = 0; y < height; y++)
{
*pixels++ = (((x * 255 / width) & 0xFF) << 8)
+ ((y * 255 / height) & 0xFF);
for (int x = 0; x < width; x++)
{
*pixels++ = (((x * 255 / width) & 0xFF) << 8)
+ ((y * 255 / height) & 0xFF);
}
}
}
SDL_UpdateRect(screen, 0, 0, 0, 0);
SDL_UpdateRect(screen, 0, 0, 0, 0);
bool going = true;
SDL_Event event;
while (going && SDL_WaitEvent(&event) != 0)
{
switch (event.type)
bool going = true;
SDL_Event event;
while (going && SDL_WaitEvent(&event) != 0)
{
case SDL_QUIT:
going = false;
break;
case SDL_KEYDOWN:
if (event.key.keysym.sym == SDLK_q)
switch (event.type)
{
case SDL_QUIT:
going = false;
break;
break;
case SDL_KEYDOWN:
if (event.key.keysym.sym == SDLK_q)
going = false;
break;
}
}
}
}