http://dl1.n3vgames.com/misc/TNISample_Nov_21.zip
This one includes the necessary assets; no other changes.
chris
This one includes the necessary assets; no other changes.
chris
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature currently requires accessing the site using the built-in Safari browser.
http://dl1.n3vgames.com/misc/TNISample_Nov_21.zip
This one includes the necessary assets; no other changes.
chris
I compiled the sample and moved the TNISample.dll in the same folder as TANE.exe, added the sample rule to a session but it doesn't seems to be working.
Is it something wrong with what I've done ?
It works for me, too. I also managed to attach Visual Studio debugger to the TANE process, set breakpoints and debug TNISample.cpp. All four functions were called in the expected order. Unfortunately, there is no pdb (symbol) file for the TNI classes declared in the header files. That would be quite helpful when debugging your own plugin.
I also found that the sample send TrainzScript message but I don't understand exactly how.
It seems to just store the name of the fonction (here PostMessage) and then use the TNICallLibraryFonction fonction. What does exactly do this and is it possible to do this with any TrainzScript fonction ?
It works for me, too. I also managed to attach Visual Studio debugger to the TANE process, set breakpoints and debug TNISample.cpp. All four functions were called in the expected order. Unfortunately, there is no pdb (symbol) file for the TNI classes declared in the header files. That would be quite helpful when debugging your own plugin.
What exactly are you seeing as missing in your debug view, that you expect to get from the PDB files?
One other thing: You have designed TNI to support non-OO plugin implementations.
Have you thought about any recommended pattern for the plugin developer to convert the procedural interface into an OO interface? The approach I would possibly take is do create a class that holds my implementation. Then manage it via a static std:map with the TNIContext* as the key and an instance of my class as the value. All static TNI function calls would be routed to member function calls, through a dispatcher that works with "delegates", presumably implemented as functors or lambda expressions. There are a number of options, some quick and dirty, some more elegant, and a guideline might be helpful to developers.
A minor detail: The sample introduces the usage of the platform-independent C++11 std::mutex class, but the sample explicitly calls its lock() and unlock() functions. While this is certainly fine for a "Hello World" type of application, it should not be done that way in production code. C++11 offers the the lock_guard class to handle mutexes. lock_guard implements the RAII programming idiom (an idiotic acronym and name, nobody would associate automatic release functionality with it). The C++ example in the Wikipedia article explains its features.