From 6afa6d85059e5f5c33427a4cd1afee114da6901e Mon Sep 17 00:00:00 2001 From: Joeyrp Date: Tue, 7 Sep 2021 14:23:43 -0400 Subject: [PATCH] Freetype added to the project (need to test in linux) --- .gitmodules | 3 +++ CMakeLists.txt | 13 +++++++++++-- docs/Tasks.todo | 6 ++++-- external/freetype | 1 + src/main.cpp | 15 +++++++++++++++ 5 files changed, 34 insertions(+), 4 deletions(-) create mode 160000 external/freetype diff --git a/.gitmodules b/.gitmodules index bfd68c1..7e74e29 100644 --- a/.gitmodules +++ b/.gitmodules @@ -10,3 +10,6 @@ [submodule "external/pugixml"] path = external/pugixml url = https://github.com/zeux/pugixml.git +[submodule "external/freetype"] + path = external/freetype + url = https://gitlab.freedesktop.org/freetype/freetype.git diff --git a/CMakeLists.txt b/CMakeLists.txt index 5709c6a..ecd807b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -69,6 +69,10 @@ if(NOT EXISTS "${PROJECT_SOURCE_DIR}/external/pugixml/CMakeLists.txt") message(FATAL_ERROR "The submodules were not downloaded! GIT_SUBMODULE was turned off or failed. Please update submodules and try again.") endif() +if(NOT EXISTS "${PROJECT_SOURCE_DIR}/external/freetype/CMakeLists.txt") + message(FATAL_ERROR "The submodules were not downloaded! GIT_SUBMODULE was turned off or failed. Please update submodules and try again.") +endif() + # add GLFW add_subdirectory(external/glfw) @@ -87,6 +91,9 @@ add_subdirectory(external/lua) # add pugixml add_subdirectory(external/pugixml) +# add freetype +add_subdirectory(external/freetype) + target_include_directories(${PROJECT_NAME} PUBLIC "${PROJECT_BINARY_DIR}" PUBLIC src @@ -96,6 +103,7 @@ target_include_directories(${PROJECT_NAME} PUBLIC src/dearimgui PUBLIC external/pugixml/src PUBLIC external/glad/include + PUBLIC external/freetype/include ) target_link_directories(${PROJECT_NAME} @@ -103,10 +111,11 @@ target_link_directories(${PROJECT_NAME} PRIVATE external/glm PRIVATE src/dearimgui PRIVATE external/glad/src + PRIVATE external/freetype/src ) if(WIN32) - target_link_libraries(${PROJECT_NAME} opengl32.lib glfw glad glm dearimgui lua_static pugixml) + target_link_libraries(${PROJECT_NAME} opengl32.lib glfw glad glm dearimgui lua_static pugixml freetype) elseif(UNIX) - target_link_libraries(${PROJECT_NAME} X11 GL glfw glad glm dearimgui lua_static pugixml) + target_link_libraries(${PROJECT_NAME} X11 GL glfw glad glm dearimgui lua_static pugixml freetype) endif() diff --git a/docs/Tasks.todo b/docs/Tasks.todo index cea585a..079c6e6 100644 --- a/docs/Tasks.todo +++ b/docs/Tasks.todo @@ -5,7 +5,9 @@ Core: Graphics: ☐ Dear ImGui class with basic initialization - ☐ Decide on a font/text rendering system + ✔ Decide on a font/text rendering system @done (9/7/2021, 1:39:53 PM) + ✔ Add FreeType to the project @done (9/7/2021, 2:23:13 PM) + ☐ Add a new class for font loading/management and text rendering Input: - ☐ Port over the Element2D input system and adust it to use glfw \ No newline at end of file + ☐ Port over the Element2D input system and adjust it to use glfw \ No newline at end of file diff --git a/external/freetype b/external/freetype new file mode 160000 index 0000000..60a93ea --- /dev/null +++ b/external/freetype @@ -0,0 +1 @@ +Subproject commit 60a93ea2318f6626ae72933ef9a44e60da170325 diff --git a/src/main.cpp b/src/main.cpp index f72c8b7..86bb316 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -12,8 +12,23 @@ #include #include +// TESTING +// #include +// #include FT_FREETYPE_H + int main(int argc, char** argv) { + // TESTING -- FREETYPE + // FT_Library ft; + // if (FT_Init_FreeType(&ft)) + // { + // std::cout << "Could not init FreeType Library\n"; + // return -1; + // } + // std::cout << "Freetype library sucessfully initialized!\n"; + //////////////// + + // Switch the currrent working directory to the directory // containing the lunarium.exe file because the data and state // file should be in that location