A rouge-like rpg, heavily inspired on the binding of isaac. Running on a FRDM-K64F Mbed board. C++.

Dependencies:   mbed MotionSensor

RoomEngine/RoomEngine.h

Committer:
el17sm
Date:
2019-05-09
Revision:
49:3f83ed62d123
Parent:
47:6e31b195ce3c
Child:
50:2c5cb92a5361

File content as of revision 49:3f83ed62d123:

#ifndef ROOMENGINE_H
#define ROOMENGINE_H
#include "N5110.h"
#include "Gamepad.h"

#include "Player.h"
#include "Health.h"
#include "Room.h"

#include "sprites.h"
#define MAX_ROOMS_MAP_X 11
#define MAX_ROOMS_MAP_Y 11


class RoomEngine
{
public:
    // Constructor
    RoomEngine(float global_contrast);
    // Destructor
    ~RoomEngine();
    
    // Functions
    void load(Player *current_player, Room *current_room);
    void entrance_scene(N5110 &lcd, Gamepad &gamepad);
    void exit_scene(N5110 &lcd, Gamepad &gamepad);
    void update_current_room();
    
    void read_input(Gamepad &gamepad);
    void update(int &number_of_enemies_killed);
    void render(N5110 &lcd, Gamepad &gamepad);
    
    int check_player_room_position();
    
    // Accessor
    int get_room_x();
    int get_room_y();
    
private:
    bool _L;
    bool _R;
    bool _A;
    bool _B;
    bool _X;
    bool _Y;
    Vector2D mapped_coord;
    
    int _room_x;
    int _room_y;
    
    float _global_contrast;
    
    Room *room;
    Player *player;
    
    // Mutator
    void set_input(bool L, bool R, bool A, bool B, bool X, bool Y, float mapped_x, float mapped_y);
    void set_mapped_coord(float x, float y);
    
    // Methods
    bool entity_collision(Entity &a, Entity &b);
    float entity_move_check_x(Entity *a, Entity *array[], int no_of_enemies, int current_entity, bool valid_enemies[]);
    float entity_move_check_y(Entity *a, Entity *array[], int no_of_enemies, int current_entity, bool valid_enemies[]);
    
    void check_damage();
    void check_damage_player();
    void check_damage_enemies();
    void check_enemies_death(int &number_of_enemies_killed);
    void check_walls_collision();
    
    void move();
    void move_player();
    void move_enemies();
    void update_player_position(int side);
    
    void pause_detection(N5110 &lcd, Gamepad &gamepad);
    void draw_pause_screen(N5110 &lcd, char * paused_screen, int &pause_timer);
    
    void draw(N5110 &lcd);
    void draw_health(N5110 &lcd);
    
};
#endif