nanoMMO 0.97.8
Building an MMO: The Engineering Series
Loading...
Searching...
No Matches
death_screen.h
Go to the documentation of this file.
1#ifndef NANOMMO_CLIENT_DEATH_SCREEN_H_
2#define NANOMMO_CLIENT_DEATH_SCREEN_H_
3
4#include <cstdint>
5
6namespace nanommo {
7
8/// What the player sees while they're dead: the world darkens, and a window
9/// in the middle counts down to when they can come back, then lets them,
10/// with a click. As they come back, in the middle of the land, the screen
11/// goes dark and the world fades back in, so that they don't jump there.
13 public:
14 /// How dark the world gets while they're dead, from 0 to 1.
15 static constexpr float kDim = 0.6f;
16 /// In seconds: how long the world takes to darken, and to come back.
17 static constexpr float kDarken = 1.0f;
18 static constexpr float kReturn = 0.8f;
19
20 /// Moves on by the frame's time, from whether the player's dead.
21 void Update(float seconds, bool dead);
22
23 /// How dark the world is, from 0 to 1.
24 float dark() const { return dark_; }
25
26 /// Darkens the world, and while the player's dead, draws the window, with
27 /// how long they have to wait, in milliseconds. Returns true once they ask
28 /// to come back.
29 bool Build(bool dead, uint32_t wait_ms) const;
30
31 private:
32 float dark_ = 0.0f;
33 bool was_dead_ = false;
34};
35
36} // namespace nanommo
37
38#endif // NANOMMO_CLIENT_DEATH_SCREEN_H_
static constexpr float kDarken
In seconds: how long the world takes to darken, and to come back.
void Update(float seconds, bool dead)
Moves on by the frame's time, from whether the player's dead.
static constexpr float kDim
How dark the world gets while they're dead, from 0 to 1.
bool Build(bool dead, uint32_t wait_ms) const
float dark() const
How dark the world is, from 0 to 1.
static constexpr float kReturn
Definition chat.cc:9