Ejemplo n.º 1
0
static int test_BMP_stress(void)
{
	return save_load(BMP, 2000, 2000);
}
Ejemplo n.º 2
0
int main() {
    // randomize
    srand(time(NULL));
    
    // make sure game resets at the beginning
    int restart = 1;
    
    // initialize values
    int x, y, endX, endY;
    int map[mapX][mapY] = {0};
    
    // display title screen
    title_screen();
    
    // wait for user to press the key
    int h; h = getch();
    
    // get console data
    struct winsize max;
    ioctl(0, TIOCGWINSZ , &max);
    
    // if key is l, load game state
    if (h==108) {
        save_load(&map,&x,&y,&endX,&endY, A_LOAD); // load previous state
        restart = 0; // make sure game won't restart
        usleep(600000); // make sure user got time to read
    }
    
    int is_running = 1;
    
    // game loop
    while (is_running) {
        // check if player got to the end
        if (x == endX && y == endY) {
            finished_screen(max.ws_col-1, max.ws_row-1);
            restart = 1; // make sure game restarts
        }
        
        // if restart is set to 1, reset all values
        if (restart == 1) {
            x = 1; y = 1;
            hardcore_mapgen(&map, &endX, &endY);
            restart = 0;
        }
        
        // draw map on screen
        draw_map(&map,max.ws_col, max.ws_row, x, y, endX, endY);
        
        h = move(&map, &x, &y);
        switch (h) {
            case G_SAVE:
                save_load(&map,&x,&y,&endX,&endY, A_SAVE);
                break;
            case G_QUIT:
                is_running = 0;
                break;
            case G_RESET:
                restart = 1;
                break;
            case G_LOAD:
                save_load(&map,&x,&y,&endX,&endY, A_LOAD);
                break;
        }
    }
    
    return 0;
}
Ejemplo n.º 3
0
static int test_BMP_Save_Load(void)
{
	return save_load(BMP, 100, 100);
}
Ejemplo n.º 4
0
static int test_JPG_stress(void)
{
	return save_load(JPG, 2000, 2000);
}
Ejemplo n.º 5
0
static int test_PNG_stress(void)
{
	return save_load(PNG, 2000, 2000);
}
Ejemplo n.º 6
0
static int test_JPG_Save_Load(void)
{
	return save_load(JPG, 100, 100);
}
Ejemplo n.º 7
0
static int test_PNG_Save_Load(void)
{
	return save_load(PNG, 100, 100);
}