-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
updates startegies inheritance and folder orga, physicalEntity is the…
… most advanced class
- Loading branch information
Showing
8 changed files
with
177 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
{ | ||
"files.associations": { | ||
"*.tcc": "cpp", | ||
"array": "cpp", | ||
"atomic": "cpp", | ||
"bit": "cpp", | ||
"cctype": "cpp", | ||
"clocale": "cpp", | ||
"cmath": "cpp", | ||
"cstdarg": "cpp", | ||
"cstddef": "cpp", | ||
"cstdint": "cpp", | ||
"cstdio": "cpp", | ||
"cstdlib": "cpp", | ||
"ctime": "cpp", | ||
"cwchar": "cpp", | ||
"cwctype": "cpp", | ||
"deque": "cpp", | ||
"map": "cpp", | ||
"unordered_map": "cpp", | ||
"vector": "cpp", | ||
"exception": "cpp", | ||
"algorithm": "cpp", | ||
"functional": "cpp", | ||
"iterator": "cpp", | ||
"memory": "cpp", | ||
"memory_resource": "cpp", | ||
"numeric": "cpp", | ||
"optional": "cpp", | ||
"random": "cpp", | ||
"string": "cpp", | ||
"string_view": "cpp", | ||
"system_error": "cpp", | ||
"tuple": "cpp", | ||
"type_traits": "cpp", | ||
"utility": "cpp", | ||
"fstream": "cpp", | ||
"initializer_list": "cpp", | ||
"iosfwd": "cpp", | ||
"istream": "cpp", | ||
"limits": "cpp", | ||
"new": "cpp", | ||
"ostream": "cpp", | ||
"sstream": "cpp", | ||
"stdexcept": "cpp", | ||
"streambuf": "cpp", | ||
"typeinfo": "cpp" | ||
}, | ||
"C_Cpp.errorSquiggles": "Disabled" | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#ifndef CONTROLLABLE_H | ||
#define CONTROLLABLE_H | ||
#include "strategy.h" | ||
#include <SFML/Window.hpp> | ||
|
||
|
||
|
||
class Controllable : public virtual Strategy | ||
{ | ||
private: | ||
|
||
public: | ||
Controllable(/* args */); | ||
~Controllable(); | ||
|
||
void flush(bool[] inputs); //flush ? events ?, receive an array of boolean (flags) representing if some keys are pressed, | ||
// WARNIGN needs a convention (between conductor.ControllableHandler and this class) on that boolean array | ||
|
||
}; | ||
|
||
Controllable::Controllable(/* args */) | ||
{ | ||
} | ||
|
||
Controllable::~Controllable() | ||
{ | ||
} | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#ifndef DRAWABLE_HANDLER | ||
#define DRAWABLE_HANDLER | ||
#include "strategy.h" | ||
#include <vector> | ||
#include <SFML/Graphics/Drawable.hpp> | ||
#include <SFML/Graphics/RenderTarget.hpp> | ||
|
||
class MultiDrawable : public sf::Drawable/*--> peut etre le mettre en attribut*/, public virtual Strategy { | ||
private: | ||
std::vector<sf::Drawable*> toDraw; //list of sprites/shapes to draw | ||
virtual void draw(sf::RenderTarget& target, sf::RenderStates states) const; //i don't understand why const, comes form google "sfml drawable" | ||
public: | ||
DrawableHandler(); | ||
~DrawableHandler(); | ||
}; | ||
|
||
// in cpp: | ||
|
||
virtual void draw(sf::RenderTarget& target, sf::RenderStates states) const { | ||
for(sf::Drawable* d : toDraw){ | ||
target.draw(*d,states); | ||
} | ||
} | ||
|
||
DrawableHandler::DrawableHandler(/* args */){ | ||
} | ||
|
||
DrawableHandler::~DrawableHandler(){ | ||
} | ||
|
||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
#ifndef PHYSICAL_ENTITY | ||
#define PHYSICAL_ENTITY | ||
#include "strategy.h" | ||
#include <SFML/Graphics/Transformable.hpp> | ||
|
||
class Hitbox{}; | ||
|
||
class PhysicalEntity : public sf::Transformable, public Strategy | ||
{ | ||
/*Maybe the most important strategy | ||
PhysicalEntity (or later simply "Physical" ? "Physicable" ?) has to describe physical caracteristics of his entity: | ||
mass, touchable, (not invisible --> in Drawable), elasticity (wait ?), forceSensible (if he is or isn't sensible to some).. | ||
Maybe we would like to store damage hitbox in here instead of Character, | ||
or damageHitbox != physicalHitbox (like i can touch with my legs) but they can't take damages | ||
*/ | ||
private: | ||
//position, rotation etc in the parent class Transformable | ||
|
||
Hitbox physicalHitbox; // boolean solid (or touchable ?) in here | ||
unsigned double mass; //mass > 0 | ||
signed short gravityReaction; //-1 if the PhysicalEntity is likely to fly | ||
unsigned double bouncyness; // [0,1] absorb every momentum (0) or none (1), maybe it will increase it's internal energy ( to satisfy conservation of energy) | ||
double internalEnergy; //for characters that can absorb energy and then liberate it ? | ||
double electricCharge; //mdr | ||
|
||
public: | ||
|
||
Hitbox getHitbox(); | ||
void setHitbox(Hitbox newHitbox); | ||
|
||
//setPosition already handle in parent class Transformable: Google "sfml Transformable" | ||
|
||
/* | ||
the Physic toolbox will access position and then update position of every Entity | ||
with this strategy, these functions aren't implemented here | ||
only get and set positions are needed | ||
*/ | ||
|
||
PhysicalEntity(/* args */); | ||
~PhysicalEntity(); | ||
}; | ||
|
||
// in cpp : | ||
|
||
PhysicalEntity::PhysicalEntity(/* args */) | ||
{ | ||
//think to instantiate the parent Transformable attributes | ||
} | ||
|
||
PhysicalEntity::~PhysicalEntity() | ||
{ | ||
} | ||
|
||
|
||
|
||
#endif |
4 changes: 2 additions & 2 deletions
4
include/entity/schedulable.h → include/entity/strategies/schedulable.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters