예제 #1
0
파일: main.c 프로젝트: joaoacsoares/LCOM
int main(int argc, char **argv) {
	srand(time(NULL));
	sef_startup();

	Whack* whack = startWhack();
	vg_init(0x114);
	int done = 0; //whack->done;
	//Bitmap* board = loadBitmap("/home/lcom/lcom1415-t3g15/projeto/res/board.bmp");
	//Bitmap* bt = loadBitmap("/home/lcom/lcom1415-t3g15/projeto/res/exit-button.bmp");
	//drawBitmapWithoutBg(board, 0, 0, ALIGN_LEFT);
	//drawBitmapWithoutBg(bt, 200, 120, ALIGN_LEFT);

	//MainMenu* teste = createMainMenu();
	//drawMainMenu(teste);

	//deleteMainMenu(teste);

	/*Game* teste = createGame();
	//OptionsMenu* teste = createOptionsMenu(0, 0);
		drawGame(teste);
	flipMouse();
					drawMouse();
					flipDisplay();

		sleep(10);

	deleteGame(teste);*/

	while (!whack->done) {
		updateWhack(whack);
		if (get_counter(whack->timer) % 4 == 0){
			if (!whack->done && whack->draw) {
				drawWhack(whack);
			}

			if (getMouse()->draw) {
				flipMouse();
				drawMouse();
				flipDisplay();
			}
		}
	}
	stopWhack(whack);


	vg_exit();



	printf("\nTerminated\n");

	return 0;
}
예제 #2
0
파일: main.c 프로젝트: obrown/Raycaster
int main(int argc, char* args[])
{
    initDisplay();
    
    struct Player player = {128, 128, (PI / 180) * 60};
    struct Input input = {false, false, false, false, false};
    

    while (!input.exit) {
        pollInput(&input);

        if (input.forward) {
            player.x += cos(player.a) * MOVE_SPEED;
            player.y -= sin(player.a) * MOVE_SPEED; 
        }
        if (input.left) {
            player.a -= TURN_SPEED;
            wrap(&player.a);
        }
        if (input.back) {
            player.x -= cos(player.a) * MOVE_SPEED;
            player.y += sin(player.a) * MOVE_SPEED; 
        }
        if (input.right) {
            player.a += TURN_SPEED;
            wrap(&player.a);
        }

        clearDisplay(); 
        drawWalls(&player);
        flipDisplay();
    }

    closeDisplay(); 

    return 0;
}