本文整理汇总了C++中Net::initialise方法的典型用法代码示例。如果您正苦于以下问题:C++ Net::initialise方法的具体用法?C++ Net::initialise怎么用?C++ Net::initialise使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Net
的用法示例。
在下文中一共展示了Net::initialise方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _tmain
int _tmain(int argc, _TCHAR* argv[])
{
int result = EXIT_SUCCESS;
DOMConfigurator::configure("Log4cxxConfig.xml");
string input;
int playerPort;
int destPort;
int player = 0;
Player playerA = Player();
Player playerB = Player();
char W[200] = "W";
char A[200] = "A";
char S[200] = "S";
char D[200] = "D";
network.initialise();
//host or client for window title and for log.
char* applicationName;
applicationName = "Tag";
SMALL_RECT windowSize = {0, 0, SCREEN_WIDTH/2, SCREEN_HEIGHT/2};
SetConsoleWindowInfo(hConsole, TRUE, &windowSize);
bool gameOver = false;
Vector2f mapBoundries = Vector2f(SCREEN_WIDTH, SCREEN_HEIGHT);
RenderWindow renderWindow(VideoMode(SCREEN_WIDTH/2, SCREEN_HEIGHT, 32), applicationName);
renderWindow.SetFramerateLimit(30);
renderWindow.SetSize(SCREEN_WIDTH/2, SCREEN_HEIGHT);
Shape player1circle = sf::Shape::Circle(Vector2f(0,0), 20.0f, sf::Color::Blue);
Shape player2circle = sf::Shape::Circle(Vector2f(0,0), 20.0f, sf::Color::Red);
cout << "Are you player A or B?";
cin >> input;
if (input == "a" || input == "A")
{
player = 1;
playerPort = 28000;
destPort = 28001;
playerA.setPort(playerPort);
playerB.setPort(destPort);
network.setupUDP(28000,_ip);
LOG4CXX_INFO(loggerMyMain, "Player Binds A" );
}
else if (input == "b" || input == "B")
{
player = 2;
playerPort = 28001;
destPort = 28000;
playerA.setPort(destPort);
playerB.setPort(playerPort);
network.setupUDP(28001,_ip);
LOG4CXX_INFO(loggerMyMain, "Player Binds B" );
}
playerA.setPosition(sf::Vector2f(80,80));
playerB.setPosition(sf::Vector2f(120,120));
player1circle.SetPosition(playerA.getPosition());
player2circle.SetPosition(playerB.getPosition());
try
{
//While the connection is not closed remotely
while(renderWindow.IsOpened() && !gameOver)
{
Event sfmlEvent;
while (renderWindow.PollEvent(sfmlEvent))
{
// Close window : exit
if (sfmlEvent.Type == Event::Closed)
{
renderWindow.Close();
}
else if (sfmlEvent.Type == Event::KeyPressed)
{
if (sf::Keyboard::IsKeyPressed(sf::Keyboard::W))
{
if(player == 2)
{
playerA.update(1);
}
//.........这里部分代码省略.........