-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsnake.h
More file actions
54 lines (51 loc) · 1.6 KB
/
snake.h
File metadata and controls
54 lines (51 loc) · 1.6 KB
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
#ifndef SNAKE_H
#define SNAKE_H
#include "renderer.h"
#include "constants.h"
#include "myvector.h"
#include "SDL2-2.0.10/include/SDL_events.h"
#include "SDL2-2.0.10/include/SDL_render.h"
#include "SDL2-2.0.10/include/SDL_surface.h"
#include "SDL2-2.0.10/include/SDL_timer.h"
#include <cstddef>
#include <stdlib.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
extern "C" {
#include"./SDL2-2.0.10/include/SDL.h"
#include"./SDL2-2.0.10/include/SDL_main.h"
}
class Snake {
public:
SDL_Surface *thin_body,*thin_body_horizontal,*thick_body,*thick_body_horizontal;
SDL_Surface *head,*head_down, *head_right, *head_left;
SDL_Surface *tail,*tail_down,*tail_right,*tail_left,*eti;
SDL_Surface *top_right,*top_left,*bottom_right,*bottom_left;
int heading, length,last_power_up,waiting,animate_int;
int screen_width,screen_height;
double move_speed,posx, posy,time_since_last_move,distance,move_delay,last_speedup;
double speedup_percent, speedups_time, slowdown_percent,wait_time_choose,last_animation;
MyVector snake_parts;
Snake();
void init();
void set_window_size_and_position_snake(int width,int height);
void load_bitmaps();
void speedup_snake(int time);
void add_part();
void slowdown_snake();
void shrink_snake(int size);
void save(FILE* fptr);
int load(FILE* fptr);
void DrawSnake(SDL_Surface* screen,double delta);
void collision_check(int* quit);
int check_snake_collisions(int* quit);
int check_wall_collisions(int x,int y,int headingway);
void hit_wall();
void move_snake(double delta,int* quit);
void load_config(FILE* fptr);
void end();
};
#endif