Skip to content

Instantly share code, notes, and snippets.

@taipoxin
Created November 11, 2019 10:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save taipoxin/0a2e908c7e7c2ca621361a3a656830a2 to your computer and use it in GitHub Desktop.
Save taipoxin/0a2e908c7e7c2ca621361a3a656830a2 to your computer and use it in GitHub Desktop.
test_app code files.
# file: Core.h
#pragma once
#include "Entity.h"
#file: Entity.cpp
#include "Entity.h"
#include <iostream>
namespace Core
{
typedef websocketpp::client<websocketpp::config::asio_client> client;
Entity::Entity(const char* name, float xPos, float yPos)
: m_Name(name), m_XPos(xPos), m_YPos(yPos)
{
std::cout << "Created the Entity object!" << std::endl;
}
void Entity::Move(float deltaX, float deltaY)
{
m_XPos += deltaX;
m_YPos += deltaY;
std::cout << "Moved " << m_Name << " to (" << m_XPos << ", " << m_YPos << ")." << std::endl;
}
void Entity::test() {
client cl;
std::cout << "Moved ";
}
}
#file: Entity.h
#pragma once
#include <websocketpp/client.hpp>
#include <websocketpp/config/asio_no_tls_client.hpp>
namespace Core
{
class Entity
{
public:
const char* m_Name;
private:
float m_XPos, m_YPos;
public:
Entity(const char* name, float xPos, float yPos);
void Move(float deltaX, float deltaY);
void test();
inline float GetXPosition() const { return m_XPos; };
inline float GetYPosition() const { return m_YPos; };
inline const char* GETNAME() const { return m_Name; };
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment