Skip to content

Commit

Permalink
Merge branch 'main' into feature/install-and-compile
Browse files Browse the repository at this point in the history
  • Loading branch information
nhatdongdang authored Sep 9, 2024
2 parents cf84454 + c668271 commit c268c49
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ install(TARGETS ${PROJECT_NAME}
PUBLIC_HEADER DESTINATION ${HEADER_INSTALL_DIR}
)

# Build examples
add_executable(pyramid EXCLUDE_FROM_ALL example/pyramid.cpp)
target_link_libraries(pyramid ${PROJECT_NAME})
add_executable(hello_minecraft EXCLUDE_FROM_ALL example/hello_minecraft.cpp)
target_link_libraries(hello_minecraft ${PROJECT_NAME})

# CPack setup
SET(CPACK_GENERATOR "DEB")
SET(CPACK_PACKAGE_VERSION ${PROJECT_VERSION})
Expand Down
8 changes: 8 additions & 0 deletions example/hello_minecraft.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#include <mcpp/mcpp.h>

using namespace mcpp;

int main() {
MinecraftConnection mc;
mc.postToChat("Hello, Minecraft!");
}
4 changes: 3 additions & 1 deletion example/pyramid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,10 @@ int main() {
// Use minimum hight of the area as the lowest point on the pyramid
int min_height = *std::min_element(heights.begin(), heights.end());

// uild ring, diminishing up to pyramid height mcpp::Coordinate base_pt =

heights.base_pt();
// Build rngs, diminishing up to pyramid height
mcpp::Coordinate base_pt = heights.base_pt();
base_pt.y = min_height;
int side_len = pyramid_base_len;
for (int i = 0; i < PYRAMID_HEIGHT; i++) {
Expand Down

0 comments on commit c268c49

Please sign in to comment.