Añadida la paleta de spectrum

This commit is contained in:
2022-09-05 10:15:07 +02:00
parent 73d394388b
commit 87d7bd03ff
11 changed files with 184 additions and 81 deletions

View File

@@ -28,7 +28,7 @@ Director::Director(std::string path)
options->filter = FILTER_NEAREST;
options->vSync = true;
options->screenWidth = GAMECANVAS_WIDTH * options->windowSize;
options->screenHeight = GAMECANVAS_HEIGHT * options->windowSize;
options->screenHeight = GAMECANVAS_HEIGHT * options->windowSize;
options->integerScale = true;
options->keepAspect = true;

View File

@@ -177,7 +177,7 @@ bool Input::discoverGameController()
std::cout << "SDL_GetError() = " << SDL_GetError() << std::endl;
}
//mGameController = mConnectedControllers[0];
// mGameController = mConnectedControllers[0];
SDL_GameControllerEventState(SDL_ENABLE);
}

View File

@@ -49,8 +49,8 @@ private:
};
GameControllerBindings_t mGameControllerBindings[17]; // Vector con las teclas asociadas a los inputs predefinidos
//SDL_GameController *mGameController; // Manejador para el mando
std::vector<SDL_GameController*> mConnectedControllers;
// SDL_GameController *mGameController; // Manejador para el mando
std::vector<SDL_GameController *> mConnectedControllers;
std::vector<std::string> mControllerNames;
int mNumGamepads;
std::string mDBpath; // Ruta al archivo gamecontrollerdb.txt
@@ -72,7 +72,7 @@ public:
void bindGameControllerButton(Uint8 input, SDL_GameControllerButton button);
// Comprueba si un input esta activo
bool checkInput(Uint8 input, bool repeat, int device=INPUT_USE_ANY, int index=0);
bool checkInput(Uint8 input, bool repeat, int device = INPUT_USE_ANY, int index = 0);
// Comprueba si hay algun mando conectado
bool gameControllerFound();

View File

@@ -10,7 +10,7 @@ Item::Item(item_t item)
renderer = item.renderer;
// Crea objetos
texture = new LTexture(renderer,asset->get(item.tileset));
texture = new LTexture(renderer, asset->get(item.tileset));
sprite = new Sprite(item.x, item.y, 8, 8, texture, renderer);
// Inicia variables

View File

@@ -24,7 +24,7 @@ private:
SDL_Event *eventHandler; // Manejador de eventos
std::vector<Sprite *> sprite; // Vector con los sprites de cada linea que forman el bitmap JAILGAMES
Sprite *sprite2; // Sprite para manejar la textura2
std::vector<color_t> color; // Vector con los colores para el fade
std::vector<color_t> color; // Vector con los colores para el fade
int counter; // Contador
section_t section; // Estado del bucle principal para saber si continua o se sale
int ticks; // Contador de ticks para ajustar la velocidad del programa

View File

@@ -15,7 +15,7 @@ private:
SDL_Renderer *renderer; // Renderizador donde dibujar la textura
int width; // Ancho de la imagen
int height; // Alto de la imagen
std::string path; // Ruta de la imagen de la textura
std::string path; // Ruta de la imagen de la textura
public:
// Constructor

View File

@@ -8,10 +8,10 @@
struct anchor_t
{
int left; // Parte izquierda de la pantalla de juego
int right; // Parte drecha de la pantalla de juego
int left; // Parte izquierda de la pantalla de juego
int right; // Parte drecha de la pantalla de juego
int center; // Parte central horizontal de la pantalla de juego
int top; // Parte superior de la pantalla de juego
int top; // Parte superior de la pantalla de juego
int bottom; // Parte infoerior de la pantalla de juego
int middle; // Parte central vertical de la pantalla de juego
};

View File

@@ -180,5 +180,5 @@ int Text::getCharacterWidth()
// Recarga la textura
void Text::reLoadTexture()
{
texture->reLoad();
texture->reLoad();
}

View File

@@ -143,70 +143,173 @@ bool checkCollision(SDL_Point &p, SDL_Rect &r)
// Devuelve un color_t a partir de un string
color_t stringToColor(std::string str)
{
color_t color = {0x00, 0x00, 0x00};
if (str == "black")
const std::string palette = "spectrum";
if (palette = "spectrum")
{
color = {0x00, 0x00, 0x00};
if (str == "black")
{
return {0x00, 0x00, 0x00};
}
else if (str == "light_black")
{
return {0x00, 0x00, 0x00};
}
else if (str == "blue")
{
return {0x00, 0x00, 0xFF};
}
else if (str == "light_blue")
{
return {0x00, 0x00, 0xEE};
}
else if (str == "red")
{
return {0xFF, 0x00, 0x00};
}
else if (str == "light_red")
{
return {0xEE, 0x00, 0x00};
}
else if (str == "purple")
{
return {0xFF, 0x00, 0xFF};
}
else if (str == "light_purple")
{
return {0xEE, 0x00, 0xEE};
}
else if (str == "green")
{
return {0x00, 0xFF, 0x00};
}
else if (str == "light_green")
{
return {0x00, 0xEE, 0x00};
}
else if (str == "cyan")
{
return {0x00, 0xFF, 0xFF};
}
else if (str == "light_cyan")
{
return {0x00, 0xEE, 0xEE};
}
else if (str == "yellow")
{
return {0xFF, 0xFF, 0x00};
}
else if (str == "light_yellow")
{
return {0xEE, 0xEE, 0x00};
}
else if (str == "white")
{
return {0xEE, 0xEE, 0xEE};
}
else if (str == "light_white")
{
return {0xFF, 0xFF, 0xFF};
}
}
else if (str == "light_black")
else
{
color = {0x3C, 0x35, 0x1F};
if (str == "black")
{
return {0x00, 0x00, 0x00};
}
else if (str == "light_black")
{
return {0x3C, 0x35, 0x1F};
}
else if (str == "blue")
{
return {0x31, 0x33, 0x90};
}
else if (str == "light_blue")
{
return {0x15, 0x59, 0xDB};
}
else if (str == "red")
{
return {0xA7, 0x32, 0x11};
}
else if (str == "light_red")
{
return {0xD8, 0x55, 0x25};
}
else if (str == "purple")
{
return {0xA1, 0x55, 0x89};
}
else if (str == "light_purple")
{
return {0xCD, 0x7A, 0x50};
}
else if (str == "green")
{
return {0x62, 0x9A, 0x31};
}
else if (str == "light_green")
{
return {0x9C, 0xD3, 0x3C};
}
else if (str == "cyan")
{
return {0x28, 0xA4, 0xCB};
}
else if (str == "light_cyan")
{
return {0x65, 0xDC, 0xD6};
}
else if (str == "yellow")
{
return {0xE8, 0xBC, 0x50};
}
else if (str == "light_yellow")
{
return {0xF1, 0xE7, 0x82};
}
else if (str == "white")
{
return {0xBF, 0xBF, 0xBD};
}
else if (str == "light_white")
{
return {0xF2, 0xF1, 0xED};
}
}
else if (str == "blue")
{
color = {0x31, 0x33, 0x90};
}
else if (str == "light_blue")
{
color = {0x15, 0x59, 0xDB};
}
else if (str == "red")
{
color = {0xA7, 0x32, 0x11};
}
else if (str == "light_red")
{
color = {0xD8, 0x55, 0x25};
}
else if (str == "purple")
{
color = {0xA1, 0x55, 0x89};
}
else if (str == "light_purple")
{
color = {0xCD, 0x7A, 0x50};
}
else if (str == "green")
{
color = {0x62, 0x9A, 0x31};
}
else if (str == "light_green")
{
color = {0x9C, 0xD3, 0x3C};
}
else if (str == "cyan")
{
color = {0x28, 0xA4, 0xCB};
}
else if (str == "light_cyan")
{
color = {0x65, 0xDC, 0xD6};
}
else if (str == "yellow")
{
color = {0xE8, 0xBC, 0x50};
}
else if (str == "light_yellow")
{
color = {0xF1, 0xE7, 0x82};
}
else if (str == "white")
{
color = {0xBF, 0xBF, 0xBD};
}
else if (str == "light_white")
{
color = {0xF2, 0xF1, 0xED};
}
return color;
return {0x00, 0x00, 0x00};
}

View File

@@ -7,9 +7,9 @@ x (A) Colisiones con los enemigos {cm:2022-08-29}
x (A) Decidir un diseño para qué sucede en caso de morir: Recordar el punto por donde se entró al mapa y la velocidad en el eje X/Y que llevaba el personaje, crear puntos de reaparicion en las habitaciones, etc {cm:2022-08-29}
x En el Jet Set Willy el juego recuerda la posicion y el momento. En las Tres Luces de Glaurung solo la posición. Se va a optar por seguir el diseño del Jet Set Willy {cm:2022-08-29}
x (A) Crear tiles que maten {cm:2022-08-29}
(A) Modificar el salto para que coincida con el del JSW, no ha de colisionar lateralmente
x (A) Modificar el salto para que coincida con el del JSW, no ha de colisionar lateralmente
(A) Crear tiles que deslicen, (no tipo hielo sino cinta)
(A) Crear tiles que arrastren, tipo cinta transportadora
(A) Tiles animados
(A) Crear ascensores
x (A) Enemigos de diferente tamaño {cm:2022-08-30}
@@ -27,10 +27,10 @@ x (A) Tecla + y - para cambiar tamaño de ventana. O control F1 a F4 {cm:2022-08
(A) Añadir a cada habitación el color del nombre de la habitación
x (A) Crear el logo al estilo del logo de ERBE o TOPO, con lineas que lo formen
(A) El titulo del juego hacerlo parecido al del Jet Set Willy in Paris
- Ha de generarse como las cargas de pantalla de spectrum
- Luego se colorea
- Finalmente, cada elemento cambia de color como si fueran luces de neon
x (A) El titulo del juego hacerlo parecido al del Jet Set Willy in Paris
x - Ha de generarse como las cargas de pantalla de spectrum
x - Luego se colorea
x - Finalmente, cada elemento cambia de color como si fueran luces de neon
x (A) En el titulo del juego, por la parte inferior ha de aparecer una marquesina con texto, al estilo demoscene
x (A) La pantalla de titulo no tiene menu, solo un PRESS ENTER TO PLAY