diff --git a/source/director.cpp b/source/director.cpp index 516de18..90096ba 100644 --- a/source/director.cpp +++ b/source/director.cpp @@ -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; diff --git a/source/input.cpp b/source/input.cpp index dc8b705..59c4bb0 100644 --- a/source/input.cpp +++ b/source/input.cpp @@ -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); } diff --git a/source/input.h b/source/input.h index 5e41608..a463b34 100644 --- a/source/input.h +++ b/source/input.h @@ -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 mConnectedControllers; + // SDL_GameController *mGameController; // Manejador para el mando + std::vector mConnectedControllers; std::vector 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(); diff --git a/source/item.cpp b/source/item.cpp index e97f6c1..d65dc9e 100644 --- a/source/item.cpp +++ b/source/item.cpp @@ -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 diff --git a/source/logo.h b/source/logo.h index 1f4bda3..ae3da4b 100644 --- a/source/logo.h +++ b/source/logo.h @@ -24,7 +24,7 @@ private: SDL_Event *eventHandler; // Manejador de eventos std::vector sprite; // Vector con los sprites de cada linea que forman el bitmap JAILGAMES Sprite *sprite2; // Sprite para manejar la textura2 - std::vector color; // Vector con los colores para el fade + std::vector 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 diff --git a/source/ltexture.h b/source/ltexture.h index 87d2f75..ff23c6f 100644 --- a/source/ltexture.h +++ b/source/ltexture.h @@ -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 diff --git a/source/main.cpp b/source/main.cpp index d3e961b..17ca04d 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -11,7 +11,7 @@ Empezado en Castalla el 01/07/2022. int main(int argc, char *args[]) { printf("Starting the game...\n\n"); - + // Crea el objeto Director Director *mDirector = new Director(args[0]); diff --git a/source/screen.h b/source/screen.h index d0f39e5..22c524e 100644 --- a/source/screen.h +++ b/source/screen.h @@ -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 }; diff --git a/source/text.cpp b/source/text.cpp index e3b8598..954d4e1 100644 --- a/source/text.cpp +++ b/source/text.cpp @@ -180,5 +180,5 @@ int Text::getCharacterWidth() // Recarga la textura void Text::reLoadTexture() { - texture->reLoad(); + texture->reLoad(); } \ No newline at end of file diff --git a/source/utils.cpp b/source/utils.cpp index dbf35d3..10c52b2 100644 --- a/source/utils.cpp +++ b/source/utils.cpp @@ -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}; } \ No newline at end of file diff --git a/todo.txt b/todo.txt index 3c200e2..80a7096 100644 --- a/todo.txt +++ b/todo.txt @@ -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