forked from jaildesigner-jailgames/jaildoctors_dilemma
cambiado el nombre de map.h a room.h
This commit is contained in:
12
data/room/01.room
Normal file
12
data/room/01.room
Normal file
@@ -0,0 +1,12 @@
|
||||
id=1
|
||||
name=Test Room
|
||||
bg_color=black
|
||||
tileset=1
|
||||
limit_up=0
|
||||
limit_down=0
|
||||
limit_left=0
|
||||
limit_right=2
|
||||
tilemap=67,67,89,92,93
|
||||
enemy=1,0,0,0,1
|
||||
enemy=2,10,0,0,1
|
||||
item=1,10,10
|
||||
12
data/room/02.room
Normal file
12
data/room/02.room
Normal file
@@ -0,0 +1,12 @@
|
||||
id=2
|
||||
name=Test Room 2
|
||||
bg_color=blue
|
||||
tileset=1
|
||||
limit_up=0
|
||||
limit_down=
|
||||
limit_left=1
|
||||
limit_right=0
|
||||
tilemap=67,67,89,92,93
|
||||
enemy=1,0,0,0,1
|
||||
enemy=2,10,0,0,1
|
||||
item=1,10,10
|
||||
@@ -47,10 +47,10 @@ bool Asset::check()
|
||||
}
|
||||
|
||||
// Resultado
|
||||
if (success)
|
||||
printf("\n** All files OK.\n\n");
|
||||
else
|
||||
printf("\n** A file is missing. Exiting.\n\n");
|
||||
if (success)
|
||||
printf("\n** All files OK.\n\n");
|
||||
else
|
||||
printf("\n** A file is missing. Exiting.\n\n");
|
||||
|
||||
return success;
|
||||
}
|
||||
@@ -101,6 +101,15 @@ std::string Asset::getTypeName(int type)
|
||||
case data:
|
||||
return "DATA";
|
||||
break;
|
||||
case room:
|
||||
return "ROOM";
|
||||
break;
|
||||
case enemy:
|
||||
return "ENEMY";
|
||||
break;
|
||||
case item:
|
||||
return "ITEM";
|
||||
break;
|
||||
default:
|
||||
return "ERROR";
|
||||
break;
|
||||
|
||||
@@ -14,6 +14,9 @@ enum assetType
|
||||
font,
|
||||
lang,
|
||||
data,
|
||||
room,
|
||||
enemy,
|
||||
item,
|
||||
maxAssetType
|
||||
};
|
||||
|
||||
|
||||
@@ -97,9 +97,7 @@ void Director::init(Uint8 name)
|
||||
mInput->bindKey(INPUT_RIGHT, SDL_SCANCODE_RIGHT);
|
||||
mInput->bindKey(INPUT_ACCEPT, SDL_SCANCODE_RETURN);
|
||||
mInput->bindKey(INPUT_CANCEL, SDL_SCANCODE_ESCAPE);
|
||||
mInput->bindKey(INPUT_BUTTON_1, SDL_SCANCODE_Z);
|
||||
mInput->bindKey(INPUT_BUTTON_2, SDL_SCANCODE_X);
|
||||
mInput->bindKey(INPUT_BUTTON_3, SDL_SCANCODE_C);
|
||||
mInput->bindKey(INPUT_BUTTON_1, SDL_SCANCODE_SPACE);
|
||||
mInput->bindKey(INPUT_BUTTON_PAUSE, SDL_SCANCODE_ESCAPE);
|
||||
mInput->bindKey(INPUT_BUTTON_ESCAPE, SDL_SCANCODE_ESCAPE);
|
||||
|
||||
@@ -109,9 +107,7 @@ void Director::init(Uint8 name)
|
||||
mInput->bindGameControllerButton(INPUT_RIGHT, SDL_CONTROLLER_BUTTON_DPAD_RIGHT);
|
||||
mInput->bindGameControllerButton(INPUT_ACCEPT, SDL_CONTROLLER_BUTTON_B);
|
||||
mInput->bindGameControllerButton(INPUT_CANCEL, SDL_CONTROLLER_BUTTON_A);
|
||||
mInput->bindGameControllerButton(INPUT_BUTTON_1, SDL_CONTROLLER_BUTTON_X);
|
||||
mInput->bindGameControllerButton(INPUT_BUTTON_2, SDL_CONTROLLER_BUTTON_Y);
|
||||
mInput->bindGameControllerButton(INPUT_BUTTON_3, SDL_CONTROLLER_BUTTON_B);
|
||||
mInput->bindGameControllerButton(INPUT_BUTTON_1, SDL_CONTROLLER_BUTTON_B);
|
||||
mInput->bindGameControllerButton(INPUT_BUTTON_PAUSE, SDL_CONTROLLER_BUTTON_GUIDE);
|
||||
mInput->bindGameControllerButton(INPUT_BUTTON_ESCAPE, SDL_CONTROLLER_BUTTON_GUIDE);
|
||||
}
|
||||
@@ -200,6 +196,8 @@ void Director::setFileList()
|
||||
mAsset->add("/media/lang/ba_BA.txt", lang);
|
||||
mAsset->add("/data/gamecontrollerdb.txt", data);
|
||||
mAsset->add("/data/config.bin", data, false);
|
||||
mAsset->add("/data/room/01.room", room);
|
||||
mAsset->add("/data/room/02.room", room);
|
||||
}
|
||||
|
||||
// Carga el fichero de configuración
|
||||
|
||||
@@ -10,7 +10,7 @@ Game::Game(SDL_Window *window,SDL_Renderer *renderer, Asset *asset, Lang *lang,
|
||||
mInput = input;
|
||||
|
||||
mScreen = new Screen(window, renderer);
|
||||
mMap = new Map();
|
||||
mRoom = new Room();
|
||||
mEventHandler = new SDL_Event();
|
||||
mTextureText = new LTexture();
|
||||
mText = new Text(mAsset->get("nokia2.txt"), mTextureText, renderer);
|
||||
@@ -34,8 +34,8 @@ Game::~Game()
|
||||
delete mScreen;
|
||||
mScreen = nullptr;
|
||||
|
||||
delete mMap;
|
||||
mMap = nullptr;
|
||||
delete mRoom;
|
||||
mRoom = nullptr;
|
||||
|
||||
delete mText;
|
||||
mText = nullptr;
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
#include "lang.h"
|
||||
#include "screen.h"
|
||||
#include "asset.h"
|
||||
#include "map.h"
|
||||
#include "room.h"
|
||||
#include "jail_audio.h"
|
||||
|
||||
#ifndef GAME_H
|
||||
@@ -28,21 +28,21 @@ private:
|
||||
SDL_Renderer *mRenderer; // El renderizador de la ventana
|
||||
SDL_Event *mEventHandler; // Manejador de eventos
|
||||
Screen *mScreen; // Objeto encargado de manejar el renderizador
|
||||
Map *mMap; // Objeto encargado de gestionar el mapa del juego
|
||||
Room *mRoom; // Objeto encargado de gestionar cada habitación del juego
|
||||
Asset *mAsset; // Objeto con la ruta a todos los ficheros de recursos
|
||||
Lang *mLang; // Objeto para gestionar los textos en diferentes idiomas
|
||||
Input *mInput; // Manejador de entrada
|
||||
Text *mText; // Fuente para los textos del juego
|
||||
Input *mInput; // Objeto pata gestionar la entrada
|
||||
Text *mText; // Objeto para los textos del juego
|
||||
Fade *mFade; // Objeto para renderizar fades
|
||||
LTexture *mTextureText; // Textura para la fuente de texto Nokia grande
|
||||
LTexture *mTextureText; // Textura para la fuente de texto
|
||||
Uint32 mTicks; // Contador de ticks para ajustar la velocidad del programa
|
||||
Uint8 mTicksSpeed; // Velocidad a la que se repiten los bucles del programa
|
||||
section_t mSection; // Seccion actual dentro del juego
|
||||
|
||||
// Inicializa las variables necesarias para la sección 'Game'
|
||||
// Inicializa las variables
|
||||
void init();
|
||||
|
||||
// Carga los recursos necesarios para la sección 'Game'
|
||||
// Carga los recursos
|
||||
bool loadMedia();
|
||||
|
||||
public:
|
||||
|
||||
22
source/map.h
22
source/map.h
@@ -1,22 +0,0 @@
|
||||
#pragma once
|
||||
#include "ifdefs.h"
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#ifndef MAP_H
|
||||
#define MAP_H
|
||||
|
||||
// Clase Map
|
||||
class Map
|
||||
{
|
||||
private:
|
||||
|
||||
public:
|
||||
// Constructor
|
||||
Map();
|
||||
|
||||
// Destructor
|
||||
~Map();
|
||||
};
|
||||
|
||||
#endif
|
||||
43
source/room.h
Normal file
43
source/room.h
Normal file
@@ -0,0 +1,43 @@
|
||||
#pragma once
|
||||
#include "ifdefs.h"
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#ifndef ROOM_H
|
||||
#define ROOM_H
|
||||
|
||||
/*
|
||||
Cada habitación se crea y destruye cada vez que se entra o sale de la misma
|
||||
Cada habitacion si que tendra lo siguiente:
|
||||
ID (numerico)
|
||||
NOMBRE (texto)
|
||||
COLOR DE FONDO (texto)
|
||||
SET DE TILES (texto, hace referencia a un png de la colección)
|
||||
LIMITE SUPERIOR (ID de la habitación superior), INFERIOR, IZQUIERDO y DERECHO
|
||||
MAPA DE TILES (array con los indices de los tiles a utilizar) <-- hay que decidir si cada tile del set ya
|
||||
tierne propiedades o se ponen en un mapa aparte
|
||||
LISTADO DE ENEMIGOS (tipo, posicion, dx, dy)
|
||||
LISTADO DE ITEMS (tipo, posicion)
|
||||
*/
|
||||
|
||||
// Clase Room
|
||||
class Room
|
||||
{
|
||||
private:
|
||||
int id; // Identificador
|
||||
std::string name; // Nombre de la habitación
|
||||
std::string bg_color; // Color de fondo de la habitación
|
||||
std::string tileset; // Imagen con los graficos para la habitación
|
||||
std::vector<int> tilemap; // Indice de los tiles a dibujar en la habitación
|
||||
std::vector<int> enemy_list; // Listado con los enemigos de la habitación
|
||||
std::vector<int> item_list; // Listado con los items que hay en la habitación
|
||||
|
||||
public:
|
||||
// Constructor
|
||||
Room();
|
||||
|
||||
// Destructor
|
||||
~Room();
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user