Hello, I am a novice programmer of C++. I would ask for an example of using lacewing in dev C++.
Edit@:
I have a little trouble with the compilation of the program.
http://img228.imageshack.us/img228/8649/lacewing.jpg
Printable View
Hello, I am a novice programmer of C++. I would ask for an example of using lacewing in dev C++.
Edit@:
I have a little trouble with the compilation of the program.
http://img228.imageshack.us/img228/8649/lacewing.jpg
Can I see your main.cpp? I'm not sure if you'll even be able to build it with Dev C++, since the lib file is MSVC. You might need to download VC++ 2008 Express.
simple console app:
Code:#include <stdio.h>
#include <lacewing.h>
using namespace std;
int main(int argc, char *argv[])
{
system("PAUSE");
return EXIT_SUCCESS;
}
I guess you'll have to download VC 2008 Express and try that.
I don't like VC. Can I try with Borland C++ Builder?
You can use whichever IDE you like providing you use the VC compiler.
If you're a novice programmer, you're better off keeping as many factors as you can constant. Switch to visual studio, you'll like it later and if you're building for Windows only then it will make your life much easier.
Ok I will change the compiler to VC but can I ask you for a list of available functions? or example of how to connect to server?
A list of functions? Try Lacewing.h ;)
Oh, of course thanks.
Quote:
Originally Posted by Rafae_Rosal
Obviously you don't need anywhere near that much code, but that example registers all of the possible handlers, which you'll find useful when you want to make your client do more.Code:#include <iostream>
using namespace std;
#include "Lacewing.h"
void HandlerConnect(Lacewing::Client &Client,const char * WelcomeMessage)
{
cout << "Connected!" << endl;
}
void HandlerConnectionDenied(Lacewing::Client &Client,Lacewing::DenyStatus::Type Reason)
{
}
void HandlerDisconnect(Lacewing::Client &Client)
{
}
void HandlerServerMessage(Lacewing::Client &Client,Lacewing::TransmissionMode::Type Mode,
int Subchannel, char * Buffer, int Size, int Type)
{
}
void HandlerChannelMessage(Lacewing::Client &Client,Lacewing::Client::Channel &Channel,
Lacewing::Client::Channel::Peer &Peer,Lacewing::TransmissionMode::Type Mode,
int Subchannel,char * Buffer, int Size, int Type)
{
}
void HandlerPeerMessage(Lacewing::Client &Client,Lacewing::Client::Channel &Channel,
Lacewing::Client::Channel::Peer &Peer,Lacewing::TransmissionMode::Type Mode,
int Subchannel,char * Buffer, int Size, int Type)
{
}
void HandlerError(Lacewing::Client &Client,Lacewing::Error &)
{
}
void HandlerJoin(Lacewing::Client &Client,Lacewing::Client::Channel &Target)
{
}
void HandlerJoinDenied(Lacewing::Client &Client,Lacewing::DenyStatus::Type Reason)
{
}
void HandlerLeave(Lacewing::Client &Client,Lacewing::Client::Channel &Target)
{
}
void HandlerLeaveDenied(Lacewing::Client &Client,Lacewing::Client::Channel &Target,
Lacewing::DenyStatus::Type Reason)
{
}
void HandlerNameSet(Lacewing::Client &Client)
{
}
void HandlerNameChanged(Lacewing::Client &Client,const char * OldName)
{
}
void HandlerNameDenied(Lacewing::Client &Client,Lacewing::DenyStatus::Type Reason)
{
}
void HandlerPeerConnect(Lacewing::Client &Client,Lacewing::Client::Channel &Channel,
Lacewing::Client::Channel::Peer &Peer)
{
}
void HandlerPeerDisconnect(Lacewing::Client &Client,Lacewing::Client::Channel &Channel,
Lacewing::Client::Channel::Peer &Peer)
{
}
void HandlerPeerChangeName(Lacewing::Client &Client,Lacewing::Client::Channel &Channel,
Lacewing::Client::Channel::Peer &Peer,const char * OldName)
{
}
void HandlerChannelListComplete(Lacewing::Client &Client)
{
}
void main()
{
Lacewing::Client Client;
Client.RegisterHandlerConnect(HandlerConnect);
Client.RegisterHandlerConnectionDenied(HandlerConnectionDenied);
Client.RegisterHandlerDisconnect(HandlerDisconnect);
Client.RegisterHandlerServerMessage(HandlerServerMessage);
Client.RegisterHandlerChannelMessage(HandlerChannelMessage);
Client.RegisterHandlerPeerMessage(HandlerPeerMessage);
Client.RegisterHandlerError(HandlerError);
Client.RegisterHandlerJoin(HandlerJoin);
Client.RegisterHandlerJoinDenied(HandlerJoinDenied);
Client.RegisterHandlerLeave(HandlerLeave);
Client.RegisterHandlerLeaveDenied(HandlerLeaveDenied);
Client.RegisterHandlerNameSet(HandlerNameSet);
Client.RegisterHandlerNameChanged(HandlerNameChanged);
Client.RegisterHandlerNameDenied(HandlerNameDenied);
Client.RegisterHandlerPeerConnect(HandlerPeerConnect);
Client.RegisterHandlerPeerDisconnect(HandlerPeerDisconnect);
Client.RegisterHandlerPeerChangeName(HandlerPeerChangeName);
Client.RegisterHandlerChannelListComplete(HandlerChannelListComplete);
Client.Connect("aquadasoft.com", 6121);
Lacewing::Utility::Pause(-1);
}
I did wrap the handler parameters onto two lines because this prehistoric forum software doesn't limit the width of a [code] section. Feel free to expand those again in VC.
Any particular reason you're using the C++ client library? Usually people are only interested in the server :)
Thanks, I'm curious so I am interested in server and client library.
I'm interested in the C++ part too, I'm working on a game using Irrlicht for the rendering, openal for the sound and I wanted to use lacewing for the networking stuff. Sadly the lack of actual documentation and/or examples put me off a little, but I'm hopeful this will be changed by the time I start working on the networking part. :)
It's pretty straightforward if you check the header file. I will get some docs put together eventually - it's just such a time consuming thing to do (Lacewing is a massive library).
Oh yes, I'm sure it takes a lot of work. Perhaps having someone else do it ? I'm sure it would be worth it, I think lacewing could be a nice alternative to raknet and other c++ networking libraries, it's a bit of a shame that it's only known around the klik community.
edit: I did check the header file, but still some examples without some examples and/or documentation it's hard to know how it all works- like you said lacewing is a huge library. :)