about summary refs log tree commit diff stats
path: root/src/pong.h
blob: 97f44571d15fef726f2cb4ef55d051867af80ada (plain) (blame)
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
77
78
79
80
#ifndef PONG_H
#define PONG_H
#define MOUSE_LEFT_BUTTON MOUSE_BUTTON_LEFT
#include <raylib.h>
#include <SDL2/SDL.h>
#include <SDL2/SDL_audio.h>
#include <SDL2/SDL_mixer.h>
#include <SDL2/SDL_mutex.h>
#include <SDL2/SDL_thread.h>
#include <SDL2/SDL_atomic.h>
#include <stdio.h>
#include <time.h>
#include <unistd.h>
#include <time.h>
#include <setjmp.h>
#include <string.h>
#include <stdint.h>
#include <stdlib.h>
#include <gc.h>

#include "sounds.h"

#define LEFT 0
#define RIGHT 1

/* Controller Macros */
#define CONTROLLER_ACTIVATE 1
#define CONTROLLER_LEFT 2
#define CONTROLLER_RIGHT 3
#define CONTROLLER_UP 4
#define CONTROLLER_DOWN 5
#define CONTROLLER_PAUSE 6

struct Players {
	float Y;
	Rectangle HitBox;
	int Score;
	int Direction;
	Rectangle BallDetector;
	int NextTick;
};

struct Balls {
	float X;
	float Y;
	float Angle;
	float Speed;
	int Direction;
	Rectangle HitBox;
	int NextTick;
};

struct Settings {
	int SoundVolume;
	int MusicVolume;
	int Fullscreen;
};

extern struct Settings GlobalSettings;

extern int Difficulty;
extern bool GameGoing;
extern SDL_atomic_t Ticks;
extern char VersionString[256];
extern SDL_atomic_t AudioInitializing;
extern double Started;

void enemy(struct Players *Enemy, struct Balls ball);
void ball(Rectangle *Player, Rectangle *Enemy, struct Balls *Ball, int *PlayerScore, int *EnemyScore);
bool play_audio(int SoundEffect);
int title_screen();
void versus_main();
void marathon_main();
void set_screen_mode();
bool pause_screen(Camera2D *MainCamera);
int player_controls();
int player_controls_pressed();
void clear_input_buffer();

#endif