-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.c
39 lines (35 loc) · 841 Bytes
/
main.c
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
#include <GL/glut.h>
#include <stdio.h>
#include <math.h>
// Includes
#include "utils/utils.h"
#include "globals.h"
#include "player/player.h"
#include "map/map.h"
#include "rays/rays.h"
void init()
{
glClearColor(0.3,0.3,0.3,0);
gluOrtho2D(0,SCREEN_WIDTH,SCREEN_HEIGHT,0);
player.direction_x = cos(degToRad(player.angle));
player.direction_y = sin(degToRad(player.angle));
}
void display()
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
DrawMap2D();
DrawPlayer2D();
DrawRays2D();
glutSwapBuffers();
}
int main(int argc, char* argv[])
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB);
glutInitWindowSize(SCREEN_WIDTH,SCREEN_HEIGHT);
glutCreateWindow(SCREEN_NAME);
init();
glutDisplayFunc(display);
glutKeyboardFunc(Buttons);
glutMainLoop();
}