VOX
A little voxel engine
Loading...
Searching...
No Matches
UpdateThread.hpp
Go to the documentation of this file.
1#pragma once
2
3#include "define.hpp"
4#include "window.hpp"
5#include "Settings.hpp"
6#include "RenderAPI.hpp"
7#include "ClientWorld.hpp"
8#include "Client.hpp"
9// #include "ClientPacketHandler.hpp"
10#include "SoundEngine.hpp"
11#include "EventManager.hpp"
12#include <chrono>
13#include "Tracy.hpp"
14#include "tracy_globals.hpp"
15
17{
18public:
19
21 Client & client,
22 const Settings & settings,
23 Window & window,
24 ClientWorld & world,
25 RenderAPI & render_api,
26 Sound::Engine & sound_engine,
27 Event::Manager & event_manager,
28 std::chrono::nanoseconds start_time
29 );
31
32 UpdateThread(UpdateThread& other) = delete;
33 UpdateThread(UpdateThread&& other) = delete;
36
37private:
38
39 const Settings & m_settings;
40 Window & m_window;
41 ClientWorld & m_world;
42 RenderAPI & m_render_api;
43 Client & m_client;
44 // ClientPacketHandler m_packet_handler;
45 Sound::Engine & m_sound_engine;
46 Event::Manager & m_event_manager;
47
48 std::chrono::nanoseconds m_start_time;
49 std::chrono::nanoseconds m_current_time;
50 std::chrono::nanoseconds m_last_frame_time;
51 std::chrono::nanoseconds m_delta_time;
52
53 // For DebugGui
54 int m_update_count;
55 std::chrono::nanoseconds m_start_time_counting_ups;
56
57 int m_move_forward = 0;
58 int m_move_left = 0;
59 int m_move_backward = 0;
60 int m_move_right = 0;
61 int m_jump = 0;
62 int m_sneak = 0;
63 int m_attack = 0;
64 int m_use = 0;
65
66 double m_mouse_x;
67 double m_mouse_y;
68 double m_last_mouse_x;
69 double m_last_mouse_y;
70
71 std::chrono::nanoseconds m_last_target_block_update_time = std::chrono::nanoseconds(0);
72 std::chrono::milliseconds m_target_block_update_interval = std::chrono::milliseconds(10);
73
74 std::jthread m_thread;
75
80 void launch();
81
85 void init();
86
90 void loop();
91
92 void updateTime();
93 void readInput();
94
95 void movePlayer();
96 void handlePackets();
97};
Definition: ClientWorld.hpp:26
The Client side interface with the network module.
Definition: Client.hpp:37
Definition: EventManager.hpp:63
Definition: RenderAPI.hpp:288
Class to hold the settings of the application.
Definition: Settings.hpp:12
Definition: SoundEngine.hpp:42
Definition: UpdateThread.hpp:17
UpdateThread & operator=(UpdateThread &other)=delete
UpdateThread(UpdateThread &&other)=delete
~UpdateThread()
Definition: UpdateThread.cpp:36
UpdateThread & operator=(UpdateThread &&other)=delete
UpdateThread(UpdateThread &other)=delete
Definition: window.hpp:11