I’m testing using the Irrlicht Engine within haxe (extern classes) and it is working when I target for Cpp without Lime or OpenFL. Now I want to be able to still target Android, so I would like to use Lime, but of course there’s a problem because Lime is starting a Window first and includes SDL2 stuff.
How could I work around this, is it e.g. possible to dispose the Lime Window or better to just start Lime as a console application?
Try overriding create in your Application class, and don’t do the createWindow step, or just remove the windows field from the config and call the super.create method
Another idea (if the features exist) is to look at making a Lime backend based on Irrlicht, Lime is not 100% tied to SDL, it’s just the backend we have supported for desktop development so far
Now I have another problem. Because of Irrlicht seems to be outdated and not easy to port to android and iOS i tried out Urho3D. But I got problems with libraries used by haxe too.
link.exe -out:Main.exe -nologo -machine:x86 -subsystem:console,5.01 -libpath:lib user32.lib @C:/Users/mighty/haxeProjekte/UrhoCpp/bin/obj/msvc16xp/all_objs C:\Users\mighty\Urho3D\build_windows\lib\Urho3d.lib
MSVCRT.lib(MSVCR100.dll) : error LNK2005: _memmove already defined in LIBCMT.lib(memmove.obj)
Can you point me in the right direction? Unfortunately I’m very unaware with cpp and library stuff.
The issue i think is that you are mixing and matching static and non-static versions of libs. I cant say which of course without knowing the project, but it seems that since you have a Irrlicht.dll mentioned above you are then trying to statically link lime. Im not sure how you tell lime to not link statically, but im sure josh can clear that up easily.
Thanks for the reply. Irrlicht is running without problems, I tried a simple demo scene with some boxes and there are no problems. But thats another story with Urho3D. It seems to use libraries that haxe is using too (I tried a non lime cpp only target to be sure the conflict doesn’t come from lime/Urho3D.)
Now I will try a single threaded Urho3D build, maybe that leads to the error.
The link you provided shows exactly my problem, but as a cpp noob I don’t know how to resolve it, but maybe I get it.
Yeah, i mean im sure the issue is a mismatch in static and non-static versions of libs, but not sure which is the culprit or what you build options are. If in general you are using other things as dlls, then you should use lime as a dll also, same in reverse, if everything is statically linked then so should lime be.
Again, im sure Joshua can quickly clear up how to statically (or not statically) link lime to your app
libcmt is statically linked multithreaded version of c runtime. If You are building Urho3d from sources, try passing /MD while rebuilding Urho.dll (instead of /MT, which should be somewhere in the linker arguments).
BTW - how did You added Irrlicht to lime? Since I am poor at haxe yet, I don’t know how it could be made (linking with other libs). Could You explain a little bit of this?
package;
import haxe.Timer;
import lime.app.Application;
import lime.app.Config;
import Irrlicht;
class Main extends Application
{
public function new()
{
super();
}
override public function create(config:Config)
{
config.windows = [];
super.create(config);
// 5 seconds delay that you see that not lime but irrlicht makes the window
trace("lime started without window ...");
Timer.delay(function() {_startDemo(); }, 5000);
}
private function _startDemo()
{
trace("creating Irrlicht Device");
var device = Irr.createDevice(Irr.EDT_OPENGL);
var driver = device.value.getVideoDriver();
var smgr = device.value.getSceneManager();
//var gui = device.value.getGUIEnvironment();
var frames = 0;
while (device.value.run())
{
frames++;
driver.value.beginScene();
smgr.value.drawAll();
//gui.value.drawAll(); not working, don't know why
driver.value.endScene();
// exit after some seconds ...
if (frames == 60 * 100) break;
}
Sys.exit(0);
}
}
Irrlicht.hx -> file with bindings for the irrlicht.dll
package;
import cpp.Pointer;
// build xml includes headers and .libs
` @:buildXml("<files id='haxe'><compilerflag value='-IC:\\cppdev\\include'/></files><target id='haxe'><lib name='C:\\cppdev\\lib\\Win32-visualstudio\\Irrlicht.lib'/></target>")`
@:include("irrlicht.h")
@:structAccess
@:unreflective
extern class Irr
{
@:native("irr::createDevice")
public static function createDevice(driverType:EDriverType):Pointer<IrrlichtDevice>;
@:native("irr::video::EDT_OPENGL")
public static var EDT_OPENGL:EDriverType;
}
@:include("irrlicht.h")
@:native("irr::video::E_DRIVER_TYPE")
@:structAccess
@:unreflective
extern class EDriverType
{
}
@:include("IrrlichtDevice.h")
@:native("irr::IrrlichtDevice")
@:structAccess
@:unreflective
extern class IrrlichtDevice
{
public function run():Bool;
public function getVideoDriver():Pointer<IVideoDriver>;
public function getSceneManager():Pointer<ISceneManager>;
//public function getGUIEnvironment():Pointer<IGUIEnvironment>;
//public function setWindowCaption(str:Dynamic):Void;
}
@:include("IVideoDriver.h")
@:native("irr::video::IVideoDriver")
@:structAccess
@:unreflective
extern class IVideoDriver
{
public function beginScene(backBuffer:Bool = true, zBuffer:Bool = true/*, SColor color=SColor(255,0,0,0), const SExposedVideoData& videoData=SExposedVideoData(), core::rect<s32>* sourceRect=0)*/):Void;
public function endScene():Void;
}
@:include("ISceneManager.h")
@:native("irr::scene::ISceneManager")
@:structAccess
@:unreflective
extern class ISceneManager
{
public function drawAll():Void;
}
// doesn't work
/*
@:include("IGUIEnvironment.h")
@:native("irr::gui::IGUIEnvironment*")
@:structAccess
@:unreflective
extern class IGUIEnvironment
{
public function drawAll():Void;
}*/
I used a dll file here, but you don’t have to. Just compile Irrlicht as a .lib (i think that’s working).
It’s just a black window. I made a small cpp lib that sets up some boxes because it was easier to set up with cpp than to convert the code to haxe. But you can do it all with haxe too. Just a start point.