gave window a title, generated pixels differently

git-svn-id: svn://anubis/gvsu@313 45c1a28c-8058-47b2-ae61-ca45b979098e
This commit is contained in:
josh 2008-12-06 19:10:59 +00:00
parent 9700421226
commit ec3ac34994

View File

@ -9,6 +9,8 @@
#include <iostream> #include <iostream>
using namespace std; using namespace std;
#define PROGNAME "Josh's CS677 Final : MPI Fractal Generator"
int main(int argc, char * argv[]) int main(int argc, char * argv[])
{ {
int width = 800; int width = 800;
@ -30,11 +32,17 @@ int main(int argc, char * argv[])
cerr << "Failed to set video mode!" << endl; cerr << "Failed to set video mode!" << endl;
return 2; return 2;
} }
SDL_WM_SetCaption(PROGNAME, PROGNAME);
Uint32 * pixels = (Uint32 *) screen->pixels; Uint32 * pixels = (Uint32 *) screen->pixels;
Uint32 c; for (int y = 0; y < height; y++)
for (c = 0; c < width * height; c++) {
*pixels++ = c; 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; bool going = true;