-
Notifications
You must be signed in to change notification settings - Fork 4
/
main.c
executable file
·76 lines (69 loc) · 1.71 KB
/
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/*
** main.c for Bomberman in /Users/kumatetsu/projet-etna/DVC4/Bomberman/Bomberman
**
** Made by BILLAUD Jean
** Login <[email protected]>
**
** Started on Tue Jun 26 17:26:19 2018 BILLAUD Jean
** Last update Mon Jul 2 18:46:25 2018 BILLAUD Jean
*/
#include <stdlib.h>
#include <stdio.h>
#include "enum.h"
#include "sdl.h"
#include "map.h"
#include "player_info.h"
#include "client_request.h"
#include "server.h"
#include "menu.h"
#include "player.h"
int main(int argc, char *argv[])
{
t_sdl *sdl;
#ifdef _WIN32
int retWSADATA;
WSADATA WSAData;
if ((retWSADATA = WSAStartup(MAKEWORD(2, 2), &WSAData)) != 0)
{
printf("main.c : WSAStartup() failed with error %d\n", retWSADATA);
WSACleanup();
return (1);
}
if (LOBYTE(WSAData.wVersion) != 2 || HIBYTE(WSAData.wVersion) != 2)
{
/* Tell the user that we could not find a usable */
/* WinSock DLL. */
printf("Could not find a usable version of Winsock.dll\n");
WSACleanup();
return (1);
}
#endif // _WIN32
//made on purpose for windows errors on compilation
(void)argc;
(void)argv;
//init sdl
SDL_Init(SDL_INIT_VIDEO);
IMG_Init(IMG_INIT_JPG);
TTF_Init();
sdl = init_sdl();
sdl = init_window(sdl);
sdl = init_fronts(sdl);
main_menu(sdl);
SDL_DestroyTexture(sdl->menu_background);
SDL_DestroyTexture(sdl->white_back);
SDL_DestroyTexture(sdl->join_game);
SDL_DestroyTexture(sdl->create_game);
SDL_DestroyTexture(sdl->server_welcome);
SDL_DestroyRenderer(sdl->renderer);
SDL_DestroyWindow(sdl->window);
free(sdl);
TTF_Quit();
IMG_Quit();
SDL_Quit();
#ifdef _WIN32
printf("main.c : WSACleanup\n");
WSACleanup();
#endif
//FOR DEV PURPOSE ONLY
return (0);
}