Jump to content
  • Advertisement
Sign in to follow this  
TheNobleOne

[.net] Some conversion problems

This topic is 4810 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am messing around with trying to get Irrlicht.Net to work with C++/CLI using VSC++ Express beta 2. I ran into a few problems I can't seem to work out. Here are the errors. It just can't quite figure out how to fix the errors as I don't see how the object itself can't convert to itself lol. 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 Here is my code.
#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;
         }
      }
   }
}


Share this post


Link to post
Share on other sites
Advertisement
Ok never mind I got it to build. I had to change the way I did a few things. Now the only problem I have is a file not found exception when I run the code. Not shure why because the directory is there.


#using<C:\irrlicht-0.12.0\bin\Win32-VisualStudio\Irrlicht.NET.dll>
#using<System.dll>
#using<System.Windows.Forms.dll>

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

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

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

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

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

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

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

ISceneNode^ node = device->SceneManager->AddTestSceneNode(15,
nullptr, -1, Core::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, Video::Color(0,100,100,100));

device->SceneManager->DrawAll();

// draw the logo
device->VideoDriver->Draw2DImage(
texLogo, Core::Position2D(10,10),
Core::Rect(0,0,88,31),
Core::Rect(Core::Position2D(0,0),device->VideoDriver->ScreenSize),
Video::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;
}
}
}
}

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!