Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactoring + rework of saving process #32

Open
wants to merge 16 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
build
.cache
.vscode

__cmrc_Assets
_cmrc
CMakeCache.txt
CMakeFiles
GravityDefied
Makefile
cmake_install.cmake
libAssets.a
saves
a.out

15 changes: 11 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
cmake_minimum_required(VERSION 3.24)
cmake_minimum_required(VERSION 3.10)
project(gravity_defied_cpp C CXX)
set(CMAKE_VERBOSE_MAKEFILE TRUE)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no need to force this option. You can pass it via -D on the command line.


unset(ENV{PKG_CONFIG_PATH})

Expand All @@ -13,14 +14,18 @@ if(WIN32)
endif()

find_package(PkgConfig REQUIRED)
find_package(OpenSSL REQUIRED)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OpenSSL, just for the sake of md5 hash, is redundant. Can we use a lighter implementation or another algorithm like crc32. Are there any analogs in the standard c++ library?


pkg_search_module(SDL2 REQUIRED IMPORTED_TARGET sdl2)
pkg_search_module(SDL2_TTF REQUIRED IMPORTED_TARGET SDL2_ttf)
pkg_search_module(SDL2_IMAGE REQUIRED IMPORTED_TARGET SDL2_image)

# Create a sources variable with a link to all cpp files to compile
set(SOURCES
src/config.cpp
src/utils/Log.cpp
src/utils/Time.cpp
src/utils/Hashing.cpp
src/utils/EmbedFileStream.cpp
src/main.cpp
src/MathF16.cpp
Expand All @@ -30,12 +35,14 @@ set(SOURCES
src/class_10.cpp
src/GameLevel.cpp
src/LevelLoader.cpp
src/MRGLoader.cpp
src/Micro.cpp
src/TextRender.cpp
src/GameMenu.cpp
src/SettingsStringRender.cpp
src/MenuManager.cpp
src/RecordManager.cpp
src/SettingsManager.cpp
src/Timer.cpp
src/lcdui/CanvasImpl.cpp
src/lcdui/Canvas.cpp
Expand All @@ -44,8 +51,6 @@ set(SOURCES
src/lcdui/Font.cpp
src/lcdui/Command.cpp
src/lcdui/FontStorage.cpp
src/rms/RecordEnumerationImpl.cpp
src/rms/RecordStore.cpp
)

include(cmake/CMakeRC.cmake)
Expand Down Expand Up @@ -77,7 +82,7 @@ endif()
add_executable(GravityDefied ${SOURCES})

target_compile_features(GravityDefied PRIVATE cxx_std_17)
target_compile_options(GravityDefied PRIVATE -Wall -Wextra)
target_compile_options(GravityDefied PRIVATE -Wall -Wextra -fsigned-char)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this option for?


target_include_directories(GravityDefied PRIVATE
${SDL2_INCLUDE_DIRS}
Expand All @@ -97,12 +102,14 @@ if(WIN32)
${SDL2_STATIC_LIBRARIES}
${SDL2_TTF_STATIC_LIBRARIES}
${SDL2_IMAGE_STATIC_LIBRARIES}
OpenSSL::SSL
Assets::Assets)
else()
target_link_libraries(GravityDefied
${SDL2_LIBRARIES}
${SDL2_TTF_LIBRARIES}
${SDL2_IMAGE_LIBRARIES}
OpenSSL::SSL
Assets::Assets)
endif()

Expand Down
Binary file added levels.mrg
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How is it different from what it was?

Binary file not shown.
Loading