0
0
mirror of https://github.com/Nimac0/SDL_Minigame synced 2026-01-12 21:23:41 +00:00

refactor: removed Components.h file

consisted of includes of all components -> components included when not necessary
TODO: had to add 3 component includes in Entity.h because of template function; move if possible
This commit is contained in:
Sara Varga 2024-05-01 13:47:42 +02:00
parent 5dc61e6230
commit 2e7a1b45cf
7 changed files with 29 additions and 33 deletions

View File

@ -1,13 +0,0 @@
#pragma once
#include "ECS.h"
#include "Component.h"
#include "Manager.h"
#include "Entity.h"
#include "TransformComponent.h"
#include "SpriteComponent.h"
#include "KeyboardController.h"
#include "ColliderComponent.h"
#include "TileComponent.h"
#include "ProjectileComponent.h"
#include "HealthComponent.h"

View File

@ -9,6 +9,12 @@
#include "ECS.h"
#include "Constants.h"
// TODO: remove here if possible
// temporary fix: addComponent function template doesnt know TransformComponent -> error undefined type
#include "TransformComponent.h"
#include "KeyboardController.h"
#include "SpriteComponent.h"
class Manager;
class Component;

View File

@ -1,22 +1,6 @@
#include <SDL.h>
#include <map>
class Input
{
public:
Input();
~Input();
void pollEvents();
bool isKeyDown(Key key);
private:
const Uint8* m_keyStates;
SDL_Scancode mapKeyToSDL(Key key);
std::map<Key, SDL_Scancode> m_keyMappings;
void InitKeyMappings();
};
enum class Key
{
UP,
@ -99,3 +83,19 @@ enum class Key
BACKSLASH,
GRAVE
};
class Input
{
public:
Input();
~Input();
void pollEvents();
bool isKeyDown(Key key);
private:
const Uint8* m_keyStates;
SDL_Scancode mapKeyToSDL(Key key);
std::map<Key, SDL_Scancode> m_keyMappings;
void InitKeyMappings();
};

View File

@ -2,8 +2,9 @@
#include "TextureManager.h"
#include "SoundManager.h"
#include "Components.h"
#include "ProjectileComponent.h"
#include "Game.h"
#include "TextureDict.h"
#include "TransformComponent.h"

View File

@ -3,8 +3,10 @@
#include <SDL_error.h>
#include "CollisionHandler.h"
#include "Components.h"
#include "AssetManager.h"
#include "SoundManager.h"
#include "KeyboardController.h"
#include "TileComponent.h"
#include "Direction.h"
#include "Entity.h"
#include "HealthComponent.h"

View File

@ -1,6 +1,5 @@
#include "HealthComponent.h"
#include "Components.h"
#include "Direction.h"
#include "Entity.h"
#include "Game.h"

View File

@ -1,7 +1,8 @@
#include "ProjectileComponent.h"
#include "CollisionHandler.h"
#include "Components.h"
#include "SoundManager.h"
#include "TransformComponent.h"
#include "Entity.h"
#include "Game.h"
#include "HealthComponent.h"