I'm currently trying to use the Badumna Network Suite (
http://www.scalify.com) with Esenthel. I'll post my findings in this thread.
I will refer to the place where you installed the api as {api}
1. Compile the API
You start with downloading the C++ api. You will have to compile it yourself. There is a VS2010 solution provided and it was easily converted to VS2012.
You will find that the release project properties are not set. You can look at the debug one and fill in mostly the same with release, except for the obvious differences like optimalisation and such. One thing you should change is the Runtime Library. Set it to /MT if you want to add badumna to an esenthel project.
Building the debug version will result in the BadumnaCpp.lib file in {api}/Source/MSVC/2012/Debug.
2. Setup a test project
I started a new Esenthel 1.0 project by copying the tutorial solution. (I did not work with 2.0 yet because i got an 'access denied' error when adding the badumna header files to my application. Will have to sort that out later.)
In the folder of my esenthel test program (if you copy the tutorial setting this will be the main folder of your solution) I added Badumna.dll, Dei.dll and mono-2.0.dll. You will find those in {api}/Source/libs.
You will also have to copy the folder Mono-2.8.1 to your program directory and call it mono. (The name change is important!)
In your project's properties page, add {api}\Source to Additional Include Directories.
For the linker, add {api}\Source\MSVC\2010\Debug to additional library directories. To Additional Dependencies you will have to add BadumnaCpp.lib
The code below will initialize and shutdown badumna networking:
PHP Code:
#include "Badumna/Core/NetworkFacade.h"
#include "Badumna/Core/RuntimeInitializer.h"
#include "Badumna/Configuration/Options.h"
#include "stdafx.h"
Str message;
void StartBadumna() {
Badumna::Options options;
options.GetConnectivityModule().SetStartPortRange(21300);
options.GetConnectivityModule().SetEndPortRange(21399);
options.GetConnectivityModule().SetMaxPortsToTry(3);
options.GetConnectivityModule().EnableBroadcast();
options.GetConnectivityModule().SetBroadcastPort(21250);
options.GetConnectivityModule().ConfigureForLan();
options.GetConnectivityModule().SetApplicationName(L"CppApiExample0");
std::auto_ptr<Badumna::NetworkFacade> facade(Badumna::NetworkFacade::Create(options));
if(!facade->Login())
{
// failed to login to the badumna network
message = S + "failed to login to the badumna network.";
return;
}
facade->Shutdown();
message = S + "All is well.";
}
void InitPre()
{
App.name("Start");
Paks.add("data/engine.pak");
}
Bool Init()
{
Badumna::BadumnaRuntimeInitializer initializer;
StartBadumna();
return true;
}
void Shut()
{
}
Bool Update()
{
if(Kb.bp(KB_ESC))return false;
return true;
}
void Draw()
{
D.clear(TURQ);
D.text (0, 0.1f, message);
}
That's it for now. I'll be back with more later.