2021-01-18 00:48:42 -05:00
|
|
|
#ifndef VIEWER_HPP
|
|
|
|
|
#define VIEWER_HPP
|
|
|
|
|
|
2021-01-22 17:35:23 -05:00
|
|
|
#include "world.hpp"
|
|
|
|
|
#include "animqueue.hpp"
|
|
|
|
|
#include <vector>
|
|
|
|
|
#include <string>
|
|
|
|
|
#include <unordered_map>
|
|
|
|
|
#include <memory>
|
|
|
|
|
|
2021-01-18 00:48:42 -05:00
|
|
|
class Viewer {
|
2021-01-22 17:35:23 -05:00
|
|
|
private:
|
|
|
|
|
std::unique_ptr<World> world_;
|
|
|
|
|
std::vector<int64_t> tangibles_;
|
|
|
|
|
std::unordered_map<int64_t, AnimView> anim_view_;
|
|
|
|
|
|
|
|
|
|
|
2021-01-18 00:48:42 -05:00
|
|
|
public:
|
2021-01-22 17:35:23 -05:00
|
|
|
Viewer();
|
|
|
|
|
~Viewer();
|
2021-01-18 00:48:42 -05:00
|
|
|
|
2021-01-22 17:35:23 -05:00
|
|
|
// Get the lua state for interaction.
|
|
|
|
|
//
|
|
|
|
|
lua_State *get_lua_state() { return world_->get_lua_state(); }
|
|
|
|
|
|
2021-01-18 00:48:42 -05:00
|
|
|
// Get the player ID of the current player.
|
|
|
|
|
//
|
|
|
|
|
int64_t get_player_id();
|
|
|
|
|
|
2021-01-22 17:35:23 -05:00
|
|
|
// Update the view.
|
|
|
|
|
//
|
|
|
|
|
void update_view();
|
|
|
|
|
|
2021-01-18 00:48:42 -05:00
|
|
|
// Get a list of the tangibles in viewing radius of the player.
|
|
|
|
|
//
|
2021-01-22 17:35:23 -05:00
|
|
|
const std::vector<int64_t> &get_tangibles_near_player();
|
2021-01-18 00:48:42 -05:00
|
|
|
|
|
|
|
|
// Get the animation viewer of the specified tangible.
|
|
|
|
|
//
|
|
|
|
|
AnimView *get_animation_view(int64_t id);
|
|
|
|
|
|
|
|
|
|
// Get the menu of the specified tangible.
|
|
|
|
|
//
|
|
|
|
|
std::vector<std::string> get_menu(int64_t id);
|
|
|
|
|
|
|
|
|
|
// Select the specified menu item.
|
|
|
|
|
//
|
|
|
|
|
void choose_menu_item(int64_t id, const std::string &item);
|
|
|
|
|
|
|
|
|
|
// Advance the simulation clock. Called 1/sec.
|
|
|
|
|
//
|
|
|
|
|
void advance_clock();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#endif // VIEWER_HPP
|