added Makefile mpi-fractals.cc

git-svn-id: svn://anubis/gvsu@312 45c1a28c-8058-47b2-ae61-ca45b979098e
This commit is contained in:
josh 2008-12-06 18:58:13 +00:00
parent f8231183be
commit 9700421226
2 changed files with 71 additions and 0 deletions

17
cs677/final/Makefile Normal file
View File

@ -0,0 +1,17 @@
CXX := mpiCC
CXXFLAGS := `sdl-config --cflags`
LDFLAGS := `sdl-config --libs`
TARGET := mpi-fractals
OBJS := mpi-fractals.o
all: $(TARGET)
$(TARGET): $(OBJS)
$(CXX) -o $@ $^ $(LDFLAGS)
%.o: %.cc
$(CXX) -o $@ -c $< $(CXXFLAGS)
clean:
-rm -f *.o *~ $(TARGET)

View File

@ -0,0 +1,54 @@
/*
* Josh Holtrop
* 2008-12-11
* barebones SDL program
*/
#include <SDL/SDL.h>
#include <mpi.h>
#include <iostream>
using namespace std;
int main(int argc, char * argv[])
{
int width = 800;
int height = 600;
SDL_Surface * screen;
SDL_Event event;
if (SDL_Init(SDL_INIT_VIDEO))
{
cerr << "Failed to initialize SDL!" << endl;
return 1;
}
atexit(SDL_Quit);
if (!(screen = SDL_SetVideoMode(width, height, 32, 0)))
{
cerr << "Failed to set video mode!" << endl;
return 2;
}
Uint32 * pixels = (Uint32 *) screen->pixels;
Uint32 c;
for (c = 0; c < width * height; c++)
*pixels++ = c;
SDL_UpdateRect(screen, 0, 0, 0, 0);
bool going = true;
while (going && SDL_WaitEvent(&event) != 0)
{
switch (event.type)
{
case SDL_QUIT:
going = false;
break;
case SDL_KEYDOWN:
if (event.key.keysym.sym == SDLK_q)
going = false;
break;
}
}
}