Sustituyendo todos los defines de const.h

This commit is contained in:
2022-08-29 21:07:52 +02:00
parent 0d27774c74
commit add7e5201a
12 changed files with 19 additions and 24 deletions

View File

@@ -1,4 +1,4 @@
#include "const.h"
#include "animatedsprite.h" #include "animatedsprite.h"
// Constructor // Constructor

View File

@@ -1,4 +1,4 @@
#include "const.h"
#include "utils.h" #include "utils.h"
#include "director.h" #include "director.h"
#include <iostream> #include <iostream>
@@ -41,10 +41,6 @@ Director::Director(std::string path)
// Inicializa JailAudio // Inicializa JailAudio
initJailAudio(); initJailAudio();
// Aplica las opciones
SDL_SetWindowFullscreen(window, options->fullScreenMode);
SDL_SetWindowSize(window, SCREEN_WIDTH * options->windowSize, SCREEN_HEIGHT * options->windowSize);
// Inicializa el resto de variables // Inicializa el resto de variables
init(section); init(section);
} }
@@ -122,7 +118,7 @@ bool Director::initSDL()
} }
// Crea la ventana // Crea la ventana
window = SDL_CreateWindow(WINDOW_CAPTION, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, VIEW_WIDTH, VIEW_HEIGHT, SDL_WINDOW_SHOWN | SDL_WINDOW_ALLOW_HIGHDPI); window = SDL_CreateWindow(WINDOW_CAPTION, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, options->screenWidth, options->screenHeight, SDL_WINDOW_SHOWN | SDL_WINDOW_ALLOW_HIGHDPI);
if (window == NULL) if (window == NULL)
{ {
printf("Window could not be created!\nSDL Error: %s\n", SDL_GetError()); printf("Window could not be created!\nSDL Error: %s\n", SDL_GetError());
@@ -147,7 +143,7 @@ bool Director::initSDL()
SDL_SetRenderDrawColor(renderer, 0x00, 0x00, 0x00, 0xFF); SDL_SetRenderDrawColor(renderer, 0x00, 0x00, 0x00, 0xFF);
// Establece el tamaño del buffer de renderizado // Establece el tamaño del buffer de renderizado
SDL_RenderSetLogicalSize(renderer, SCREEN_WIDTH, SCREEN_HEIGHT); SDL_RenderSetLogicalSize(renderer, options->screenWidth, options->screenHeight);
// Establece el modo de mezcla // Establece el modo de mezcla
SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_BLEND); SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_BLEND);

View File

@@ -4,7 +4,7 @@
#include "movingsprite.h" #include "movingsprite.h"
#include "text.h" #include "text.h"
#include "menu.h" #include "menu.h"
#include "const.h"
#include "jail_audio.h" #include "jail_audio.h"
#include "utils.h" #include "utils.h"
#include "input.h" #include "input.h"
@@ -15,8 +15,8 @@
#define DIRECTOR_H #define DIRECTOR_H
#define WINDOW_CAPTION "JailDoctor's Dilemma" #define WINDOW_CAPTION "JailDoctor's Dilemma"
#define GAME_WIDTH 320 #define GAME_WIDTH 256
#define GAME_HEIGHT 240 #define GAME_HEIGHT 192
// Director // Director
class Director class Director

View File

@@ -5,7 +5,7 @@ Game::Game(SDL_Renderer *renderer, Screen *screen, Asset *asset, Input *input)
{ {
// Inicia variables // Inicia variables
currentRoom = "01.room"; currentRoom = "01.room";
spawnPoint = {2 * BLOCK, 12 * BLOCK, 0, 0, 0, STATUS_STANDING, SDL_FLIP_NONE}; spawnPoint = {2 * 8, 12 * 8, 0, 0, 0, STATUS_STANDING, SDL_FLIP_NONE};
debug = false; debug = false;
// Copia los punteros // Copia los punteros
@@ -26,7 +26,7 @@ Game::Game(SDL_Renderer *renderer, Screen *screen, Asset *asset, Input *input)
ticksSpeed = 15; ticksSpeed = 15;
section.name = SECTION_PROG_GAME; section.name = SECTION_PROG_GAME;
section.subsection = SECTION_GAME_PLAY; section.subsection = SUBSECTION_GAME_PLAY;
} }
Game::~Game() Game::~Game()
@@ -62,7 +62,7 @@ section_t Game::run()
while (section.name == SECTION_PROG_GAME) while (section.name == SECTION_PROG_GAME)
{ {
// Sección juego jugando // Sección juego jugando
if (section.subsection == SECTION_GAME_PLAY) if (section.subsection == SUBSECTION_GAME_PLAY)
{ {
update(); update();
render(); render();

View File

@@ -1,6 +1,6 @@
#pragma once #pragma once
#include <SDL2/SDL.h> #include <SDL2/SDL.h>
#include "const.h"
#include "utils.h" #include "utils.h"
#include "sprite.h" #include "sprite.h"
#include "movingsprite.h" #include "movingsprite.h"

View File

@@ -1,4 +1,4 @@
#include "const.h"
#include "ltexture.h" #include "ltexture.h"
#define STB_IMAGE_IMPLEMENTATION #define STB_IMAGE_IMPLEMENTATION
#include "stb_image.h" #include "stb_image.h"

View File

@@ -1,4 +1,4 @@
#include "const.h"
#include "menu.h" #include "menu.h"
// Constructor // Constructor

View File

@@ -1,4 +1,4 @@
#include "const.h"
#include "movingsprite.h" #include "movingsprite.h"
// Constructor // Constructor

View File

@@ -1,6 +1,6 @@
#pragma once #pragma once
#include <SDL2/SDL.h> #include <SDL2/SDL.h>
#include "const.h"
#include "utils.h" #include "utils.h"
#include "asset.h" #include "asset.h"
#include "room.h" #include "room.h"

View File

@@ -1,6 +1,6 @@
#pragma once #pragma once
#include <SDL2/SDL.h> #include <SDL2/SDL.h>
#include "const.h"
#include "utils.h" #include "utils.h"
#include "asset.h" #include "asset.h"
#include "enemy.h" #include "enemy.h"

View File

@@ -1,5 +1,4 @@
#include "screen.h" #include "screen.h"
#include "const.h"
#include <string> #include <string>
#include <stdio.h> #include <stdio.h>
@@ -11,8 +10,8 @@ Screen::Screen(SDL_Window *window, SDL_Renderer *renderer, options_t *options)
this->renderer = renderer; this->renderer = renderer;
this->options = options; this->options = options;
gameCanvasWidth = SCREEN_WIDTH; gameCanvasWidth = 256;
gameCanvasHeight = SCREEN_HEIGHT; gameCanvasHeight = 192;
// Establece el modo de video // Establece el modo de video
setVideoMode(options->fullScreenMode); setVideoMode(options->fullScreenMode);

View File

@@ -1,4 +1,4 @@
#include "const.h"
#include "text.h" #include "text.h"
#include <iostream> #include <iostream>
#include <fstream> #include <fstream>