allo
This commit is contained in:
parent
0369add339
commit
3cf8fd09cb
45 changed files with 82 additions and 40 deletions
|
@ -3,6 +3,9 @@ project(sockscape)
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 11)
|
set(CMAKE_CXX_STANDARD 11)
|
||||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/cmake")
|
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/cmake")
|
||||||
|
if(CMAKE_COMPILER_IS_GNUCXX)
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -static")
|
||||||
|
endif()
|
||||||
|
|
||||||
## CLIENT BUILD ##
|
## CLIENT BUILD ##
|
||||||
|
|
||||||
|
@ -13,12 +16,16 @@ find_package(SDL2_image REQUIRED)
|
||||||
find_package(SDL2_ttf REQUIRED)
|
find_package(SDL2_ttf REQUIRED)
|
||||||
|
|
||||||
file(GLOB_RECURSE client_src
|
file(GLOB_RECURSE client_src
|
||||||
|
"src/common/*.hpp"
|
||||||
|
"src/common/*.cpp"
|
||||||
"src/client/*.hpp"
|
"src/client/*.hpp"
|
||||||
"src/client/*.cpp"
|
"src/client/*.cpp"
|
||||||
)
|
)
|
||||||
|
|
||||||
add_executable(client ${client_src})
|
add_executable(client ${client_src})
|
||||||
target_include_directories(client
|
target_include_directories(client
|
||||||
|
PRIVATE ${PROJECT_SOURCE_DIR}/src/common
|
||||||
|
PRIVATE ${PROJECT_SOURCE_DIR}/src/client
|
||||||
PRIVATE ${PROJECT_SOURCE_DIR}/include/client
|
PRIVATE ${PROJECT_SOURCE_DIR}/include/client
|
||||||
PRIVATE ${OPENGL_INCLUDE_DIR}
|
PRIVATE ${OPENGL_INCLUDE_DIR}
|
||||||
PRIVATE ${GLEW_INCLUDE_DIR}
|
PRIVATE ${GLEW_INCLUDE_DIR}
|
||||||
|
@ -36,6 +43,8 @@ install(TARGETS client RUNTIME DESTINATION bin/client)
|
||||||
## SERVER BUILD ##
|
## SERVER BUILD ##
|
||||||
|
|
||||||
file(GLOB_RECURSE server_src
|
file(GLOB_RECURSE server_src
|
||||||
|
"src/common/*.hpp"
|
||||||
|
"src/common/*.cpp"
|
||||||
"src/server/*.hpp"
|
"src/server/*.hpp"
|
||||||
"src/server/*.cpp"
|
"src/server/*.cpp"
|
||||||
"src/server/*.c"
|
"src/server/*.c"
|
||||||
|
@ -43,6 +52,9 @@ file(GLOB_RECURSE server_src
|
||||||
)
|
)
|
||||||
|
|
||||||
add_executable(server ${server_src})
|
add_executable(server ${server_src})
|
||||||
|
target_include_directories(server
|
||||||
|
PRIVATE ${PROJECT_SOURCE_DIR}/src/common
|
||||||
|
PRIVATE ${PROJECT_SOURCE_DIR}/src/server)
|
||||||
if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
|
if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
|
||||||
target_link_libraries(server wsock32 ws2_32)
|
target_link_libraries(server wsock32 ws2_32)
|
||||||
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
|
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
|
||||||
|
|
BIN
resources/client/fonts/scape.ttf
Normal file
BIN
resources/client/fonts/scape.ttf
Normal file
Binary file not shown.
9
resources/client/shaders/test.frag
Normal file
9
resources/client/shaders/test.frag
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
#version 330 core
|
||||||
|
in vec2 texCoords;
|
||||||
|
uniform sampler2D graphicSampler;
|
||||||
|
|
||||||
|
out vec4 fragColor;
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
fragColor = texture(graphicSampler, texCoords);
|
||||||
|
}
|
18
resources/client/shaders/test.vert
Normal file
18
resources/client/shaders/test.vert
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
#version 330 core
|
||||||
|
layout (location = 0) in vec2 aScreenCoords;
|
||||||
|
layout (location = 1) in vec2 aTexCoords;
|
||||||
|
|
||||||
|
out vec2 texCoords;
|
||||||
|
|
||||||
|
uniform vec2 screenSize;
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
mat2 scMatrix = mat2(screenSize.x);
|
||||||
|
vec2 viewCoords = scMatrix * aScreenCoords;
|
||||||
|
gl_Position =
|
||||||
|
vec4((2 * aScreenCoords.x) / screenSize.x - 1,
|
||||||
|
1 - (2 * aScreenCoords.y) / screenSize.y,
|
||||||
|
0, 0);
|
||||||
|
|
||||||
|
texCoords = aTexCoords;
|
||||||
|
}
|
|
@ -1,5 +1,6 @@
|
||||||
#include <SDL.h>
|
#include <SDL.h>
|
||||||
#include <glm/vec2.hpp>
|
#include <glm/vec2.hpp>
|
||||||
|
#include <glm/mat2x2.hpp>
|
||||||
|
|
||||||
#define GL3_PROTOTYPES 1
|
#define GL3_PROTOTYPES 1
|
||||||
#include <GL/glew.h>
|
#include <GL/glew.h>
|
||||||
|
@ -39,29 +40,29 @@ int main(int argc, char* argv[]) {
|
||||||
glewInit();
|
glewInit();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
setColor(1, 0, 0, window);
|
|
||||||
|
|
||||||
bool running = true;
|
bool running = true;
|
||||||
while(running) {
|
while(running) {
|
||||||
|
glClearColor(0.0, 0.0, 0.0, 1.0);
|
||||||
|
glClear(GL_COLOR_BUFFER_BIT);
|
||||||
|
|
||||||
|
SDL_GL_SwapWindow(window);
|
||||||
|
|
||||||
SDL_Event event;
|
SDL_Event event;
|
||||||
while(SDL_PollEvent(&event)) {
|
while(SDL_PollEvent(&event)) {
|
||||||
if(event.type == SDL_QUIT)
|
if(event.type == SDL_QUIT)
|
||||||
running = false;
|
running = false;
|
||||||
|
|
||||||
|
if(event.type == SDL_WINDOWEVENT &&
|
||||||
|
event.window.event == SDL_WINDOWEVENT_SIZE_CHANGED)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
if(event.type == SDL_KEYDOWN) {
|
if(event.type == SDL_KEYDOWN) {
|
||||||
switch(event.key.keysym.sym) {
|
switch(event.key.keysym.sym) {
|
||||||
case SDLK_ESCAPE:
|
case SDLK_ESCAPE:
|
||||||
running = false;
|
running = false;
|
||||||
break;
|
break;
|
||||||
case SDLK_r:
|
|
||||||
setColor(1.0, 0.0, 0.0, window);
|
|
||||||
break;
|
|
||||||
case SDLK_g:
|
|
||||||
setColor(0.0, 1.0, 0.0, window);
|
|
||||||
break;
|
|
||||||
case SDLK_b:
|
|
||||||
setColor(0.0, 0.0, 1.0, window);
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#include "bcrypt.hpp"
|
#include "bcrypt.hpp"
|
||||||
|
#include "bfish.hpp"
|
||||||
|
|
||||||
static const uint32_t bcrypt_ciphertext[6] = {
|
static const uint32_t bcrypt_ciphertext[6] = {
|
||||||
0x4f727068, 0x65616e42, 0x65686f6c,
|
0x4f727068, 0x65616e42, 0x65686f6c,
|
|
@ -5,9 +5,8 @@
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include "base64.hpp"
|
#include "base64.hpp"
|
||||||
#include "bfish.hpp"
|
#include "utils/csprng.hpp"
|
||||||
#include "../utils/csprng.hpp"
|
#include "utils/string.hpp"
|
||||||
#include "../utils/string.hpp"
|
|
||||||
|
|
||||||
#define BCRYPT_COST 10
|
#define BCRYPT_COST 10
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#ifndef SOSC_CRYPTO_CIPHER_H
|
#ifndef SOSC_CRYPTO_CIPHER_H
|
||||||
#define SOSC_CRYPTO_CIPHER_H
|
#define SOSC_CRYPTO_CIPHER_H
|
||||||
|
|
||||||
#include "../utils/bigint.hpp"
|
#include "utils/bigint.hpp"
|
||||||
#include "keyex.hpp"
|
#include "keyex.hpp"
|
||||||
|
|
||||||
namespace sosc {
|
namespace sosc {
|
|
@ -1,8 +1,8 @@
|
||||||
#ifndef SOSC_CRYPTO_KEYEX_H
|
#ifndef SOSC_CRYPTO_KEYEX_H
|
||||||
#define SOSC_CRYPTO_KEYEX_H
|
#define SOSC_CRYPTO_KEYEX_H
|
||||||
|
|
||||||
#include "../utils/bigint.hpp"
|
#include "utils/bigint.hpp"
|
||||||
#include "../sock/packet.hpp"
|
#include "sock/packet.hpp"
|
||||||
|
|
||||||
namespace sosc {
|
namespace sosc {
|
||||||
namespace cgc {
|
namespace cgc {
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include "../utils/net.hpp"
|
#include "utils/net.hpp"
|
||||||
|
|
||||||
#define FRAME_OK 0
|
#define FRAME_OK 0
|
||||||
#define FRAME_MORE 1
|
#define FRAME_MORE 1
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
#include "tcpsock.hpp"
|
#include "tcpsock.hpp"
|
||||||
#include "packet.hpp"
|
#include "packet.hpp"
|
||||||
#include "../crypto/cipher.hpp"
|
#include "crypto/cipher.hpp"
|
||||||
|
|
||||||
namespace sosc {
|
namespace sosc {
|
||||||
class IntraClient {
|
class IntraClient {
|
|
@ -23,6 +23,8 @@ bool sosc::Packet::AddRegions(std::vector<std::string> data) {
|
||||||
|
|
||||||
for(const auto& i : data)
|
for(const auto& i : data)
|
||||||
this->regions.push_back(i);
|
this->regions.push_back(i);
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void sosc::Packet::SetRegion(uint8_t index, std::string data) {
|
void sosc::Packet::SetRegion(uint8_t index, std::string data) {
|
|
@ -5,7 +5,7 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <cstdarg>
|
#include <cstdarg>
|
||||||
#include "../utils/net.hpp"
|
#include "utils/net.hpp"
|
||||||
|
|
||||||
#define PCK_ANY 0
|
#define PCK_ANY 0
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include "../db/database.hpp"
|
#include "db/database.hpp"
|
||||||
|
|
||||||
namespace sosc {
|
namespace sosc {
|
||||||
typedef struct {
|
typedef struct {
|
|
@ -2,9 +2,9 @@
|
||||||
#define SOSC_SCAPESOCK_H
|
#define SOSC_SCAPESOCK_H
|
||||||
|
|
||||||
#include <queue>
|
#include <queue>
|
||||||
#include "../crypto/sha1.hpp"
|
#include "crypto/sha1.hpp"
|
||||||
#include "../crypto/base64.hpp"
|
#include "crypto/base64.hpp"
|
||||||
#include "../crypto/cipher.hpp"
|
#include "crypto/cipher.hpp"
|
||||||
#include "frame.hpp"
|
#include "frame.hpp"
|
||||||
#include "packet.hpp"
|
#include "packet.hpp"
|
||||||
#include "tcpsock.hpp"
|
#include "tcpsock.hpp"
|
|
@ -31,8 +31,8 @@
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include "../utils/net.hpp"
|
#include "utils/net.hpp"
|
||||||
#include "../utils/string.hpp"
|
#include "utils/string.hpp"
|
||||||
|
|
||||||
#define SOSC_TCP_BUFLEN 2048
|
#define SOSC_TCP_BUFLEN 2048
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
#define SOSC_DATABASE_H
|
#define SOSC_DATABASE_H
|
||||||
|
|
||||||
#include "sqlite/sqlite3.h"
|
#include "sqlite/sqlite3.h"
|
||||||
#include "../utils/time.hpp"
|
#include "utils/time.hpp"
|
||||||
#include "../crypto/sha1.hpp"
|
#include "crypto/sha1.hpp"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
|
|
@ -1,16 +1,16 @@
|
||||||
#ifndef SOSC_HOST_MASTER_H
|
#ifndef SOSC_HOST_MASTER_H
|
||||||
#define SOSC_HOST_MASTER_H
|
#define SOSC_HOST_MASTER_H
|
||||||
|
|
||||||
#include "../sock/intrasock.hpp"
|
#include "sock/intrasock.hpp"
|
||||||
#include "../sock/scapesock.hpp"
|
#include "sock/scapesock.hpp"
|
||||||
#include "../sock/pool.hpp"
|
#include "sock/pool.hpp"
|
||||||
|
|
||||||
#include "../crypto/keyex.hpp"
|
#include "crypto/keyex.hpp"
|
||||||
#include "../crypto/cipher.hpp"
|
#include "crypto/cipher.hpp"
|
||||||
|
|
||||||
#include "../db/database.hpp"
|
#include "db/database.hpp"
|
||||||
|
|
||||||
#include "../ctx/master.hpp"
|
#include "ctx/master.hpp"
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#include "master.hpp"
|
#include "master.hpp"
|
||||||
#include "../db/database.hpp"
|
#include "db/database.hpp"
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
|
|
||||||
static struct {
|
static struct {
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
#ifndef SOSC_HOST_SLAVE_H
|
#ifndef SOSC_HOST_SLAVE_H
|
||||||
#define SOSC_HOST_SLAVE_H
|
#define SOSC_HOST_SLAVE_H
|
||||||
|
|
||||||
#include "../sock/scapesock.hpp"
|
#include "sock/scapesock.hpp"
|
||||||
#include "../sock/pool.hpp"
|
#include "sock/pool.hpp"
|
||||||
#include "../ctx/slave.hpp"
|
#include "ctx/slave.hpp"
|
||||||
|
|
||||||
namespace sosc {
|
namespace sosc {
|
||||||
/** SLAVE -> CLIENT **/
|
/** SLAVE -> CLIENT **/
|
||||||
|
|
Loading…
Reference in a new issue