Skip to content

Commit

Permalink
added main entity functions prototypes
Browse files Browse the repository at this point in the history
  • Loading branch information
benstyle11 authored and ctmbl committed Dec 15, 2021
1 parent 2f9faa3 commit 58a30f9
Show file tree
Hide file tree
Showing 6 changed files with 177 additions and 1 deletion.
33 changes: 33 additions & 0 deletions include/entity/character.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#ifndef CHARACTER_H
#define CHARACTER_H
#include "controlable.h"
#include "drawable_handler.h"
#include "physical_entity.h"
#include "schedulable.h"

class Character : Controllable, DrawableHandler, Physical_entity, Schedulable
{
private:
/* data */
public:

virtual void sendEvent( sf::Event e );


Character(/* args */);
~Character();
};

Character::Character(/* args */)
{
}

Character::~Character()
{
}





#endif
32 changes: 32 additions & 0 deletions include/entity/controlable.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#ifndef CONTROLLABLE_H
#define CONTROLLABLE_H
#include <SFML/Window.hpp>


class Controllable
{
private:

public:
Controllable(/* args */);
~Controllable();

virtual void sendEvent(sf::Event e);

};

Controllable::Controllable(/* args */)
{
}

Controllable::~Controllable()
{
}







#endif
2 changes: 1 addition & 1 deletion include/entity/drawable_handler.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
class DrawableHandler : public sf::Drawable {
private:
std::vector<sf::Drawable*> toDraw;
virtual void DrawableHandler::draw(sf::RenderTarget& target, sf::RenderStates states) const {
virtual void draw(sf::RenderTarget& target, sf::RenderStates states) const {
for(sf::Drawable* d : toDraw){
target.draw(*d,states);
}
Expand Down
33 changes: 33 additions & 0 deletions include/entity/physical_entity.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,40 @@
#ifndef PHYSICAL_ENTITY
#define PHYSICAL_ENTITY
#include <SFML/System/Vector2.hpp>


typedef struct
{
/* collider stuff ( e.g. linked list of vertex) */
} Collider;



class Physical_entity
{
private:
sf::Vector2f pos;
float rot;

Collider bndBox;
public:

virtual void updatePhysics(); //here some kind of phx::PhysicsHandler;
void getCollider();
void setCollider(Collider newCollider);

Physical_entity(/* args */);
~Physical_entity();
};

Physical_entity::Physical_entity(/* args */)
{
}

Physical_entity::~Physical_entity()
{
}



#endif
50 changes: 50 additions & 0 deletions include/entity/schedulable.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#ifndef SCHEDULABLE.H
#define SCHEDULABLE.H
#include <queue>
#include <functional>
#include <map>

class Schedulable
{
private:

std::multimap<int, std::function<void ()> > actions; // actions to do at a given frame (contains a frame and a function to call)
// Maybe a Circular buffer would be better ?
public:



void update(int frame)
/*
{
if(actions.count(frame) > 0){
for(std::function<void()> currentAction : (actions.find(frame)) ){
}
}
} */; // call this one each frame

void addAction(int frame, std::function<void()> action);


Schedulable(/* args */);
~Schedulable();
};

Schedulable::Schedulable(/* args */)
{
}

Schedulable::~Schedulable()
{
}






#endif
28 changes: 28 additions & 0 deletions include/entity/wall.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#ifndef WALL_H
#define WALL_H
#include "drawable_handler.h"
#include "physical_entity.h"



class Wall: DrawableHandler, Physical_entity
{
private:
/* data */
public:
Wall(/* args */);
~Wall();
};

Wall::Wall(/* args */)
{
}

Wall::~Wall()
{
}




#endif

0 comments on commit 58a30f9

Please sign in to comment.