Skip to content

Commit

Permalink
Started to replace the prototype text frontend with the subtitle fron…
Browse files Browse the repository at this point in the history
…tend
  • Loading branch information
feedelli committed Feb 5, 2012
1 parent 430f8ab commit f59c081
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 27 deletions.
2 changes: 1 addition & 1 deletion lib/CMakeLists.txt
Expand Up @@ -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
Expand Down
12 changes: 8 additions & 4 deletions lib/dialog_frontend_text.cc → 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<Actor::Ptr, Text::Ptr>::iterator iter = lines.begin();
Expand All @@ -18,9 +22,9 @@ namespace grail {
for (std::map<Actor::Ptr, Text::Ptr>::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
Expand Down
24 changes: 24 additions & 0 deletions 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

20 changes: 0 additions & 20 deletions lib/dialog_frontend_text.h

This file was deleted.

4 changes: 2 additions & 2 deletions lib/game.cc
Expand Up @@ -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;
Expand All @@ -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<DialogFrontend> frontend(new DialogFrontendText());
boost::shared_ptr<DialogFrontend> frontend(new DialogFrontendSubtitle());
dialogFrontend = frontend;
}

Expand Down

0 comments on commit f59c081

Please sign in to comment.