I figured playing with and breaking the examples was probably a good way to learn, but all I seem to do is break them so far ... I added this code to the helloworld app, before int main()
Code: Select all
IAnimatedMesh* mesh = 0;
IAnimatedMeshSceneNode* node = 0;
class MyEventReceiver : public IEventReceiver
{
public:
virtual bool OnEvent(SEvent event)
{
core::vector3df v = mesh->getPosition() + 3.0f;
if(event.KeyInput.Key == KEY_KEY_W) { mesh->setPosition(v); }
return true;
}
}
Code: Select all
mesh = smgr->getMesh("../../media/sydney.md2");
node = smgr->addAnimatedMeshSceneNode( mesh );
Code: Select all
--------------------Configuration: HelloWorld - Win32 Debug--------------------
Compiling...
main.cpp
c:\irrlicht-0.6\examples\1.helloworld\main.cpp(89) : error C2628: 'MyEventReceiver' followed by 'int' is illegal (did you forget a ';'?)
c:\irrlicht-0.6\examples\1.helloworld\main.cpp(206) : error C2664: '__thiscall MyEventReceiver::MyEventReceiver(const class MyEventReceiver &)' : cannot convert parameter 1 from 'const int' to 'const class MyEventReceiver &'
Reason: cannot convert from 'const int' to 'const class MyEventReceiver'
No constructor could take the source type, or constructor overload resolution was ambiguous
c:\irrlicht-0.6\examples\1.helloworld\main.cpp(206) : error C2553: no legal conversion of return value to return type 'class MyEventReceiver *'
c:\irrlicht-0.6\examples\1.helloworld\main.cpp(207) : warning C4508: 'main' : function should return a value; 'void' return type assumed
Error executing cl.exe.
HelloWorld.exe - 3 error(s), 1 warning(s)