Skip to content
This repository has been archived by the owner on Jan 5, 2025. It is now read-only.

Commit

Permalink
Cleanup 🧹 and add documentations 📕
Browse files Browse the repository at this point in the history
  • Loading branch information
andraantariksa committed Apr 4, 2022
1 parent 69b6438 commit 272de18
Show file tree
Hide file tree
Showing 17 changed files with 1,427 additions and 1,318 deletions.
93 changes: 45 additions & 48 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,90 +1,87 @@
cmake_minimum_required(VERSION 3.10)
include(FetchContent)

project(2DComputerGraphicsAndAnimation)
project(HexagonPaint
LANGUAGES CXX C)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
set(FETCHCONTENT_QUIET OFF)

set(BUILD_SHARED_LIBS FALSE)

# SFML
set(SFML_VERSION "2.5.1")
FetchContent_Declare(
sfml
GIT_REPOSITORY "https://github.com/SFML/SFML.git"
GIT_TAG "${SFML_VERSION}"
sfml
GIT_REPOSITORY "https://github.com/SFML/SFML.git"
GIT_TAG "${SFML_VERSION}"
)
FetchContent_GetProperties(sfml)
if(NOT sfml_POPULATED)
if (NOT sfml_POPULATED)
FetchContent_Populate(sfml)
add_subdirectory("${sfml_SOURCE_DIR}" "${sfml_BINARY_DIR}")
endif()
endif ()

# ImGui
set(IMGUI_VERSION "1.74")
FetchContent_Declare(
imgui
GIT_REPOSITORY "https://github.com/ocornut/imgui.git"
GIT_TAG "v${IMGUI_VERSION}"
GIT_TAG "v${IMGUI_VERSION}"
)
FetchContent_GetProperties(imgui)
if(NOT imgui_POPULATED)
if (NOT imgui_POPULATED)
FetchContent_Populate(imgui)
#add_subdirectory("${imgui_SOURCE_DIR}" "${imgui_BINARY_DIR}")
endif()
endif ()

# ImGui-SFML
set(IMGUI_SFML_VERSION "2.1")
FetchContent_Declare(
imgui_sfml
GIT_REPOSITORY "https://github.com/eliasdaler/imgui-sfml.git"
GIT_TAG "v${IMGUI_SFML_VERSION}"
GIT_TAG "v${IMGUI_SFML_VERSION}"
)

set(IMGUI_DIR ${imgui_SOURCE_DIR})
set(IMGUI_SFML_FIND_SFML CACHE BOOL FALSE)

FetchContent_GetProperties(imgui_sfml)
if(NOT imgui_sfml_POPULATED)
if (NOT imgui_sfml_POPULATED)
FetchContent_Populate(imgui_sfml)
add_subdirectory("${imgui_sfml_SOURCE_DIR}" "${imgui_sfml_BINARY_DIR}")
endif()
endif ()

set(SOURCE
"src/main.cpp"
)
add_executable(HexagonPaint

add_executable(2DComputerGraphicsAndAnimationApp
"${SOURCE}"
)
"lib/tinyfiledialogs/tinyfiledialogs.c"
"lib/lodepng/lodepng.cpp"
"lib/lodepng/lodepng_fuzzer.cpp"
"lib/lodepng/lodepng_util.cpp"

target_link_libraries(2DComputerGraphicsAndAnimationApp
PRIVATE
"sfml-graphics"
"sfml-system"
"sfml-window"
ImGui-SFML::ImGui-SFML
)
"src/main.cpp"
"src/helpers.cpp"
"src/helpers.hpp"
"src/canvas.cpp"
"src/canvas.hpp"
"src/color.hpp"
"src/shape/line.cpp"
"src/shape/line.hpp"
"src/fps.cpp"
"src/fps.hpp"
"src/application.cpp"
"src/application.hpp")

target_include_directories(HexagonPaint
PRIVATE "lib/tinyfiledialogs"
PRIVATE "lib/stb"
PRIVATE "lib/lodepng")

if(MSVC)
configure_file(
${imgui_sfml_BINARY_DIR}/ImGui-SFML.dll
ImGui-SFML.dll
COPYONLY
)
configure_file(
${sfml_BINARY_DIR}/lib/sfml-graphics-d-2.dll
sfml-graphics-d-2.dll
COPYONLY
)
configure_file(
${sfml_BINARY_DIR}/lib/sfml-window-d-2.dll
sfml-window-d-2.dll
COPYONLY
)
configure_file(
${sfml_BINARY_DIR}/lib/sfml-system-d-2.dll
sfml-system-d-2.dll
COPYONLY
)
endif()
target_link_libraries(HexagonPaint
PUBLIC
# "sfml-graphics"
# "sfml-system"
# "sfml-window"
ImGui-SFML::ImGui-SFML
)
20 changes: 18 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,28 @@ You cannot use the bulit-in line drawing procedure.

https://drive.google.com/open?id=1KWUTyayYVD_g-uJN614gGsWqAmayvnhp

## Prerequisites
## Features

- Draw using pen tool
- Draw line
- Clear canvas
- Color selection
- Load and save image in PNG format

## Screenshot

![Draw using pen tool](assets/1.gif)
![Draw lines](assets/2.gif)
![Clear canvas](assets/3.gif)

## Building

### Prerequisites

- CMake >= 3.10
- C++17 supported compiler

## Installation
### Installation

- Clone to local
- Pull the dependencies
Expand Down
Binary file added assets/1.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/2.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/3.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 272de18

Please sign in to comment.