我有一个
在没有活动异常的情况下终止被调用
使用
启动程序时int main()
{
return (0);
}
当我从编辑中删除 Player.cpp 时再次启动它可以正常工作。
// Player.hh
# include "AObject.hh"
# include <Model.hh>
namespace Graphic
{
enum ePlayerType
{
PLAYER1,
PLAYER2,
BOT
};
class Player : public AObject
{
private:
ePlayerType _type;
gdl::Model _skin;
public:
Player() {};
virtual ~Player() {};
virtual bool initialize(const std::string &);
virtual void update(const gdl::Clock &, gdl::Input &);
virtual void draw(gdl::AShader &, const gdl::Clock &);
ePlayerType getType() const;
void setType(ePlayerType);
};
};
// Player.cpp
# include "Player.hh"
bool Graphic::Player::initialize(const std::string &texture)
{
if (_skin.load(texture))
{
std::cerr << "Failed to load " << texture << std::endl;
return false;
}
return true;
}
void Graphic::Player::update(const gdl::Clock &clock, gdl::Input &input)
{
static_cast<void>(clock);
static_cast<void>(input);
}
void Graphic::Player::draw(gdl::AShader &shader, const gdl::Clock &clock)
{
shader.bind();
_skin.draw(shader, getTransformation(), clock.getElapsed());
}
Graphic::ePlayerType Graphic::Player::getType() const
{
return _type;
}
void Graphic::Player::setType(Graphic::ePlayerType type)
{
_type = type;
}
我想知道我的实现是否不正确以及如何解决此问题。 感谢