This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// TestMessage.hpp | |
// UDPTEST | |
// | |
// Created by Christian Hohlfeld on 16.09.18. | |
// | |
#ifndef TestMessage_hpp | |
#define TestMessage_hpp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Physics.cpp | |
// UDPTEST | |
// | |
// Created by Christian Hohlfeld on 22.09.18. | |
// | |
#include "Physics.h" | |
#include <cocos2d.h> | |
using namespace cocos2d; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Physics.h | |
// UDPTEST | |
// | |
// Created by Christian Hohlfeld on 22.09.18. | |
// | |
#ifndef Physics_h | |
#define Physics_h | |
#include "Box2D/Box2D.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
double cTime = 100.0f; | |
uint64_t clientId = 0; | |
const double deltaTime = 0.01f; | |
void HelloWorld::initClient() { | |
GameAdapter gameAdapter = GameAdapter(&GetDefaultAllocator()); | |
random_bytes((uint8_t*)&clientId, 8); | |
log("client id is %.16" PRIx64 "\n", clientId); | |
yojimbo::Address* clientAddress = new Address(localProperties.GetProperty("CLIENT_IP_ADDRESS").c_str()); //TODO: delete | |
GameConnectionConfig config; | |
client = new GameClient(GetDefaultAllocator(), clientAddress, gameAdapter, config, cTime); // TODO: delete |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
double sTime = 100.0f; | |
void HelloWorld::initServer() { | |
GameConnectionConfig config; | |
yojimbo::Address* serverAddress = new Address(localProperties.GetProperty("SERVER_IP_ADDRESS").c_str(), 4000); //TODO: delete | |
server = new GameServer(GetDefaultAllocator(), serverAddress, adapter, config, sTime);//TODO: delete | |
server->Start(); | |
char addressString[256]; | |
server->GetAddress().ToString(addressString, sizeof(addressString)); | |
log("server address is %s\n", addressString); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
double sTime = 100.0f; | |
void HelloWorld::initServer() { | |
GameConnectionConfig config; | |
yojimbo::Address* serverAddress = new Address(localProperties.GetProperty("SERVER_IP_ADDRESS").c_str(), 4000); | |
server = new GameServer(GetDefaultAllocator(), serverAddress, adapter, config, sTime); | |
server->Start(); | |
char addressString[256]; | |
server->GetAddress().ToString(addressString, sizeof(addressString)); | |
log("server address is %s\n", addressString); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
double cTime = 100.0f; | |
uint64_t clientId = 0; | |
const double deltaTime = 0.01f; | |
void HelloWorld::initClient() { | |
GameAdapter gameAdapter = GameAdapter(&GetDefaultAllocator()); | |
random_bytes((uint8_t*)&clientId, 8); | |
log("client id is %.16" PRIx64 "\n", clientId); | |
yojimbo::Address* clientAddress = new Address(localProperties.GetProperty("CLIENT_IP_ADDRESS").c_str()); //TODO: delete | |
GameConnectionConfig config; | |
client = new GameClient(GetDefaultAllocator(), clientAddress, gameAdapter, config, cTime); // TODO: delete |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void HelloWorld::update(float dt) { | |
if (std::stoi(localProperties.GetProperty("IS_GAMESERVER"))) { | |
UpdateServer(dt); | |
} | |
else { | |
UpdateClient(dt); | |
} | |
//update game state | |
if(serverGameObject != nullptr){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2018-10-04 21:54:57.351610+0200 UDPTEST-desktop[7043:209923] flock failed to lock maps file: errno = 35 | |
2018-10-04 21:54:57.352593+0200 UDPTEST-desktop[7043:209923] flock failed to lock maps file: errno = 35 | |
{ | |
gl.supports_OES_map_buffer: false | |
gl.supports_vertex_array_object: true | |
cocos2d.x.version: cocos2d-x-3.17 | |
gl.vendor: Intel Inc. | |
gl.supports_PVRTC: false | |
gl.renderer: Intel Iris OpenGL Engine |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// GameAdapter.cpp | |
// UDPTEST | |
// | |
// Created by Christian Hohlfeld on 16.09.18. | |
// | |
#include <stdio.h> | |
#include "GameAdapter.h" | |
#include "GameServer.h" |
NewerOlder