forked from jaildesigner-jailgames/coffee_crisis
code reorganized
This commit is contained in:
57
source/utils.h
Normal file
57
source/utils.h
Normal file
@@ -0,0 +1,57 @@
|
||||
#pragma once
|
||||
#include "ifdefs.h"
|
||||
|
||||
#ifndef UTILS_H
|
||||
#define UTILS_H
|
||||
|
||||
// Estructura para definir un circulo
|
||||
struct Circle
|
||||
{
|
||||
Uint16 x;
|
||||
Uint16 y;
|
||||
Uint8 r;
|
||||
};
|
||||
|
||||
// Estructura para definir todas las entradas que aceptará el programa
|
||||
struct Input
|
||||
{
|
||||
Uint8 up;
|
||||
Uint8 down;
|
||||
Uint8 left;
|
||||
Uint8 right;
|
||||
Uint8 escape;
|
||||
Uint8 pause;
|
||||
Uint8 fire;
|
||||
Uint8 fireLeft;
|
||||
Uint8 fireRight;
|
||||
Uint8 accept;
|
||||
Uint8 cancel;
|
||||
};
|
||||
|
||||
// Estructura para mapear el teclado usado en la demo
|
||||
struct DemoKeys
|
||||
{
|
||||
Uint8 left;
|
||||
Uint8 right;
|
||||
Uint8 noInput;
|
||||
Uint8 fire;
|
||||
Uint8 fireLeft;
|
||||
Uint8 fireRight;
|
||||
};
|
||||
|
||||
// Calcula el cuadrado de la distancia entre dos puntos
|
||||
double distanceSquared(int x1, int y1, int x2, int y2);
|
||||
|
||||
// Detector de colisiones entre dos circulos
|
||||
bool checkCollision(Circle &a, Circle &b);
|
||||
|
||||
// Detector de colisiones entre un circulo y un rectangulo
|
||||
bool checkCollision(Circle &a, SDL_Rect &b);
|
||||
|
||||
// Detector de colisiones entre un dos rectangulos
|
||||
bool checkCollision(SDL_Rect a, SDL_Rect b);
|
||||
|
||||
// Inicializa el vector con los valores del seno
|
||||
void initSin();
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user