[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pingus-CVS] CVS: Games/Pingus/src collider.cxx,NONE,1.1 collider.hxx,N
From: |
torangan |
Subject: |
[Pingus-CVS] CVS: Games/Pingus/src collider.cxx,NONE,1.1 collider.hxx,NONE,1.1 mover.cxx,NONE,1.1 mover.hxx,NONE,1.1 |
Date: |
12 Feb 2003 22:43:40 -0000 |
Update of /usr/local/cvsroot/Games/Pingus/src
In directory dark:/tmp/cvs-serv7222
Added Files:
collider.cxx collider.hxx mover.cxx mover.hxx
Log Message:
added mover/collider implementations
--- NEW FILE: collider.cxx ---
// $Id: collider.cxx,v 1.1 2003/02/12 22:43:38 torangan Exp $
//
// Pingus - A free Lemmings clone
// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
//
// This program 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 2
// of the License, or (at your option) any later version.
//
// This program 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 this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "collider.hxx"
#include "col_map.hxx"
#include "vector.hxx"
#include "world.hxx"
Collider::Collider()
{
}
Collider::~Collider()
{
}
int Collider::getpixel(World* const world, const Vector& pos) const
{
return world->get_colmap()->getpixel(static_cast<int>(pos.x),
static_cast<int>(pos.y));
}
/* EOF */
--- NEW FILE: collider.hxx ---
// $Id: collider.hxx,v 1.1 2003/02/12 22:43:38 torangan Exp $
//
// Pingus - A free Lemmings clone
// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
//
// This program 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 2
// of the License, or (at your option) any later version.
//
// This program 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 this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef HEADER_PINGUS_COLLIDER_HXX
#define HEADER_PINGUS_COLLIDER_HXX
class Vector;
class World;
class Collider
{
public:
/** Constructor for abstract class */
Collider();
/** Destructor for abstract class */
virtual ~Collider() = 0;
/** Find out if a Pingu at the specified position is colliding with
something */
virtual bool operator() (World* const world, Vector pos) const = 0;
protected:
/** Get the Collision Map pixel at the specified position in the specified
world */
int getpixel(World* const world, const Vector& pos) const;
};
#endif
/* EOF */
--- NEW FILE: mover.cxx ---
// $Id: mover.cxx,v 1.1 2003/02/12 22:43:38 torangan Exp $
//
// Pingus - A free Lemmings clone
// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
//
// This program 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 2
// of the License, or (at your option) any later version.
//
// This program 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 this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "mover.hxx"
Mover::Mover(World* const world_arg, const Vector& pos_arg)
: world(world_arg),
pos(pos_arg),
remaining_move(0.0f, 0.0f, 0.0f),
collision(false)
{
}
Mover::~Mover ()
{
}
Vector Mover::get_pos() const
{
return pos;
}
Vector Mover::remaining() const
{
return remaining_move;
}
bool Mover::collided() const
{
return collision;
}
/* EOF */
--- NEW FILE: mover.hxx ---
// $Id: mover.hxx,v 1.1 2003/02/12 22:43:38 torangan Exp $
//
// Pingus - A free Lemmings clone
// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
//
// This program 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 2
// of the License, or (at your option) any later version.
//
// This program 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 this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef HEADER_PINGUS_MOVER_HXX
#define HEADER_PINGUS_MOVER_HXX
#include "vector.hxx"
class Collider;
class World;
class Mover
{
public:
/** Constructor of abstract class */
Mover(World* const world_arg, const Vector& pos_arg);
/** Destructor of abstract class */
virtual ~Mover() = 0;
/** Updates the position of the object taking into account collisions */
virtual void update(const Vector& move, const Collider& collider) = 0;
/** Get the resulting position vector */
Vector get_pos() const;
/** Get the move vector remaining after a collision */
Vector remaining() const;
/** Get whether object stopped moving because it collided with something */
bool collided() const;
protected:
/** World in which the object should move */
World* const world;
/** Position of the object to move */
Vector pos;
/** Move vector remaining after a collision */
Vector remaining_move;
/** Flag to denote whether object has had a collision */
bool collision;
};
#endif
/* EOF */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pingus-CVS] CVS: Games/Pingus/src collider.cxx,NONE,1.1 collider.hxx,NONE,1.1 mover.cxx,NONE,1.1 mover.hxx,NONE,1.1,
torangan <=
- Prev by Date:
[Pingus-CVS] CVS: Games/Pingus/src/movers Makefile.am,NONE,1.1 linear_mover.cxx,NONE,1.1 linear_mover.hxx,NONE,1.1
- Next by Date:
[Pingus-CVS] CVS: Games/Pingus/po POTFILES.in,1.28,1.29 de.po,1.18,1.19 it.po,1.4,1.5 nl.po,1.6,1.7 tr.po,1.6,1.7
- Previous by thread:
[Pingus-CVS] CVS: Games/Pingus/src/movers Makefile.am,NONE,1.1 linear_mover.cxx,NONE,1.1 linear_mover.hxx,NONE,1.1
- Next by thread:
[Pingus-CVS] CVS: Games/Pingus/po POTFILES.in,1.28,1.29 de.po,1.18,1.19 it.po,1.4,1.5 nl.po,1.6,1.7 tr.po,1.6,1.7
- Index(es):