more robust failure logic
git-svn-id: svn://anubis/gvsu@318 45c1a28c-8058-47b2-ae61-ca45b979098e
This commit is contained in:
parent
226c88774d
commit
de91797a58
@ -32,32 +32,32 @@ int main(int argc, char * argv[])
|
|||||||
if (my_rank == 0)
|
if (my_rank == 0)
|
||||||
{
|
{
|
||||||
bool window_success = createWindow(width, height, &screen, &pixels);
|
bool window_success = createWindow(width, height, &screen, &pixels);
|
||||||
if (!window_success)
|
if (window_success)
|
||||||
return -1;
|
|
||||||
|
|
||||||
for (int y = 0; y < height; y++)
|
|
||||||
{
|
{
|
||||||
for (int x = 0; x < width; x++)
|
for (int y = 0; y < height; y++)
|
||||||
{
|
{
|
||||||
*pixels++ = (((x * 255 / width) & 0xFF) << 8)
|
for (int x = 0; x < width; x++)
|
||||||
+ ((y * 255 / height) & 0xFF);
|
{
|
||||||
|
*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;
|
bool going = true;
|
||||||
SDL_Event event;
|
SDL_Event event;
|
||||||
while (going && SDL_WaitEvent(&event) != 0)
|
while (going && SDL_WaitEvent(&event) != 0)
|
||||||
{
|
|
||||||
switch (event.type)
|
|
||||||
{
|
{
|
||||||
case SDL_QUIT:
|
switch (event.type)
|
||||||
going = false;
|
{
|
||||||
break;
|
case SDL_QUIT:
|
||||||
case SDL_KEYDOWN:
|
|
||||||
if (event.key.keysym.sym == SDLK_q)
|
|
||||||
going = false;
|
going = false;
|
||||||
break;
|
break;
|
||||||
|
case SDL_KEYDOWN:
|
||||||
|
if (event.key.keysym.sym == SDLK_q)
|
||||||
|
going = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user