Skip to content

Commit

Permalink
Revert Issue #4
Browse files Browse the repository at this point in the history
  • Loading branch information
Chikaosolu Amaechi committed Jul 17, 2023
1 parent 3cf65f0 commit 6fe04a0
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 3 deletions.
28 changes: 28 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,31 @@ if(MINGW)
${GLFW_LIBRARIES} ${CURL_LIBRARIES})
endif()

# GTest setup
# do not want main included so it is a valid executable
#MESSAGE(STATUS "${SOURCE_FILES}")
FOREACH(item ${SOURCE_FILES})
IF(${item} MATCHES "src/main.c")
LIST(REMOVE_ITEM SOURCE_FILES ${item})
ENDIF(${item} MATCHES "src/main.c")
ENDFOREACH(item)
#MESSAGE(STATUS "${SOURCE_FILES}")

enable_testing()
find_package(GTest REQUIRED)
include_directories(${GTEST_INCLUDE_DIR})
add_executable(
runTests
tests/tests.cpp
${SOURCE_FILES}
deps/glew/src/glew.c
deps/lodepng/lodepng.c
deps/noise/noise.c
deps/sqlite/sqlite3.c
deps/tinycthread/tinycthread.c)
target_link_libraries(runTests
${GTEST_BOTH_LIBRARIES}
pthread
dl glfw
${GLFW_LIBRARIES}
${CURL_LIBRARIES} )
4 changes: 4 additions & 0 deletions src/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,14 @@
#define CRAFT_KEY_COMMAND '/'
#define CRAFT_KEY_SIGN '`'
<<<<<<< HEAD
<<<<<<< HEAD
=======
#define CRAFT_KEY_RUN GLFW_KEY_LEFT_CONTROL
>>>>>>> f8dd1648b873dd56a2e1f769594e6103784dc435

=======
#define CRAFT_KEY_RUN GLFW_KEY_LEFT_CONTROL
>>>>>>> parent of 15dbf4a (Revert 'Resolved Issue #4')
// advanced parameters
#define CREATE_CHUNK_RADIUS 10
#define RENDER_CHUNK_RADIUS 10
Expand Down
10 changes: 7 additions & 3 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -2431,22 +2431,25 @@ void handle_movement(double dt) {
State *s = &g->players->state;
int sz = 0;
int sx = 0;
int isRunning = 0;
if (!g->typing) {
float m = dt * 1.0;
g->ortho = glfwGetKey(g->window, CRAFT_KEY_ORTHO) ? 64 : 0;
g->fov = glfwGetKey(g->window, CRAFT_KEY_ZOOM) ? 15 : 65;
<<<<<<< HEAD
if (glfwGetKey(g->window, CRAFT_KEY_FORWARD)) {
if(glfwGetKey(g->window, CRAFT_KEY_RUN)) isRunning = 1;
sz--;
<<<<<<< HEAD
}
<<<<<<< HEAD
=======
if (glfwGetKey(g->window, CRAFT_KEY_FORWARD)) sz--;
>>>>>>> parent of 6ca5a52 (issue #4)
=======
}
>>>>>>> f8dd1648b873dd56a2e1f769594e6103784dc435
=======
>>>>>>> parent of 15dbf4a (Revert 'Resolved Issue #4')
if (glfwGetKey(g->window, CRAFT_KEY_BACKWARD)) sz++;
if (glfwGetKey(g->window, CRAFT_KEY_LEFT)) sx--;
if (glfwGetKey(g->window, CRAFT_KEY_RIGHT)) sx++;
Expand All @@ -2470,12 +2473,13 @@ void handle_movement(double dt) {
<<<<<<< HEAD
float speed = g->flying ? 20 : 5;
<<<<<<< HEAD
<<<<<<< HEAD
=======
float speed = g->flying ? g->flying_sprint_speed : 5; // flying gets modifiable speed
>>>>>>> f8dd1648b873dd56a2e1f769594e6103784dc435
if(isRunning) speed*=1.5;
=======
>>>>>>> parent of 6ca5a52 (issue #4)
>>>>>>> parent of 15dbf4a (Revert 'Resolved Issue #4')
if(isRunning) speed*=1.5;
int estimate = roundf(sqrtf(
powf(vx * speed, 2) +
powf(vy * speed + ABS(dy) * 2, 2) +
Expand Down

0 comments on commit 6fe04a0

Please sign in to comment.