1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
|
//main.cpp
#include "SDL/SDL.h"
#include "SDL/SDL_image.h"
#include "globals.h"
#include "image.h"
#include "timer.h"
#include "tile.h"
#include <string>
using namespace std;
int screenW = 800;
int screenH = 600;
int main (int argc, char* args[]) {
SDL_Init(SDL_INIT_EVERYTHING);
bool quit = false;
Timer timer (FPS);
Window mainWindow (screenW, screenH, false);
//Tile terrain ("terrain.png", 301, 118, 300, 200, 301, 118, 300, 200);
Tile map [2] = {Tile ("terrain.png", 301, 118, 300, 200, 301, 118, 300, 200),
Tile ("terrain.png", 301, 118, 300, 400, 301, 118, 300, 200)};
Creature mobList [1] = {Creature ("yeti.png", 149, 194, 0, 0, 10)};
Player player ("player.png", 93, 150, 200, 200, 93, 150, 200, 200);
SDL_Event event;
while (!quit) {
timer.start();
while (SDL_PollEvent(&event)) {
if (event.type == SDL_QUIT) {
quit = true;
}
}
player.input();
mainWindow.fill(130, 150, 150);
player.blit(mainWindow.get_screen());
for (int i=0; i<1; i++) {
mobList[i].blit(mainWindow.get_screen());
}
for (int i=0; i<2; i++) {
//***This here works, however***
map[i].blit(mainWindow.get_screen());
}
mainWindow.update();
timer.pause();
};
return 0;
}
|