VEGO-Engine  0.1
Loading...
Searching...
No Matches
KeyboardController.h
1#pragma once
2#include <SDL.h>
3
4#include "Component.h"
5#include "Vector2D.h"
6#include "Constants.h"
7#include "SoundManager.h"
8
10class SpriteComponent;
11
13{
14public:
15 TransformComponent* transform;
16 const uint8_t* keystates = SDL_GetKeyboardState(NULL);
17 SDL_Scancode up;
18 SDL_Scancode down;
19 SDL_Scancode left;
20 SDL_Scancode right;
21 SDL_Scancode fire;
22
23 SpriteComponent* sprite;
24
25 //for attack cooldown in between shots
26 uint32_t lastFireTime = 0;
27 uint32_t fireCooldown = 1000; //in ms can be adjusted to change possible attack-speed
28
29 KeyboardController() = default;
30 KeyboardController(SDL_Scancode up, SDL_Scancode down, SDL_Scancode left, SDL_Scancode right, SDL_Scancode fire, Vector2D fireVelocity);
31 ~KeyboardController() = default;
32
33 void init() override;
34 void update() override;
35
36 void modifyAtkSpeed(int8_t modifier);
37
38private:
39 //for creation of projectiles
40 TransformComponent* player; //for starting position of projectile
41 Vector2D fireVelocity; //decide source of projectile and flying direction
42 // SoundManager* soundEffect = Game::assets->getSound;
43 //SoundManager* soundEffect = new SoundManager();
44};
Definition Component.h:6
Definition KeyboardController.h:13
Definition SpriteComponent.h:14
Definition TransformComponent.h:8
Definition Vector2D.h:7