Skip to content

Commit db9f68a

Browse files
authored
Merge pull request #47 from Renardjojo/develop
v1.2.0
2 parents a4638b7 + 30ec3a7 commit db9f68a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+2672
-2551
lines changed

β€Ž.gitmodulesβ€Ž

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,6 @@
77
[submodule "deps/yaml-cpp"]
88
path = deps/yaml-cpp
99
url = https://github.com/jbeder/yaml-cpp.git
10+
[submodule "deps/cpr"]
11+
path = deps/cpr
12+
url = https://github.com/libcpr/cpr.git

β€ŽCMakeLists.txtβ€Ž

Lines changed: 44 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,40 @@ set(ABS_README_PATH "${CMAKE_SOURCE_DIR}/README.md")
1919

2020
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
2121

22+
########### Create version ############
23+
find_package(Git)
24+
25+
if(GIT_EXECUTABLE)
26+
# Generate a git-describe version string from Git repository tags
27+
execute_process(
28+
COMMAND ${GIT_EXECUTABLE} describe --tags --dirty --match "v*"
29+
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
30+
OUTPUT_VARIABLE GIT_DESCRIBE_VERSION
31+
RESULT_VARIABLE GIT_DESCRIBE_ERROR_CODE
32+
OUTPUT_STRIP_TRAILING_WHITESPACE
33+
)
34+
35+
if(NOT GIT_DESCRIBE_ERROR_CODE)
36+
string(REGEX REPLACE "^v([0-9]+)\\..*" "\\1" VERSION_MAJOR "${GIT_DESCRIBE_VERSION}")
37+
string(REGEX REPLACE "^v[0-9]+\\.([0-9]+).*" "\\1" VERSION_MINOR "${GIT_DESCRIBE_VERSION}")
38+
string(REGEX REPLACE "^v[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" VERSION_PATCH "${GIT_DESCRIBE_VERSION}")
39+
string(REGEX REPLACE "^v[0-9]+\\.[0-9]+\\.[0-9]+(.*)" "\\1" VERSION_SHA1 "${GIT_DESCRIBE_VERSION}")
40+
set(PROJECT_VERSION_SHORT "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}")
41+
set(PROJECT_VERSION_SHA ${GIT_DESCRIBE_VERSION})
42+
endif()
43+
endif()
44+
45+
# Final fallback: Just use a bogus version string that is semantically older
46+
# than anything else and spit out a warning to the developer.
47+
if(NOT DEFINED PROJECT_VERSION_SHA)
48+
set(PROJECT_VERSION_SHA v0.0.0-unknown)
49+
set(PROJECT_VERSION_SHORT v0.0.0)
50+
message(WARNING "Failed to determine PROJECT_VERSION_SHA from Git tags. Using default version \"${PROJECT_VERSION_SHA}\".")
51+
endif()
52+
2253
########### Create project ############
23-
set(PROJECT_VERSION "1.1.0")
24-
project(${PROJECT_NAME} VERSION "${PROJECT_VERSION}")
54+
project(${PROJECT_NAME} VERSION ${PROJECT_VERSION_SHORT})
55+
message(STATUS "Project ${PROJECT_NAME} ${PROJECT_VERSION_SHORT}")
2556

2657
########### Setup ############
2758
# Set env variable
@@ -82,16 +113,19 @@ target_link_libraries(${PROJECT_NAME} Boxer)
82113
add_subdirectory(${ABS_DEPS_DIR}/yaml-cpp)
83114
target_link_libraries(${PROJECT_NAME} yaml-cpp)
84115

116+
# cpr
117+
add_subdirectory(${ABS_DEPS_DIR}/cpr)
118+
target_link_libraries(${PROJECT_NAME} cpr)
119+
85120
########### Define ############
86-
target_compile_definitions(${PROJECT_NAME} PRIVATE PROJECT_VERSION="${PROJECT_VERSION}")
87121
target_compile_definitions(${PROJECT_NAME} PRIVATE RESOURCE_PATH="${REL_RESOURCES_DIR}/")
122+
target_compile_definitions(${PROJECT_NAME} PRIVATE PROJECT_NAME="${PROJECT_NAME}")
123+
target_compile_definitions(${PROJECT_NAME} PRIVATE PROJECT_VERSION="${PROJECT_VERSION_SHA}")
124+
target_compile_definitions(${PROJECT_NAME} PRIVATE PROJECT_VERSION_SHORT="${PROJECT_VERSION_SHORT}")
88125

89126
########### Build link ############
90127
# Set a symbolic link so exe can find the /Data folder
91-
add_custom_command(
92-
TARGET ${PROJECT_NAME}
93-
POST_BUILD COMMAND ${CMAKE_COMMAND}
94-
-E create_symlink ${ABS_RESOURCE_DIR} ${ABS_RESOURCES_BUILD_LINK}
95-
DEPENDS ${ABS_RESOURCES_BUILD_LINK}
96-
COMMENT "symbolic link ${ABS_RESOURCE_DIR} => ${ABS_RESOURCES_BUILD_LINK}"
97-
)
128+
add_custom_target(copy_assets
129+
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_LIST_DIR}/${REL_RESOURCES_DIR} ${CMAKE_CURRENT_BINARY_DIR}/${REL_RESOURCES_DIR}
130+
)
131+
add_dependencies(${PROJECT_NAME} copy_assets)

β€Žcontent/setting/animation.yamlβ€Ž

Lines changed: 39 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,19 @@
1-
FirstNode: idle
1+
FirstNode: idle1
22
Nodes:
33
AnimationNode:
4-
name: idle
4+
name: idle1
55
sprite: idle.png
6-
framerate: 10
6+
framerate: 5
7+
loop: true
8+
AnimationNode:
9+
name: idle2
10+
sprite: idle2.png
11+
framerate: 8
12+
loop: true
13+
AnimationNode:
14+
name: sleep
15+
sprite: sleep.png
16+
framerate: 6
717
loop: true
818
GrabNode:
919
name: grab
@@ -36,36 +46,41 @@ Nodes:
3646
loop: false
3747
Transitions:
3848
StartLeftClicTransition:
39-
from: idle
49+
from: idle1
4050
to: grab
41-
RandomDelayTransitionMultipleExit:
42-
from: idle
51+
RandomDelayTransition:
52+
from: idle1
53+
to: [walk, jump, sleep]
4354
duration: 3000
4455
interval: 1000
45-
chanceToEnterEntries:
46-
entry:
47-
to: walk
48-
chance: 1
49-
entry:
50-
to: jump
51-
chance: 1
5256
IsNotGroundedTransition:
53-
from: idle
57+
from: idle1
58+
to: air
59+
StartLeftClicTransition:
60+
from: idle2
61+
to: grab
62+
RandomDelayTransition:
63+
from: idle2
64+
to: [walk, jump, sleep]
65+
duration: 3000
66+
interval: 1000
67+
IsNotGroundedTransition:
68+
from: idle2
5469
to: air
5570
StartLeftClicTransition:
5671
from: walk
5772
to: grab
5873
RandomDelayTransition:
5974
from: walk
60-
to: idle
75+
to: [idle1, idle2]
6176
duration: 3000
6277
interval: 500
63-
StartLeftClicTransition:
64-
from: walk
65-
to: air
6678
StartLeftClicTransition:
6779
from: jump
6880
to: grab
81+
StartLeftClicTransition:
82+
from: sleep
83+
to: grab
6984
AnimationEndTransition:
7085
from: jump
7186
to: air
@@ -77,4 +92,9 @@ Transitions:
7792
to: landing
7893
AnimationEndTransition:
7994
from: landing
80-
to: idle
95+
to: [idle1, idle2]
96+
RandomDelayTransition:
97+
from: sleep
98+
to: [idle1, idle2]
99+
duration: 9000
100+
interval: 1000

β€Žcontent/setting/setting.yamlβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Game:
2-
FPS: 10 # min 1
2+
FPS: 60 # min 1
33
Scale: 4 # min 1
44
RandomSeed: -1 # -1: use random seed
55
Physic:
Lines changed: 3 additions & 0 deletions
Lines changed: 3 additions & 0 deletions
Lines changed: 3 additions & 0 deletions
Lines changed: 3 additions & 0 deletions
Lines changed: 3 additions & 0 deletions
Lines changed: 3 additions & 0 deletions

0 commit comments

Comments
Β (0)