/
Mr.Stalin
/
FreeFT
Обзор
Документация
Войти
/
Mr.Stalin
/
FreeFT
Код
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/io/controller.h
84 строки
2 KB
Krzysztof Jakubowski
Updated game to latest libfwk version (2025.01)
09 янв 2025, 23:41
09 янв 2025, 23:41
4d2eb97
Код
Авторство
О чём код?
// Copyright (C) Krzysztof Jakubowski <nadult@fastmail.fm> // This file is part of FreeFT. See license.txt for details. #pragma once #include "game/game_mode.h" #include "game/visibility.h" #include "game/world.h" #include <fwk/sys/input.h> namespace hud { class Hud; class HudConsole; class HudTargetInfo; } namespace io { class Controller { public: Controller(GfxDevice &, game::PWorld world, bool debug_info); ~Controller(); void updateView(double time_diff); void update(double time_diff); void draw(Canvas2D &) const; int exitRequested() const { return m_is_exiting; } double timeMultiplier() const { return m_time_multiplier; } void setTimeMultiplier(double mul) { m_time_multiplier = mul; } static void setProfilerStats(string); protected: void updatePC(); void onInput(const InputEvent &); void drawDebugInfo(Canvas2D &) const; void sendOrder(game::POrder &&); game::Actor *getActor(); struct ShownMessage { ShownMessage() : anim_time(0.0f) {} ShownMessage(game::UserMessage msg) : message(msg), anim_time(0.0f) {} bool empty() const { return message.text.empty(); } const string text() const { return message.text; } game::UserMessage message; float anim_time; }; GfxDevice &m_gfx_device; //TODO: m_world can be a reference, not a pointer game::PWorld m_world; game::WorldViewer m_viewer; game::GameMode *m_game_mode; game::PPlayableCharacter m_pc; game::EntityRef m_actor_ref; shared_ptr<game::PCController> m_pc_controller; shared_ptr<hud::HudConsole> m_console; shared_ptr<hud::Hud> m_hud; shared_ptr<hud::HudTargetInfo> m_target_info; int2 m_view_pos; int2 m_last_mouse_pos; double m_time_multiplier; bool m_debug_ai, m_debug_navi; bool m_show_debug_info; Ray3F m_screen_ray; game::Intersection m_isect, m_full_isect; float3 m_target_pos, m_last_look_at; game::Path m_last_path; ShownMessage m_main_message; int m_is_exiting; }; }