/*Copyright (C) 2010-2012 Duncan Deveaux

This file is part of Hikou no mizu.

Hikou no mizu is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

Hikou no mizu is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with Hikou no mizu.  If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef DEF_PHYSICS_OBJECT
#define DEF_PHYSICS_OBJECT

#include "PhysicsWorld.hpp"

class PhysicsRoutines;

class PhysicsObject
{
    public:
        PhysicsObject();
        
        void setPhysicsWorld(PhysicsWorld &physicsWorld);
        const PhysicsWorld &getPhysicsWorld() const;
        
        void setPosition(float xPosition, float yPosition);
        void moveXPosition(float distance, bool push = false);
        void moveYPosition(float distance, bool push = false);
        
        void setWidth(float width, bool reverseSide = false);
        void setHeight(float height, bool reverseSide = false);
        
        void setFixed(bool fixed);
        bool isFixed() const;
        
        bool isOnGround();
        const Box &getBox() const;
        
        virtual void takeAHit(float strength, int side) = 0;
    
    protected:
        std::vector<PhysicsObject*> hitTest();
        std::vector<PhysicsObject*> hitTest(const Box &box);
        
        PhysicsWorld *m_physicsWorld;
        
        Box m_box;
        bool m_fixed;
};

#endif
