Skip to content

Commit

Permalink
fix: format
Browse files Browse the repository at this point in the history
  • Loading branch information
tolstenko committed Jul 14, 2023
1 parent 02c8e15 commit ed8939a
Show file tree
Hide file tree
Showing 13 changed files with 51 additions and 66 deletions.
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ if(ENABLE_DOCUMENTATION)
endif()

CPMAddPackage(
NAME CPMLicenses.cmake
GITHUB_REPOSITORY cpm-cmake/CPMLicenses.cmake
VERSION 0.0.5
NAME CPMLicenses.cmake
GITHUB_REPOSITORY cpm-cmake/CPMLicenses.cmake
VERSION 0.0.5
)
write_license_disclaimer("third_party.txt" "${CPM_PACKAGES}")

Expand Down
2 changes: 1 addition & 1 deletion core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ set(CORE_INC_DIR
add_library(core STATIC ${CORE_SRC} ${CORE_INC})

if(EMSCRIPTEN)
# target_link_libraries(core PUBLIC SDL2::SDL2 SDL2_image::SDL2_image-static IMGUI quickjspp)
# target_link_libraries(core PUBLIC SDL2::SDL2 SDL2_image::SDL2_image-static IMGUI quickjspp)
target_link_libraries(core PUBLIC SDL2::SDL2 SDL2_image::SDL2_image-static IMGUI)
else()
target_link_libraries(
Expand Down
10 changes: 4 additions & 6 deletions core/datastructures/Tree.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,17 @@
#include <vector>

// binary tree
template <Sortable T>
struct BinaryTree {
template <Sortable T> struct BinaryTree {
struct Node {
T value;
Node* left = nullptr;
Node* right = nullptr;
explicit Node(T value) : value(value) {}
Node(T value, Node* left, Node* right) : value(value), left(left), right(right) {}

~Node() {
if (left) delete left;
if (right)delete right;
if (right) delete right;
}
};

Expand All @@ -36,7 +35,7 @@ struct BinaryTree {
break;
}
} else {
if (current->right != nullptr){
if (current->right != nullptr) {
current = current->right;
} else {
current->right = new Node(value);
Expand All @@ -45,7 +44,6 @@ struct BinaryTree {
}
}
}

};

#endif // MOBAGEN_TREE_H
1 change: 0 additions & 1 deletion core/memory/Memory.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#pragma once

#include <memory>

2 changes: 1 addition & 1 deletion core/script/Script.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
//
//#include <quickjspp.hpp>
//
//class Script {
// class Script {
//
//};
//
Expand Down
2 changes: 1 addition & 1 deletion core/script/ScriptManager.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//#include "ScriptManager.h"
//#include "quickjspp.hpp"
//
//void ScriptManager::Initialize() {
// void ScriptManager::Initialize() {
//
//}
32 changes: 16 additions & 16 deletions core/script/ScriptManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,23 @@
//// todo: generate bindings for quickjs. see https://github.com/ftk/quickjspp/tree/master/binding-generator
//
//// singleton
//class ScriptManager {
//public:
// static ScriptManager& getInstance() {
// static ScriptManager instance;
// return instance;
// }
// ScriptManager(ScriptManager const&) = delete;
// void operator=(ScriptManager const&) = delete;
// ~ScriptManager() = default;
// class ScriptManager {
// public:
// static ScriptManager& getInstance() {
// static ScriptManager instance;
// return instance;
// }
// ScriptManager(ScriptManager const&) = delete;
// void operator=(ScriptManager const&) = delete;
// ~ScriptManager() = default;
//
// // quickjs stuff
// qjs::Runtime runtime;
// qjs::Context context = qjs::Context(runtime);
// // quickjs stuff
// qjs::Runtime runtime;
// qjs::Context context = qjs::Context(runtime);
//
// void Initialize();
//protected:
// ScriptManager() = default;
//};
// void Initialize();
// protected:
// ScriptManager() = default;
// };
//
//#endif // MOBAGEN_SCRIPTMANAGER_H
1 change: 0 additions & 1 deletion examples/chess/Search.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ Move Search::NextMove(WorldState& state) {
// after all the recursion, you have to sort all the children from that node
// selectively choose the best ones (max or min) based on the current deepening level, and mark your score as the result of this search


auto moves = Search::ListMoves(state, state.GetTurn());
// generate states
vector<MoveState> moveStates;
Expand Down
7 changes: 3 additions & 4 deletions examples/flocking/behaviours/CohesionRule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,10 @@ Vector2f CohesionRule::computeForce(const std::vector<Boid*>& neighborhood, Boid

// find center of mass
Vector2f centerOfMass = Vector2f::zero();
for (auto b : neighborhood)
centerOfMass += b->getPosition(); // accumulate positions
centerOfMass /= neighborhood.size(); // divide by number of boids
for (auto b : neighborhood) centerOfMass += b->getPosition(); // accumulate positions
centerOfMass /= neighborhood.size(); // divide by number of boids

cohesionForce = centerOfMass - boid->getPosition(); // direction force towards center of mass
cohesionForce = centerOfMass - boid->getPosition(); // direction force towards center of mass

return cohesionForce;
}
7 changes: 2 additions & 5 deletions external/chaiscript.cmake
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
CPMAddPackage(
GITHUB_REPOSITORY ChaiScript/ChaiScript

)
CPMAddPackage(GITHUB_REPOSITORY ChaiScript/ChaiScript)
find_package(ChaiScript REQUIRED)
if(ChaiScript_ADDED)
message(STATUS ChaiScript_ADDED)
message(STATUS ChaiScript_ADDED)
endif()
4 changes: 2 additions & 2 deletions external/external.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ endif()
# set(CMAKE_USE_PTHREADS_INIT 1) set(THREADS_PREFER_PTHREAD_FLAG ON) ENDIF() find_package(Threads
# REQUIRED) include(external/wasm.cmake) include(external/v8.cmake) endif()

#include(external/quickjs.cmake)
# include(filament.cmake) include(threadpool.cmake) include(external/zlib.cmake)
# include(external/quickjs.cmake) include(filament.cmake) include(threadpool.cmake)
# include(external/zlib.cmake)
include(external/sdl.cmake)
# include(glm.cmake) include(glew.cmake)
include(external/imgui.cmake)
Expand Down
14 changes: 8 additions & 6 deletions external/imgui.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@ if(IMGUI_ADDED)

target_sources(
IMGUI
PUBLIC ${IMGUI_SOURCE_DIR}/imgui_demo.cpp ${IMGUI_SOURCE_DIR}/imgui_draw.cpp
${IMGUI_SOURCE_DIR}/imgui_tables.cpp ${IMGUI_SOURCE_DIR}/imgui_widgets.cpp
${IMGUI_SOURCE_DIR}/imgui.cpp
${IMGUI_SOURCE_DIR}/backends/imgui_impl_sdlrenderer2.cpp
${IMGUI_SOURCE_DIR}/backends/imgui_impl_sdl2.cpp
${IMGUI_SOURCE_DIR}/backends/imgui_impl_opengl3.cpp
PUBLIC ${IMGUI_SOURCE_DIR}/imgui_demo.cpp
${IMGUI_SOURCE_DIR}/imgui_draw.cpp
${IMGUI_SOURCE_DIR}/imgui_tables.cpp
${IMGUI_SOURCE_DIR}/imgui_widgets.cpp
${IMGUI_SOURCE_DIR}/imgui.cpp
${IMGUI_SOURCE_DIR}/backends/imgui_impl_sdlrenderer2.cpp
${IMGUI_SOURCE_DIR}/backends/imgui_impl_sdl2.cpp
# ${IMGUI_SOURCE_DIR}/backends/imgui_impl_opengl3.cpp
)
target_include_directories(
IMGUI
Expand Down
29 changes: 10 additions & 19 deletions external/quickjs.cmake
Original file line number Diff line number Diff line change
@@ -1,26 +1,17 @@
string(TIMESTAMP BEFORE "%s")
CPMAddPackage(
NAME quickjspp
URL "https://github.com/ftk/quickjspp/archive/refs/heads/master.zip"
OPTIONS "QUICKJSPP_BUILD_TESTS OFF" "BUILD_TESTING OFF"
NAME quickjspp
URL "https://github.com/ftk/quickjspp/archive/refs/heads/master.zip"
OPTIONS "QUICKJSPP_BUILD_TESTS OFF" "BUILD_TESTING OFF"
)
if(quickjspp_ADDED)
# add_library(quickjspp STATIC)
# target_compile_definitions(
# quickjs PRIVATE CONFIG_VERSION="v1.0.0" # hack to make it compile. it doesnt accept date as
# # version number
# )
# target_sources(
# quickjs
# PRIVATE ${quickjs_SOURCE_DIR}/quickjs.h
# ${quickjs_SOURCE_DIR}/quickjs-libc.h
# ${quickjs_SOURCE_DIR}/quickjs.c
# ${quickjs_SOURCE_DIR}/libregexp.c
# ${quickjs_SOURCE_DIR}/libunicode.c
# ${quickjs_SOURCE_DIR}/libbf.c
# ${quickjs_SOURCE_DIR}/cutils.c
# ${quickjs_SOURCE_DIR}/quickjs-libc.c
# )
# add_library(quickjspp STATIC) target_compile_definitions( quickjs PRIVATE
# CONFIG_VERSION="v1.0.0" # hack to make it compile. it doesnt accept date as # version number )
# target_sources( quickjs PRIVATE ${quickjs_SOURCE_DIR}/quickjs.h
# ${quickjs_SOURCE_DIR}/quickjs-libc.h ${quickjs_SOURCE_DIR}/quickjs.c
# ${quickjs_SOURCE_DIR}/libregexp.c ${quickjs_SOURCE_DIR}/libunicode.c
# ${quickjs_SOURCE_DIR}/libbf.c ${quickjs_SOURCE_DIR}/cutils.c
# ${quickjs_SOURCE_DIR}/quickjs-libc.c )
include_directories(${quickjspp_SOURCE_DIR})
endif()
string(TIMESTAMP AFTER "%s")
Expand Down

0 comments on commit ed8939a

Please sign in to comment.