mirror of
https://github.com/Nimac0/SDL_Minigame
synced 2026-01-12 10:13:42 +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:
parent
5dc61e6230
commit
2e7a1b45cf
@ -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"
|
|
||||||
@ -9,6 +9,12 @@
|
|||||||
#include "ECS.h"
|
#include "ECS.h"
|
||||||
#include "Constants.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 Manager;
|
||||||
class Component;
|
class Component;
|
||||||
|
|
||||||
|
|||||||
@ -1,22 +1,6 @@
|
|||||||
#include <SDL.h>
|
#include <SDL.h>
|
||||||
#include <map>
|
#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
|
enum class Key
|
||||||
{
|
{
|
||||||
UP,
|
UP,
|
||||||
@ -99,3 +83,19 @@ enum class Key
|
|||||||
BACKSLASH,
|
BACKSLASH,
|
||||||
GRAVE
|
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();
|
||||||
|
};
|
||||||
|
|||||||
@ -2,8 +2,9 @@
|
|||||||
|
|
||||||
#include "TextureManager.h"
|
#include "TextureManager.h"
|
||||||
#include "SoundManager.h"
|
#include "SoundManager.h"
|
||||||
#include "Components.h"
|
#include "ProjectileComponent.h"
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
|
#include "TextureDict.h"
|
||||||
|
|
||||||
#include "TransformComponent.h"
|
#include "TransformComponent.h"
|
||||||
|
|
||||||
|
|||||||
@ -3,8 +3,10 @@
|
|||||||
#include <SDL_error.h>
|
#include <SDL_error.h>
|
||||||
|
|
||||||
#include "CollisionHandler.h"
|
#include "CollisionHandler.h"
|
||||||
#include "Components.h"
|
|
||||||
#include "AssetManager.h"
|
#include "AssetManager.h"
|
||||||
|
#include "SoundManager.h"
|
||||||
|
#include "KeyboardController.h"
|
||||||
|
#include "TileComponent.h"
|
||||||
#include "Direction.h"
|
#include "Direction.h"
|
||||||
#include "Entity.h"
|
#include "Entity.h"
|
||||||
#include "HealthComponent.h"
|
#include "HealthComponent.h"
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
#include "HealthComponent.h"
|
#include "HealthComponent.h"
|
||||||
|
|
||||||
#include "Components.h"
|
|
||||||
#include "Direction.h"
|
#include "Direction.h"
|
||||||
#include "Entity.h"
|
#include "Entity.h"
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
|
|||||||
@ -1,7 +1,8 @@
|
|||||||
#include "ProjectileComponent.h"
|
#include "ProjectileComponent.h"
|
||||||
|
|
||||||
#include "CollisionHandler.h"
|
#include "CollisionHandler.h"
|
||||||
#include "Components.h"
|
#include "SoundManager.h"
|
||||||
|
#include "TransformComponent.h"
|
||||||
#include "Entity.h"
|
#include "Entity.h"
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
#include "HealthComponent.h"
|
#include "HealthComponent.h"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user