Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
GameDevWeek
Sommersemester 2019
Cpp
PhaseShifter
Commits
d2de1098
Commit
d2de1098
authored
Sep 20, 2019
by
Kevin Balz
Browse files
Proper end of song
parent
13e5455c
Pipeline
#3315
passed with stage
in 2 minutes and 51 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/gameplay/beat_system.cpp
View file @
d2de1098
...
...
@@ -35,14 +35,14 @@ namespace phase_shifter::gameplay {
{
_acc
+=
dt
.
value
();
int
size
=
static_cast
<
int
>
(
_time_stamps
.
size
());
auto
beat
=
_beat_index
+
1
<
size
&&
_acc
>=
_time_stamps
[
_beat_index
+
1
];
auto
beat
=
_beat_index
+
1
<
size
&&
_acc
>=
_time_stamps
[
_beat_index
+
1
];
int
beats_left
=
_state
.
beats_left
;
if
(
beat
)
{
_beat_index
++
;
LOG
(
plog
::
debug
)
<<
"beat"
;
beats_left
=
size
-
1
-
_beat_index
-
_beat_offset
;
if
(
beats_left
<=
0
)
{
if
(
beats_left
<=
0
||
_beat_index
+
1
>=
size
)
{
_bus
.
send
<
Lose_msg
>
();
}
}
...
...
src/ui/hud_system.cpp
View file @
d2de1098
...
...
@@ -70,15 +70,17 @@ namespace phase_shifter::ui {
//auto beats = std::clamp(beat_state.beats_left, 0, 5);
ImGui
::
BeginChild
(
"Line"
,
{
viewport
.
z
,
bar_height
},
true
);
ImDrawList
*
drawList
=
ImGui
::
GetWindowDrawList
();
while
(
beat_index
<
static_cast
<
int
>
(
beats
.
size
()))
{
auto
x_offset
=
(
beats
[
beat_index
]
-
_passed
)
*
bar_speed
;
auto
height
=
beat_bar_height
*
(
1.
f
-
glm
::
smoothstep
(
0.
f
,
beat_bar_length
,
x_offset
));
auto
bar_color
=
beat_index
<
static_cast
<
int
>
(
beats
.
size
()
*
0.8
f
)
?
0xFFFFFFFF
:
0xFF0000FF
;
ImVec2
p
(
cursor
.
x
+
viewport
.
z
/
2
-
x_offset
,
cursor
.
y
-
height
/
2.
f
);
drawList
->
AddLine
(
p
,
{
p
.
x
,
p
.
y
+
height
},
0xFFFFFFFF
,
1
);
drawList
->
AddLine
(
p
,
{
p
.
x
,
p
.
y
+
height
},
bar_color
,
1
);
p
.
x
=
cursor
.
x
+
viewport
.
z
/
2
+
x_offset
;
drawList
->
AddLine
(
p
,
{
p
.
x
,
p
.
y
+
height
},
0xFFFFFFFF
,
1
);
drawList
->
AddLine
(
p
,
{
p
.
x
,
p
.
y
+
height
},
bar_color
,
1
);
if
(
x_offset
>
beat_bar_length
+
50
)
{
break
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment