Skip to content

Commit 1cc68b6

Browse files
authored
Merge pull request #62 from Renardjojo/develop
V1.3.0
2 parents 7f930ac + d50fa13 commit 1cc68b6

25 files changed

+648
-227
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
66
set(CMAKE_CXX_EXTENSIONS OFF)
77

88
set(PROJECT_NAME "PetForDesktop")
9-
set(PROJECT_VERSION 1.2.1)
9+
set(PROJECT_VERSION 1.3.0)
1010
set(REL_RESOURCES_DIR "content")
1111

1212
set(ABS_RESOURCE_DIR "${CMAKE_SOURCE_DIR}/${REL_RESOURCES_DIR}")

content/setting/animation.yaml

Lines changed: 53 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,45 +3,70 @@ Nodes:
33
AnimationNode:
44
name: idle1
55
sprite: idle.png
6+
sizeFactor: 2
7+
tileCount: 5
68
framerate: 5
79
loop: true
810
AnimationNode:
911
name: idle2
1012
sprite: idle2.png
11-
framerate: 8
13+
sizeFactor: 2
14+
tileCount: 14
15+
framerate: 7
1216
loop: true
1317
AnimationNode:
1418
name: sleep
1519
sprite: sleep.png
16-
framerate: 6
20+
sizeFactor: 2
21+
tileCount: 6
22+
framerate: 4
1723
loop: true
1824
GrabNode:
1925
name: grab
2026
sprite: grab.png
27+
sizeFactor: 2
28+
tileCount: 4
2129
framerate: 10
2230
loop: true
23-
PetWalkNode:
31+
MovementDirectionNode:
2432
name: walk
2533
sprite: walk.png
34+
sizeFactor: 2
35+
tileCount: 8
2636
framerate: 10
27-
direction: [1, 0]
28-
thrust: 0.2
37+
directions: [[0.2, 0], [-0.2, 0]]
38+
applyGravity: true
39+
loop: true
40+
MovementDirectionNode:
41+
name: fly
42+
sprite: flyBubble.png
43+
sizeFactor: 1
44+
tileCount: 1
45+
framerate: 10
46+
directions: [[0.15, -0.1], [0.1, -0.1], [-0.1, -0.1], [-0.15, -0.1]]
47+
applyGravity: false
2948
loop: true
3049
PetJumpNode:
3150
name: jump
3251
sprite: jump.png
52+
sizeFactor: 2
53+
tileCount: 4
3354
framerate: 10
3455
direction: [1, 0]
3556
verticalThrust: 0.15
3657
horizontalThrust: 0.3
3758
AnimationNode:
3859
name: air
3960
sprite: air.png
61+
sizeFactor: 2
62+
tileCount: 1
4063
framerate: 10
4164
loop: true
4265
AnimationNode:
4366
name: landing
4467
sprite: landing.png
68+
sizeFactor: 2
69+
tileCount: 6
4570
framerate: 10
4671
loop: false
4772
Transitions:
@@ -50,9 +75,9 @@ Transitions:
5075
to: grab
5176
RandomDelayTransition:
5277
from: idle1
53-
to: [walk, jump, sleep]
54-
duration: 3000
55-
interval: 1000
78+
to: [walk, walk, jump, sleep]
79+
duration: 4000
80+
interval: 2000
5681
IsNotGroundedTransition:
5782
from: idle1
5883
to: air
@@ -61,20 +86,34 @@ Transitions:
6186
to: grab
6287
RandomDelayTransition:
6388
from: idle2
64-
to: [walk, jump, sleep]
65-
duration: 3000
89+
to: [walk, jump, jump, fly]
90+
duration: 2000
6691
interval: 1000
6792
IsNotGroundedTransition:
6893
from: idle2
6994
to: air
7095
StartLeftClicTransition:
7196
from: walk
7297
to: grab
98+
TouchScreenEdgeTransition:
99+
from: walk
100+
to: [idle1, idle2]
73101
RandomDelayTransition:
74102
from: walk
75103
to: [idle1, idle2]
76-
duration: 3000
77-
interval: 500
104+
duration: 2000
105+
interval: 1000
106+
TouchScreenEdgeTransition:
107+
from: fly
108+
to: [idle1, idle2]
109+
StartLeftClicTransition:
110+
from: fly
111+
to: grab
112+
RandomDelayTransition:
113+
from: fly
114+
to: [idle1, idle2]
115+
duration: 6000
116+
interval: 2000
78117
StartLeftClicTransition:
79118
from: jump
80119
to: grab
@@ -96,5 +135,5 @@ Transitions:
96135
RandomDelayTransition:
97136
from: sleep
98137
to: [idle1, idle2]
99-
duration: 9000
100-
interval: 1000
138+
duration: 30000
139+
interval: 15000

content/setting/setting.yaml

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,25 @@
11
Game:
22
FPS: 60 # min 1
3-
Scale: 4 # min 1
3+
Scale: 2 # min 1
44
RandomSeed: -1 # -1: use random seed
55
Physic:
66
PhysicFrameRate: 60 # min 0
77
Friction: 0.85 # [0, 1] : 0 no friction, 1 max friction
88
GravityX: 0
99
GravityY: 9.81
10-
Bounciness: 0.7 # [0, 1] : 0 no bounciness, 1 full energie restitution
11-
ContinusCollisionMaxVelocity: 40 # min 0
12-
FootBasasementWidth: 4 # min 2
13-
FootBasasementHeight: 2 # min 2
10+
Bounciness: 0.6 # [0, 1] : 0 no bounciness, 1 full energie restitution
11+
ContinuousCollisionMaxVelocity: 40 # min 0
12+
FootBasementWidth: 6 # min 2
13+
FootBasementHeight: 2 # min 2
1414
CollisionPixelRatioStopMovement: 0.3 # min 0, max 1. Ratio of pixel with collision to detect a real collision
1515
IsGroundedDetection: 1.0 # min 0
16+
InputReleaseImpulse: 1.0 # min 0. Velocity factor after release the pet
17+
GamePlay:
18+
CoyoteTimeCursorMovement: 0.05 # min 0. Record duration of the velocity before released the pet to preserve velocity with the mouse movement
1619
Window:
1720
ShowFrameBufferBackground: false
18-
UseFowardWindow: true
19-
ShowWindow: false
20-
UseMousePassThoughWindow: true
21+
UseForwardWindow: true # Define if the application should be displayed in forground
22+
ShowWindow: false # Display the window edge or not
23+
UseMousePassThoughWindow: true # Define if user can selection pet only with selected pixel or with the entire windows
2124
Debug:
22-
ShowEdgeDetection: false
25+
ShowEdgeDetection: false # Debug mode to display the result of the collision alogyrthm on the entire window

content/sprites/flyBubble.png

Lines changed: 3 additions & 0 deletions
Loading

content/sprites/jumpAir.png

Lines changed: 0 additions & 3 deletions
This file was deleted.

content/sprites/jumpEnd.png

Lines changed: 0 additions & 3 deletions
This file was deleted.

content/sprites/startJump.png

Lines changed: 0 additions & 3 deletions
This file was deleted.

include/Engine/Monitors.hpp

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
#pragma once
2+
3+
#include "Engine/Vector2.hpp"
4+
5+
#include <GLFW/glfw3.h>
6+
7+
#include <vector>
8+
9+
class Monitors
10+
{
11+
protected:
12+
std::vector<GLFWmonitor*> monitors;
13+
14+
private:
15+
static Monitors* s_instances;
16+
17+
public:
18+
static Monitors& getInstance()
19+
{
20+
return *s_instances;
21+
}
22+
23+
public:
24+
void init()
25+
{
26+
s_instances = this;
27+
28+
int monitorCount;
29+
GLFWmonitor** pMonitors = glfwGetMonitors(&monitorCount);
30+
monitors.reserve(monitorCount);
31+
32+
for (int i = 0; i < monitorCount; ++i)
33+
{
34+
addMonitor(pMonitors[i]);
35+
}
36+
}
37+
38+
void getMainMonitorWorkingArea(Vec2i& position, Vec2i& size) const
39+
{
40+
getMonitorPosition(0, position);
41+
getMonitorSize(0, size);
42+
}
43+
44+
Vec2i getMonitorsSize() const
45+
{
46+
Vec2i size = Vec2i::zero();
47+
const GLFWvidmode* currentVideoMode;
48+
for (int i = 0; i < monitors.size(); i++)
49+
{
50+
currentVideoMode = glfwGetVideoMode(monitors[i]);
51+
size.x += currentVideoMode->width;
52+
size.y += currentVideoMode->height;
53+
}
54+
return size;
55+
}
56+
57+
void getMonitorPosition(int index, Vec2i& position) const
58+
{
59+
glfwGetMonitorPos(monitors[index], &position.x, &position.y);
60+
}
61+
62+
void getMonitorSize(int index, Vec2i& size) const
63+
{
64+
const GLFWvidmode* currentVideoMode;
65+
currentVideoMode = glfwGetVideoMode(monitors[index]);
66+
size.x = currentVideoMode->width;
67+
size.y = currentVideoMode->height;
68+
}
69+
70+
Vec2i getMonitorPhysicalSize() const
71+
{
72+
Vec2i sizeMM = Vec2i::zero();
73+
int width_mm, height_mm;
74+
for (int i = 0; i < monitors.size(); i++)
75+
{
76+
glfwGetMonitorPhysicalSize(monitors[i], &width_mm, &height_mm);
77+
sizeMM.x += width_mm;
78+
sizeMM.y += height_mm;
79+
}
80+
return sizeMM;
81+
}
82+
83+
void addMonitor(GLFWmonitor* monitor)
84+
{
85+
monitors.emplace_back(monitor);
86+
}
87+
88+
void removeMonitor(const GLFWmonitor* monitor)
89+
{
90+
for (int i = 0; i < monitors.size(); ++i)
91+
{
92+
if (monitors[i] == monitor)
93+
{
94+
monitors.erase(monitors.begin() + i);
95+
break;
96+
}
97+
}
98+
}
99+
100+
int getMonitorsCount() const
101+
{
102+
return monitors.size();
103+
}
104+
};

0 commit comments

Comments
 (0)