Conversion not quite right....

Irrlicht.Net is no longer developed or supported, Irrlicht.Net Cross Platform is a much more complete wrapper. Please ask your C# related questions on their forums first.

Conversion not quite right....

Postby blewisjr » Mon Sep 12, 2005 4:42 am

Ok I am bored so I decided to try and convert the C# irrlicht.net code HelloWorld to C++/CLI. However, when I got done I got about 8 conversion errors dealing with the int's and vectors. Take a look maybe I am doing something wrong lol.

Code: Select all
#using<....Excluded path for security reasons....Irrlicht.NET.dll>
#using<System.dll>

using namespace Irrlicht;
using namespace Irrlicht::Video;
using namespace Irrlicht::Core;
using namespace Irrlicht::Scene;
using namespace System;

int main()
{
   IrrlichtDevice^ device = gcnew IrrlichtDevice(DriverType::OPENGL);

   device->ResizeAble = true;
   device->WindowCaption = "Irrlicht.Net using C++/CLI";

   ITexture^ texSydney = device->VideoDriver->GetTexture("..\\..\\media\\sydney.bmp");
   ITexture^ texWall = device->VideoDriver->GetTexture("..\\..\\media\\wall.bmp");
   ITexture^ texLogo = device->VideoDriver->GetTexture("..\\..\\media\\irrlichtlogoaligned.jpg");

   Irrlicht::Scene::IAnimatedMesh^ mesh = device->SceneManager->GetMesh("..\\..\\media\\sydney.md2");

   if(mesh == nullptr)
   {
      Console::WriteLine("Could not load mesh");
      return 1;
   }

   ICameraSceneNode^ cam = device->SceneManager->AddCameraSceneNode(nullptr, 100, 100, -1);
   cam->Position = gcnew Vector3D(20,0,-50);

   ISceneNode^ node = device->SceneManager->AddTestSceneNode(15,
            nullptr, -1, gcnew Vector3D(30,-15,0));
   node->SetMaterialTexture(0, texWall);

   node = device->SceneManager->AddAnimatedMeshSceneNode(mesh, nullptr, -1);
   node->SetMaterialTexture(0, texSydney);
   node->SetMaterialFlag(MaterialFlag->LIGHTING, false);

   device->CursorControl->Visible = false;

   int fps = 0;

   while(device->Run())
   {
      if (device->WindowActive)
      {
         device->VideoDriver->BeginScene(true, true, gcnew Color(0,100,100,100));

         device->SceneManager->DrawAll();
            
         // draw the logo
         device->VideoDriver->Draw2DImage(
            texLogo, gcnew Position2D(10,10),
            gcnew Rect(0,0,88,31),
            gcnew Rect(gcnew Position2D(0,0),device->VideoDriver->ScreenSize),
            gcnew Color(0xffffff), false);

         device->VideoDriver->EndScene();

         if (fps != device->VideoDriver->FPS)
         {
            fps = device->VideoDriver->FPS;
            device->WindowCaption = "Irrlicht.NET C++/CLI example 01 - Hello World ["+
               device->VideoDriver->Name + "] fps:" + fps;
         }
      }
   }
}
blewisjr
 

Postby blewisjr » Mon Sep 12, 2005 4:44 am

sorry I am not registered here are the errors

1>------ Build started: Project: IrrlichtTest, Configuration: Debug Win32 ------
1>Compiling...
1>main.cpp
1>.\main.cpp(29) : error C2664: 'Irrlicht::Scene::ISceneManager::AddCameraSceneNode' : cannot convert parameter 2 from 'int' to 'Irrlicht::Core::Vector3D'
1> No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
1>.\main.cpp(30) : error C2664: 'Irrlicht::Scene::ISceneNode::Position::set' : cannot convert parameter 1 from 'Irrlicht::Core::Vector3D ^' to 'Irrlicht::Core::Vector3D'
1> No user-defined-conversion operator available, or
1> No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
1>.\main.cpp(33) : error C2664: 'Irrlicht::Scene::ISceneNode ^Irrlicht::Scene::ISceneManager::AddTestSceneNode(float,Irrlicht::Scene::ISceneNode ^,int,Irrlicht::Core::Vector3D)' : cannot convert parameter 4 from 'Irrlicht::Core::Vector3D ^' to 'Irrlicht::Core::Vector3D'
1> No user-defined-conversion operator available, or
1> No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
1>.\main.cpp(38) : error C2275: 'Irrlicht::Video::MaterialFlag' : illegal use of this type as an expression
1> c:\irrlicht-0.12.0\bin\win32-visualstudio\irrlicht.net.dll : see declaration of 'Irrlicht::Video::MaterialFlag'
1>.\main.cpp(38) : error C2039: 'LIGHTING' : is not a member of 'System::Enum'
1> c:\windows\microsoft.net\framework\v2.0.50215\mscorlib.dll : see declaration of 'System::Enum'
1>.\main.cpp(48) : error C2664: 'Irrlicht::Video::IVideoDriver::BeginScene' : cannot convert parameter 3 from 'Irrlicht::Video::Color ^' to 'Irrlicht::Video::Color'
1> No user-defined-conversion operator available, or
1> No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
1>.\main.cpp(56) : error C2664: 'Irrlicht::Core::Rect::Rect(Irrlicht::Core::Position2D,Irrlicht::Core::Dimension2D)' : cannot convert parameter 1 from 'Irrlicht::Core::Position2D ^' to 'Irrlicht::Core::Position2D'
1> No user-defined-conversion operator available, or
1> No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
1>.\main.cpp(56) : fatal error C1903: unable to recover from previous error(s); stopping compilation
blewisjr
 

Postby blewisjr » Mon Sep 12, 2005 10:52 am

Ok i fixed a few of the errors I beleive but now I have errors that make no sense. It is down to 5 now.

Errors:

1>------ Build started: Project: IrrlichtTest, Configuration: Debug Win32 ------
1>Compiling...
1>main.cpp
1>.\main.cpp(31) : error C2664: 'Irrlicht::Scene::ISceneManager::AddCameraSceneNode' : cannot convert parameter 2 from 'Irrlicht::Core::Vector3D ^' to 'Irrlicht::Core::Vector3D'
1> No user-defined-conversion operator available, or
1> No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
1>.\main.cpp(34) : error C2664: 'Irrlicht::Scene::ISceneNode ^Irrlicht::Scene::ISceneManager::AddTestSceneNode(float,Irrlicht::Scene::ISceneNode ^,int,Irrlicht::Core::Vector3D)' : cannot convert parameter 4 from 'Irrlicht::Core::Vector3D ^' to 'Irrlicht::Core::Vector3D'
1> No user-defined-conversion operator available, or
1> No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
1>.\main.cpp(49) : error C2664: 'Irrlicht::Video::IVideoDriver::BeginScene' : cannot convert parameter 3 from 'Irrlicht::Video::Color ^' to 'Irrlicht::Video::Color'
1> No user-defined-conversion operator available, or
1> No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
1>.\main.cpp(57) : error C2664: 'Irrlicht::Core::Rect::Rect(Irrlicht::Core::Position2D,Irrlicht::Core::Dimension2D)' : cannot convert parameter 1 from 'Irrlicht::Core::Position2D ^' to 'Irrlicht::Core::Position2D'
1> No user-defined-conversion operator available, or
1> No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
1>.\main.cpp(57) : fatal error C1903: unable to recover from previous error(s); stopping compilation


Code: Select all
#using<............Irrlicht.NET.dll>
#using<System.dll>

using namespace Irrlicht;
using namespace Irrlicht::Video;
using namespace Irrlicht::Core;
using namespace Irrlicht::Scene;
using namespace System;

int main()
{
   IrrlichtDevice^ device = gcnew IrrlichtDevice(DriverType::OPENGL);

   device->ResizeAble = true;
   device->WindowCaption = "Irrlicht.Net using C++/CLI";

   ITexture^ texSydney = device->VideoDriver->GetTexture("..\\..\\media\\sydney.bmp");
   ITexture^ texWall = device->VideoDriver->GetTexture("..\\..\\media\\wall.bmp");
   ITexture^ texLogo = device->VideoDriver->GetTexture("..\\..\\media\\irrlichtlogoaligned.jpg");

   Irrlicht::Scene::IAnimatedMesh^ mesh = device->SceneManager->GetMesh("..\\..\\media\\sydney.md2");

   if(mesh == nullptr)
   {
      Console::WriteLine("Could not load mesh");
      return 1;
   }

   ICameraSceneNode^ cam = device->SceneManager->AddCameraSceneNode(nullptr,
      gcnew Vector3D((float)20,(float)0,(float)-50),
      gcnew Vector3D(), -1);

   ISceneNode^ node = device->SceneManager->AddTestSceneNode(15,
            nullptr, -1, gcnew Vector3D((float)30,(float)-15,(float)0));
   node->SetMaterialTexture(0, texWall);

   node = device->SceneManager->AddAnimatedMeshSceneNode(mesh, nullptr, -1);
   node->SetMaterialTexture(0, texSydney);
   node->SetMaterialFlag(MaterialFlag::LIGHTING, false);

   device->CursorControl->Visible = false;

   int fps = 0;

   while(device->Run())
   {
      if (device->WindowActive)
      {
         device->VideoDriver->BeginScene(true, true, gcnew Color(0,100,100,100));

         device->SceneManager->DrawAll();
            
         // draw the logo
         device->VideoDriver->Draw2DImage(
            texLogo, gcnew Position2D(10,10),
            gcnew Rect(0,0,88,31),
            gcnew Rect(gcnew Position2D(0,0),device->VideoDriver->ScreenSize),
            gcnew Color(0xffffff), false);

         device->VideoDriver->EndScene();

         if (fps != device->VideoDriver->FPS)
         {
            fps = device->VideoDriver->FPS;
            device->WindowCaption = "Irrlicht.NET C++/CLI example 01 - Hello World ["+
               device->VideoDriver->Name + "] fps:" + fps;
         }
      }
   }
}
blewisjr
 


Return to Irrlicht.NET

Who is online

Users browsing this forum: No registered users and 1 guest