Historique des modifications - Message

Message #10011

Sujet: Animation football


Type Date Auteur Contenu
Dernière modification 02-06-2011 07:31:56 defrgly
Voici une partie de mon code.
J'ai bien render dans mon .h mais pas dans mon .cpp

Merci pour ton aide en tout cas.

Code c++ :

player.h


[...]
class Player : public IAnimatedMeshSceneNode
{
    public:
		Player(); // Constructeur
		Player(int x,int z); // Constructeur
		void move(int x, int z);
		void rotate(int x, int z);
		virtual void render();
		virtual const aabbox3d<float>& getBoundingBox() const;
		virtual ISceneNode* clone(ISceneNode* newParent=0, ISceneManager* newManager=0);
		[...]
		virtual void animateJoints(bool CalculateAbsolutePositions=true);
		virtual void setRenderFromIdentity( bool On );

    private:
        IAnimatedMeshSceneNode* node;

};
[...]




Code c++ :

player.cpp


#include "Player.h"

Player::Player()
{
	IAnimatedMeshSceneNode *node = smgr->addAnimatedMeshSceneNode(mesh);
	node->setMaterialFlag(EMF_LIGHTING, false);
	node->setMaterialTexture( 0, driver->getTexture("../../media/sydney.bmp") );
	node->setMD2Animation(scene::EMAT_RUN);
	node->setPosition(vector3df(0,0,0));
	node->setRotation(vector3df(0,0,0));
}

Player::Player(x,z)
{
	IAnimatedMeshSceneNode *node = smgr->addAnimatedMeshSceneNode(mesh);
	node->setMaterialFlag(EMF_LIGHTING, false);
	node->setMaterialTexture( 0, driver->getTexture("../../media/sydney.bmp") );
	node->setMD2Animation(scene::EMAT_RUN);
	node->setPosition(vector3df(x,0,z));
	node->setRotation(vector3df(0,0,0));
}


void Player::move(int x, int z)
{
    node->setPosition(vector3df(x,0,z));
}

void Player::rotate(int x, int y, int z)
{
    node->setRotation(vector3df(x,y,z));
}




Code c++ :

main.cpp


[...]
int main(int argc, char *argv[])
{
	IrrlichtDevice *device = createDevice(video::EDT_OPENGL,dimension2d<u32>(640, 480),16,false,false,false,0);

	if (!device)
		return 1;

	device->setWindowCaption(L"Anim Foot");

	IVideoDriver *driver = device->getVideoDriver();
	ISceneManager *smgr = device->getSceneManager();
	IGUIEnvironment *guienv = device->getGUIEnvironment();

	guienv->addStaticText(L"OM - PSG", rect<s32>(10,10,260,22), true);

	IAnimatedMesh *mesh = smgr->getMesh("../../media/sydney.md2");
	if (!mesh)
	{
		device->drop();
		return 1;
	}
	Player joueur1();
}
[...]
Création du message 01-06-2011 19:22:24 defrgly
Voici une partie de mon code.
J'ai bien render dans mon .h mais pas dans mon .cpp

Merci pour ton aide en tout cas.

Code c++ :

player.h


[...]
class Player : public IAnimatedMeshSceneNode
{
    public:
		Player(); // Constructeur
		Player(int x,int z); // Constructeur
		void move(int x, int z);
		void rotate(int x, int z);
		virtual void render();
		virtual const aabbox3d<float>& getBoundingBox() const;
		virtual ISceneNode* clone(ISceneNode* newParent=0, ISceneManager* newManager=0);
		[...]
		virtual void animateJoints(bool CalculateAbsolutePositions=true);
		virtual void setRenderFromIdentity( bool On );

    private:
        IAnimatedMeshSceneNode* node;

};
[...]




Code c++ :

player.cpp


#include "Player.h"

Player::Player()
{
	IAnimatedMeshSceneNode *node = smgr->addAnimatedMeshSceneNode(mesh);
	node->setMaterialFlag(EMF_LIGHTING, false);
	node->setMaterialTexture( 0, driver->getTexture("../../media/sydney.bmp") );
	node->setMD2Animation(scene::EMAT_RUN);
	node->setPosition(vector3df(0,0,0));
	node->setRotation(vector3df(0,0,0));
}

Player::Player(x,z)
{
	IAnimatedMeshSceneNode *node = smgr->addAnimatedMeshSceneNode(mesh);
	node->setMaterialFlag(EMF_LIGHTING, false);
	node->setMaterialTexture( 0, driver->getTexture("../../media/sydney.bmp") );
	node->setMD2Animation(scene::EMAT_RUN);
	node->setPosition(vector3df(x,0,z));
	node->setRotation(vector3df(0,0,0));
}


void Player::move(int x, int z)
{
    node->setPosition(vector3df(x,0,z));
}

void Player::rotate(int x, int y, int z)
{
    node->setRotation(vector3df(x,y,z));
}




Code c++ :

main.cpp


[...]
int main(int argc, char *argv[])
{
	IrrlichtDevice *device = createDevice(video::EDT_OPENGL,dimension2d<u32>(640, 480),16,false,false,false,0);

	if (!device)
		return 1;

	device->setWindowCaption(L"Anim Foot");

	IVideoDriver *driver = device->getVideoDriver();
	ISceneManager *smgr = device->getSceneManager();
	IGUIEnvironment *guienv = device->getGUIEnvironment();

	guienv->addStaticText(L"OM - PSG", rect<s32>(10,10,260,22), true);

	IAnimatedMesh *mesh = smgr->getMesh("../../media/sydney.md2");
	if (!mesh)
	{
		device->drop();
		return 1;
	}
	Player joueur1();
}
[...]

Retour

Options Liens officiels Caractéristiques Statistiques Communauté
Préférences cookies
Corrections
irrlicht
irrklang
irredit
irrxml
Propulsé par Django
xhtml 1.0
css 2.1
884 membres
1440 sujets
11337 messages
Dernier membre inscrit: Saidov17
157 invités en ligne
membre en ligne: -
RSS Feed