Got rid of AnimView, added Gui
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
#include <iostream>
|
||||
#include "luastack.hpp"
|
||||
#include "util.hpp"
|
||||
#include "gui.hpp"
|
||||
#include "viewer.hpp"
|
||||
#include "traceback.hpp"
|
||||
#include "textgame.hpp"
|
||||
@@ -81,11 +82,10 @@ void TextGame::do_view_command(const StringVec &cmd) {
|
||||
std::cerr << "v command (view) takes no arguments" << std::endl;
|
||||
return;
|
||||
}
|
||||
viewer_.update_view_map();
|
||||
for (auto viewpair : viewer_.get_view_map()) {
|
||||
int64_t id = viewpair.first;
|
||||
AnimView &view = viewpair.second;
|
||||
std::cerr << id << ": " << view.get_graphic() << " " << view.get_xyz() << std::endl;
|
||||
for (int64_t id : viewer_.get_near()) {
|
||||
const Tangible *tan = viewer_.tangible_get(id);
|
||||
const AnimQueue &aq = tan->anim_queue_;
|
||||
std::cerr << id << ": " << aq.get_graphic() << " " << aq.get_plane() << " " << aq.get_xyz() << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,8 +99,13 @@ void TextGame::do_menu_command(const StringVec &cmd) {
|
||||
std::cerr << "m command (menu) expects a tangible ID or defaults to 1" << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
std::cerr << "Menu command (id " << id << ") not implemented yet." << std::endl;
|
||||
gui_id_ = id;
|
||||
viewer_.update_gui(id, &gui_);
|
||||
int index = 0;
|
||||
for (const GuiElt &elt : gui_.elts()) {
|
||||
std::cerr << index << " " << elt.label() << std::endl;
|
||||
index += 1;
|
||||
}
|
||||
}
|
||||
|
||||
void TextGame::do_choose_command(const StringVec &cmd) {
|
||||
@@ -114,11 +119,20 @@ void TextGame::do_choose_command(const StringVec &cmd) {
|
||||
std::cerr << "Choose command (index " << index << ") not implemented yet." << std::endl;
|
||||
}
|
||||
|
||||
void TextGame::do_quit_command(const StringVec &cmd) {
|
||||
if (cmd.size() != 1) {
|
||||
std::cerr << "q command (quit) takes no arguments" << std::endl;
|
||||
return;
|
||||
}
|
||||
exit(0);
|
||||
}
|
||||
|
||||
void TextGame::do_command(const StringVec &words) {
|
||||
switch (words[0][0]) {
|
||||
case 'v': do_view_command(words); break;
|
||||
case 'm': do_menu_command(words); break;
|
||||
case 'c': do_choose_command(words); break;
|
||||
case 'q': do_quit_command(words); break;
|
||||
default:
|
||||
std::cerr << "Unknown command: " << words[0] << std::endl;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user