diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index 81541d5..14a3fc7 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -10,7 +10,7 @@ set(GRAIL_FILES debug.cc dialog_line.cc dialog_frontend.cc - dialog_frontend_text.cc + dialog_frontend_subtitle.cc event.cc font.cc game.cc diff --git a/lib/dialog_frontend_text.cc b/lib/dialog_frontend_subtitle.cc similarity index 65% rename from lib/dialog_frontend_text.cc rename to lib/dialog_frontend_subtitle.cc index 31d7a7a..44e145f 100644 --- a/lib/dialog_frontend_text.cc +++ b/lib/dialog_frontend_subtitle.cc @@ -1,10 +1,14 @@ // vim: set noexpandtab: -#include "dialog_frontend_text.h" +#include "dialog_frontend_subtitle.h" namespace grail { - void DialogFrontendText::renderAt(SDL_Surface* target, uint32_t ticks, VirtualPosition p) { + DialogFrontendSubtitle::DialogFrontendSubtitle() { + subtitlePosition = VirtualPosition(100, 100); + } + + void DialogFrontendSubtitle::renderAt(SDL_Surface* target, uint32_t ticks, VirtualPosition p) { // remove unused text objects for (std::map::iterator iter = lines.begin(); @@ -18,9 +22,9 @@ namespace grail { for (std::map::iterator iter = lines.begin(); iter != lines.end(); iter++) { - VirtualPosition actorPosition = (*iter).first->getPosition(); (*iter).second->eachFrame(ticks); // temporarily here - (*iter).second->renderAt(target, ticks, actorPosition); + + } } } // namespace grail diff --git a/lib/dialog_frontend_subtitle.h b/lib/dialog_frontend_subtitle.h new file mode 100644 index 0000000..aa9f899 --- /dev/null +++ b/lib/dialog_frontend_subtitle.h @@ -0,0 +1,24 @@ +// vim: set noexpandtab: + +#ifndef DIALOG_FRONTEND_SUBTITLE_H +#define DIALOG_FRONTEND_SUBTITLE_H + +#include "dialog_frontend.h" + +namespace grail { + + // Displays actors' lines in subtitles on the screen + class DialogFrontendSubtitle : public DialogFrontend { + + public: + DialogFrontendSubtitle(); + virtual void renderAt(SDL_Surface* target, uint32_t ticks, VirtualPosition p); + + protected: + VirtualPosition subtitlePosition; + }; + +} // namespace grail + +#endif // DIALOG_FRONTEND_SUBTITLE_H + diff --git a/lib/dialog_frontend_text.h b/lib/dialog_frontend_text.h deleted file mode 100644 index 07dea33..0000000 --- a/lib/dialog_frontend_text.h +++ /dev/null @@ -1,20 +0,0 @@ -// vim: set noexpandtab: - -#ifndef DIALOG_FRONTEND_TEXT_H -#define DIALOG_FRONTEND_TEXT_H - -#include "dialog_frontend.h" - -namespace grail { - - // Displays actors' lines in text floating above their heads - class DialogFrontendText : public DialogFrontend { - - public: - virtual void renderAt(SDL_Surface* target, uint32_t ticks, VirtualPosition p); - }; - -} // namespace grail - -#endif // DIALOG_FRONTEND_TEXT_H - diff --git a/lib/game.cc b/lib/game.cc index c2531d4..458c271 100644 --- a/lib/game.cc +++ b/lib/game.cc @@ -8,7 +8,7 @@ #include "resource_manager.h" #include "user_interface.h" #include "debug.h" -#include "dialog_frontend_text.h" +#include "dialog_frontend_subtitle.h" using std::cout; using std::cerr; @@ -24,7 +24,7 @@ Game::Game() : viewport(0), resourceManager(0), loop(true) { SDL_Init(SDL_INIT_EVERYTHING); // temporarily use default dialog frontend - boost::shared_ptr frontend(new DialogFrontendText()); + boost::shared_ptr frontend(new DialogFrontendSubtitle()); dialogFrontend = frontend; }