Esempio n. 1
0
/* display a full-screen-sized image */
void display_image(int image) {
	char *image_ptr;
	if (image == WIN) {
		image_ptr = &win_image[0][0];
	} else if (image == SPLASH) {
		image_ptr = &splash_image[0][0];
	} else if (image == END) {
		image_ptr = &end_image[0][0];
	}
	write_to_screen(image_ptr, 0, 0, MAX_HEIGHT, MAX_WIDTH);
}
Esempio n. 2
0
/* display a tile image with the given dimension at the given position */
void display_tile(char image, int tilePosX, int tilePosY, int dim) {
	char *image_ptr;
	if (image == WALL) image_ptr = &wall_image[0][0];
	else if (image == PLAYER) image_ptr = &player_image[0][0];
	else if (image == BOX) image_ptr = &box_image[0][0];
	else if (image == BLANK) image_ptr = &blank_image[0][0];
	else if (image == TARGET) image_ptr = &target_image[0][0];
	else if (image == PLAYER_ON_TARGET) image_ptr = &player_on_target_image[0][0];
	else if (image == BOX_ON_TARGET) image_ptr = &box_on_target_image[0][0];
	int posX = tilePosX*dim, posY = tilePosY*dim;
	write_to_screen(image_ptr, posX, posY, dim, dim);
}
Esempio n. 3
0
void *ThreadProcs(void *threadid){
        int thread_id = (int)threadid;
       
        if(thread_id == 0){
                write_to_screen();
        }
       
        if(thread_id == 1){
        //        THIS THREAD WILL MAKE THE PROGRAM EXIT
                int ch;
                nodelay(stdscr, TRUE);                                //        SETUP NON BLOCKING INPUT
                while(1) {
                        if ((ch = getch()) == ERR) usleep(16666);                //        USER HASN'T RESPONDED
                        else if( ch == 'q'){                       
                                endwin();
                                exit(0);                        //        QUIT ALL THREADS
                        }
                }
        }
        if(thread_id == 2){
                write_to_log();
        }
}