nanoMMO 0.97.8
Building an MMO: The Engineering Series
Loading...
Searching...
No Matches
compass.h
Go to the documentation of this file.
1#ifndef NANOMMO_CLIENT_COMPASS_H_
2#define NANOMMO_CLIENT_COMPASS_H_
3
4#include <imgui.h>
5#include <raylib.h>
6
7#include <cstdint>
8#include <optional>
9#include <vector>
10
11#include "client/animator.h"
12
13namespace nanommo {
14
15/// Which way the camera looks, as a compass has it: in radians, clockwise from
16/// north, which is up the map, along minus z, so that east, along plus x, is a
17/// quarter turn.
18float Heading(const Camera3D& camera);
19
20/// Which way a place is from another, the same way.
21float Bearing(Vector3 from, Vector3 to);
22
23/// Where a bearing is across the compass, while the camera looks along the
24/// heading: from -1 at the compass's left end to 1 at its right, with the
25/// heading in the middle, or none when it's further round than half the span.
26std::optional<float> CompassAt(float heading, float bearing, float span);
27
28/// Something the compass shows the way to.
32 float bearing = 0.0f;
33 /// In metres.
34 float distance = 0.0f;
35 ImU32 color = IM_COL32_WHITE;
36};
37
38/// What the compass shows the way to, from you: the monster you picked, the
39/// NPCs with a quest for you, the land's gates, each in the sky of the land it
40/// goes to, and where you're walking to.
41std::vector<CompassMark> CompassMarks(const std::vector<Figure>& figures,
42 int land, uint32_t target,
43 std::optional<Vector3> destination);
44
45/// The compass along the top of the screen: the half of the world in front of
46/// the camera, with its points, and the marks on it. The monster you picked
47/// and the quests stay at its ends while they're behind you, so that you
48/// know which way to turn.
49void DrawCompass(float heading, const std::vector<CompassMark>& marks);
50
51} // namespace nanommo
52
53#endif // NANOMMO_CLIENT_COMPASS_H_
Definition chat.cc:9
float Heading(const Camera3D &camera)
Definition compass.cc:111
void DrawCompass(float heading, const std::vector< CompassMark > &marks)
Definition compass.cc:166
std::vector< CompassMark > CompassMarks(const std::vector< Figure > &figures, int land, uint32_t target, std::optional< Vector3 > destination)
Definition compass.cc:125
float Bearing(Vector3 from, Vector3 to)
Which way a place is from another, the same way.
Definition compass.cc:107
std::optional< float > CompassAt(float heading, float bearing, float span)
Definition compass.cc:115
Something the compass shows the way to.
Definition compass.h:29
float distance
In metres.
Definition compass.h:34