Skip to content

Commit

Permalink
clean code
Browse files Browse the repository at this point in the history
  • Loading branch information
Krozark committed Apr 14, 2015
1 parent 939ca83 commit 76b467f
Show file tree
Hide file tree
Showing 49 changed files with 168 additions and 472 deletions.
4 changes: 0 additions & 4 deletions 02_Game_Archi/include/SFML-Book/Action.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@ namespace book
Action(const Action& other);
Action& operator=(const Action& other);

/*Action(const sf::Event& event,int type=Type::RealTime);
Action(sf::Event&& event,int type=Type::RealTime);
Action(const sf::Event::EventType& event,int type=Type::Pressed);*/
Action(const sf::Keyboard::Key& key,int type=Type::RealTime|Type::Pressed);
Action(const sf::Mouse::Button& button,int type=Type::RealTime|Type::Pressed);

Expand Down
1 change: 0 additions & 1 deletion 02_Game_Archi/include/SFML-Book/ResourceManager.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ namespace book
}

//sf::Music special case

template<typename IDENTIFIER>
template<typename ... Args>
void ResourceManager<sf::Music,IDENTIFIER>::load(const IDENTIFIER& id,Args&& ... args)
Expand Down
33 changes: 0 additions & 33 deletions 02_Game_Archi/src/SFML-Book/Action.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,6 @@ namespace book
return *this;
}

/*Action::Action(const sf::Event::EventType& event,int type) : _type(type)
{
_event.type = event;
}*/

Action::Action(const sf::Keyboard::Key& key,int type) : _type(type)
{
_event.type = sf::Event::EventType::KeyPressed;
Expand All @@ -38,16 +33,6 @@ namespace book

switch(event.type)
{
/*case sf::Event::EventType::TextEntered:
{
if(_event.type == sf::Event::EventType::TextEntered)
res = event.text.unicode == _event.text.unicode;
}break;
case sf::Event::EventType::MouseWheelMoved:
{
if(_event.type == sf::Event::EventType::MouseWheelMoved)
res = event.mouseWheel.delta == _event.mouseWheel.delta;
}break;*/
case sf::Event::EventType::KeyPressed:
{
if(_type & Type::Pressed and _event.type == sf::Event::EventType::KeyPressed)
Expand All @@ -68,20 +53,7 @@ namespace book
if(_type & Type::Released and _event.type == sf::Event::EventType::MouseButtonPressed)
res = event.mouseButton.button == _event.mouseButton.button;
}break;
/*case sf::Event::EventType::JoystickButtonPressed:
{
if(_type & Type::Pressed and _event.type == sf::Event::EventType::JoystickButtonPressed)
res = event.joystickButton.button == _event.joystickButton.button;
}break;
case sf::Event::EventType::JoystickButtonReleased:
{
if(_type & Type::Releaseed and _event.type == sf::Event::EventType::JoystickButtonPressed)
res = event.joystickButton.button == _event.joystickButton.button;
}break;*/
default: break;
/*{
res = event.type == _event.type;
}break;*/
}
return res;
}
Expand All @@ -104,11 +76,6 @@ namespace book
if(_type & Type::Pressed)
res = sf::Mouse::isButtonPressed(_event.mouseButton.button);
}
/*else if (_event.type == sf::Event::EventType::JoystickButtonPressed)
{
if(_type & Type::Pressed)
res = sf::Joystick::isButtonPressed(0,_event.joystickButton.button);
}*/
return res;
}
}
4 changes: 0 additions & 4 deletions 03_Simple_2D_game/Asteroid/include/SFML-Book/Action.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@ namespace book
Action(const Action& other);
Action& operator=(const Action& other);

/*Action(const sf::Event& event,int type=Type::RealTime);
Action(sf::Event&& event,int type=Type::RealTime);
Action(const sf::Event::EventType& event,int type=Type::Pressed);*/
Action(const sf::Keyboard::Key& key,int type=Type::RealTime|Type::Pressed);
Action(const sf::Mouse::Button& button,int type=Type::RealTime|Type::Pressed);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ namespace book
}

//sf::Music special case

template<typename IDENTIFIER>
template<typename ... Args>
void ResourceManager<sf::Music,IDENTIFIER>::load(const IDENTIFIER& id,Args&& ... args)
Expand Down
33 changes: 0 additions & 33 deletions 03_Simple_2D_game/Asteroid/src/SFML-Book/Action.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,6 @@ namespace book
return *this;
}

/*Action::Action(const sf::Event::EventType& event,int type) : _type(type)
{
_event.type = event;
}*/

Action::Action(const sf::Keyboard::Key& key,int type) : _type(type)
{
_event.type = sf::Event::EventType::KeyPressed;
Expand All @@ -38,16 +33,6 @@ namespace book

switch(event.type)
{
/*case sf::Event::EventType::TextEntered:
{
if(_event.type == sf::Event::EventType::TextEntered)
res = event.text.unicode == _event.text.unicode;
}break;
case sf::Event::EventType::MouseWheelMoved:
{
if(_event.type == sf::Event::EventType::MouseWheelMoved)
res = event.mouseWheel.delta == _event.mouseWheel.delta;
}break;*/
case sf::Event::EventType::KeyPressed:
{
if(_type & Type::Pressed and _event.type == sf::Event::EventType::KeyPressed)
Expand All @@ -68,20 +53,7 @@ namespace book
if(_type & Type::Released and _event.type == sf::Event::EventType::MouseButtonPressed)
res = event.mouseButton.button == _event.mouseButton.button;
}break;
/*case sf::Event::EventType::JoystickButtonPressed:
{
if(_type & Type::Pressed and _event.type == sf::Event::EventType::JoystickButtonPressed)
res = event.joystickButton.button == _event.joystickButton.button;
}break;
case sf::Event::EventType::JoystickButtonReleased:
{
if(_type & Type::Releaseed and _event.type == sf::Event::EventType::JoystickButtonPressed)
res = event.joystickButton.button == _event.joystickButton.button;
}break;*/
default: break;
/*{
res = event.type == _event.type;
}break;*/
}
return res;
}
Expand All @@ -104,11 +76,6 @@ namespace book
if(_type & Type::Pressed)
res = sf::Mouse::isButtonPressed(_event.mouseButton.button);
}
/*else if (_event.type == sf::Event::EventType::JoystickButtonPressed)
{
if(_type & Type::Pressed)
res = sf::Joystick::isButtonPressed(0,_event.joystickButton.button);
}*/
return res;
}
}
3 changes: 0 additions & 3 deletions 03_Simple_2D_game/Tetris/include/SFML-Book/Piece.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,7 @@ namespace book
sf::Time getTimeSinceLastMove()const;



private:
//friend class Board;

const Tetrimino_Types _type; //< the piece type
short int _rotation; //< the piece rotaton

Expand Down
25 changes: 0 additions & 25 deletions 04_Physics/Basic/src/SFML-Book/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,31 +70,6 @@ int main(int argc,char* argv[])

bodies.emplace_back(book::create_box(world,400,590,800,20,b2_staticBody));

/*b2BodyDef bodyDef;
bodyDef.position.Set(book::converter::pixel_to_meters<double>(100),book::converter::pixel_to_meters<double>(100));
bodyDef.type = b2_dynamicBody;
b2PolygonShape b2shape;
b2shape.SetAsBox(book::converter::pixel_to_meters<double>(16),book::converter::pixel_to_meters<double>(16),
b2Vec2(book::converter::pixel_to_meters<double>(16),book::converter::pixel_to_meters<double>(16)),0);
b2Body* res = world.CreateBody(&bodyDef);
res->CreateFixture(&b2shape,1);
b2PolygonShape b2shape1;
b2shape1.SetAsBox(book::converter::pixel_to_meters<double>(16),book::converter::pixel_to_meters<double>(16),
b2Vec2(book::converter::pixel_to_meters<double>(48),book::converter::pixel_to_meters<double>(16)),0);
res->CreateFixture(&b2shape1,1);
sf::Shape* shape = new sf::RectangleShape(sf::Vector2f(32*2,32));
//shape->setOrigin(16,16);
shape->setPosition(sf::Vector2f(100,100));
shape->setFillColor(sf::Color::Red);
res->SetUserData(shape);*/


while(window.isOpen())
{
Expand Down
4 changes: 0 additions & 4 deletions 04_Physics/Gravitris/include/SFML-Book/Action.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@ namespace book
Action(const Action& other);
Action& operator=(const Action& other);

/*Action(const sf::Event& event,int type=Type::RealTime);
Action(sf::Event&& event,int type=Type::RealTime);
Action(const sf::Event::EventType& event,int type=Type::Pressed);*/
Action(const sf::Keyboard::Key& key,int type=Type::RealTime|Type::Pressed);
Action(const sf::Mouse::Button& button,int type=Type::RealTime|Type::Pressed);

Expand Down
1 change: 0 additions & 1 deletion 04_Physics/Gravitris/include/SFML-Book/ResourceManager.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ namespace book
}

//sf::Music special case

template<typename IDENTIFIER>
template<typename ... Args>
void ResourceManager<sf::Music,IDENTIFIER>::load(const IDENTIFIER& id,Args&& ... args)
Expand Down
33 changes: 0 additions & 33 deletions 04_Physics/Gravitris/src/SFML-Book/Action.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,6 @@ namespace book
return *this;
}

/*Action::Action(const sf::Event::EventType& event,int type) : _type(type)
{
_event.type = event;
}*/

Action::Action(const sf::Keyboard::Key& key,int type) : _type(type)
{
_event.type = sf::Event::EventType::KeyPressed;
Expand All @@ -38,16 +33,6 @@ namespace book

switch(event.type)
{
/*case sf::Event::EventType::TextEntered:
{
if(_event.type == sf::Event::EventType::TextEntered)
res = event.text.unicode == _event.text.unicode;
}break;
case sf::Event::EventType::MouseWheelMoved:
{
if(_event.type == sf::Event::EventType::MouseWheelMoved)
res = event.mouseWheel.delta == _event.mouseWheel.delta;
}break;*/
case sf::Event::EventType::KeyPressed:
{
if(_type & Type::Pressed and _event.type == sf::Event::EventType::KeyPressed)
Expand All @@ -68,20 +53,7 @@ namespace book
if(_type & Type::Released and _event.type == sf::Event::EventType::MouseButtonPressed)
res = event.mouseButton.button == _event.mouseButton.button;
}break;
/*case sf::Event::EventType::JoystickButtonPressed:
{
if(_type & Type::Pressed and _event.type == sf::Event::EventType::JoystickButtonPressed)
res = event.joystickButton.button == _event.joystickButton.button;
}break;
case sf::Event::EventType::JoystickButtonReleased:
{
if(_type & Type::Releaseed and _event.type == sf::Event::EventType::JoystickButtonPressed)
res = event.joystickButton.button == _event.joystickButton.button;
}break;*/
default: break;
/*{
res = event.type == _event.type;
}break;*/
}
return res;
}
Expand All @@ -104,11 +76,6 @@ namespace book
if(_type & Type::Pressed)
res = sf::Mouse::isButtonPressed(_event.mouseButton.button);
}
/*else if (_event.type == sf::Event::EventType::JoystickButtonPressed)
{
if(_type & Type::Pressed)
res = sf::Joystick::isButtonPressed(0,_event.joystickButton.button);
}*/
return res;
}
}
Loading

0 comments on commit 76b467f

Please sign in to comment.