Code: Select all
sudo yum install SDL SDL-devel SDL_image SDL_image-devel SDL_mixer SDL_mixer-devel
main.cpp
Code: Select all
#include "SDL/SDL.h"
using namespace std;
int main(int argc, char* args[])
{
SDL_Surface* hello = NULL;
SDL_Surface* screen = NULL;
SDL_Init( SDL_INIT_EVERYTHING );
screen = SDL_SetVideoMode( 800, 600, 32, SDL_SWSURFACE );
hello = SDL_LoadBMP( "hello.bmp" );
while(1)
{
SDL_BlitSurface( hello, NULL, screen, NULL );
SDL_Flip( screen );
SDL_Delay( 2000 );
}
SDL_FreeSurface( hello );
SDL_Quit();
return 0;
}
Code: Select all
IDIR=include
CC=g++
CFLAGS=-I$(IDIR)
ODIR=src/obj
LDIR=lib
LIBS=-lm -lSDL
_DEPS =
DEPS = $(patsubst %,$(IDIR)/%,$(_DEPS))
_OBJ = main.o
OBJ = $(patsubst %,$(ODIR)/%,$(_OBJ))
$(ODIR)/%.o: %.cpp $(DEPS)
$(CC) -c -o $@ $< $(CFLAGS)
.PHONY: main
main: $(OBJ)
g++ -o $@ $^ $(CFLAGS) $(LIBS)
.PHONY: clean
clean:
rm -f $(ODIR)/*.o *~ core $(INCDIR)/*~