From 7f3d8d99a1b143fa67f756a754bbafd6512520f9 Mon Sep 17 00:00:00 2001 From: Joshua Moerman Date: Sun, 10 Mar 2013 12:19:46 +0100 Subject: [PATCH] Moved source files to src/ --- CMakeLists.txt | 3 ++- json.h => src/json.h | 0 main.cpp => src/main.cpp | 10 ++++++---- websockets.cpp => src/websockets.cpp | 0 websockets.h => src/websockets.h | 0 5 files changed, 8 insertions(+), 5 deletions(-) rename json.h => src/json.h (100%) rename main.cpp => src/main.cpp (93%) rename websockets.cpp => src/websockets.cpp (100%) rename websockets.h => src/websockets.h (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0521da5..32462f5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,7 +25,8 @@ set(all_libraries websockets json_spirit) # Own files include_directories("${PROJECT_SOURCE_DIR}") -file(GLOB all_files "*.cpp") +include_directories("${PROJECT_SOURCE_DIR}/src/") +file(GLOB all_files "src/*.cpp") add_executable(server ${all_files}) target_link_libraries(server ${all_libraries}) diff --git a/json.h b/src/json.h similarity index 100% rename from json.h rename to src/json.h diff --git a/main.cpp b/src/main.cpp similarity index 93% rename from main.cpp rename to src/main.cpp index c83fa40..ebcb94c 100644 --- a/main.cpp +++ b/src/main.cpp @@ -67,6 +67,8 @@ BOOST_FUSION_ADAPT_STRUCT( std::vector people_online; inline void update_positions(){ + const float speed = 0.4; + typedef std::chrono::duration> fseconds; static auto start = std::chrono::steady_clock::now(); auto end = std::chrono::steady_clock::now(); @@ -76,11 +78,11 @@ inline void update_positions(){ auto n = people_online.size(); for(int i = 0; i < n; ++i){ User& user = *people_online[i]; - double x = cos(0.1 * time + 2*M_PI*i/double(n)); - double y = sin(0.1 * time + 2*M_PI*i/double(n)); + double x = cos(speed * time + 2*M_PI*i/double(n)); + double y = sin(speed * time + 2*M_PI*i/double(n)); - user.position.x = 200 + 180*x; - user.position.y = 200 + 180*y; + user.position.x = 200 + 200*x; + user.position.y = 200 + 200*y; } } diff --git a/websockets.cpp b/src/websockets.cpp similarity index 100% rename from websockets.cpp rename to src/websockets.cpp diff --git a/websockets.h b/src/websockets.h similarity index 100% rename from websockets.h rename to src/websockets.h