From debec44b511f7143542504761c1d5083f8aecbcf Mon Sep 17 00:00:00 2001 From: gugus Date: Sat, 28 Jan 2012 16:08:22 +0100 Subject: [PATCH] better colors (not perfect yet), and some basic question support (not finished yet). --- apps/openmw/mwgui/dialogue.cpp | 21 +++++++++++++++++---- apps/openmw/mwgui/dialogue.hpp | 2 +- apps/openmw/mwgui/dialogue_history.cpp | 4 ++-- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/apps/openmw/mwgui/dialogue.cpp b/apps/openmw/mwgui/dialogue.cpp index 39d5419153..b94858a7b2 100644 --- a/apps/openmw/mwgui/dialogue.cpp +++ b/apps/openmw/mwgui/dialogue.cpp @@ -51,7 +51,7 @@ void DialogueWindow::onHistoryClicked(MyGUI::Widget* _sender) const IntPoint& lastPressed = InputManager::getInstance().getLastLeftPressed(); size_t cursorPosition = t->getCursorPosition(lastPressed); - if(history->getColorAtPos(cursorPosition) != "#FFFFFF") + if(history->getColorAtPos(cursorPosition) != "#B29154") { UString key = history->getColorTextAt(cursorPosition); //std::cout << "Clicked on key: " << key << std::endl; @@ -65,7 +65,7 @@ void DialogueWindow::open() topicsList->removeAllItems(); pTopicsText.clear(); history->eraseText(0,history->getTextLength()); - + updateOptions(); setVisible(true); } @@ -130,7 +130,7 @@ std::string DialogueWindow::parseText(std::string text) for(int i = 0;igetItemCount();i++) { std::string keyWord = topicsList->getItem(i); - std::string newKeyWord = "#FF0000"+keyWord+"#FFFFFF"; + std::string newKeyWord = "#686EBA"+keyWord+"#B29154"; replaceInString(text,keyWord,newKeyWord); } return text; @@ -149,6 +149,15 @@ void DialogueWindow::displayTopicText(std::string topic) } } +void DialogueWindow::askQuestion(std::string question,std::list answers) +{ + history->addDialogText(parseText(question)); + for(std::list::iterator it = answers.begin();it!=answers.end();it++) + { + history->addDialogText("#572D21"+(*it)+"#B29154"); + } +} + void DialogueWindow::updateOptions() { //FIXME Add this properly @@ -165,8 +174,12 @@ void DialogueWindow::updateOptions() history->eraseText(0,history->getTextLength()); addKeyword("gus","gus is working on the dialogue system"); - displayTopicText("gus"); + + std::list test; + test.push_back("option 1"); + test.push_back("option 2"); + askQuestion("is gus cooking?",test); /*topicsList->addItem("Ald'ruhn", i++); topicsList->addItem("Balmora", i++); topicsList->addItem("Sadrith Mora", i++); diff --git a/apps/openmw/mwgui/dialogue.hpp b/apps/openmw/mwgui/dialogue.hpp index efedf07487..a83334e395 100644 --- a/apps/openmw/mwgui/dialogue.hpp +++ b/apps/openmw/mwgui/dialogue.hpp @@ -40,7 +40,7 @@ namespace MWGui void addKeyword(std::string keyWord,std::string topicText); void removeKeyword(std::string keyWord); void addText(std::string text); - void askQuestion(); + void askQuestion(std::string question,std::list answers); protected: void onSelectTopic(MyGUI::List* _sender, size_t _index); diff --git a/apps/openmw/mwgui/dialogue_history.cpp b/apps/openmw/mwgui/dialogue_history.cpp index aaa559d243..ceb9045281 100644 --- a/apps/openmw/mwgui/dialogue_history.cpp +++ b/apps/openmw/mwgui/dialogue_history.cpp @@ -61,9 +61,9 @@ UString DialogeHistory::getColorTextAt(size_t _pos) void DialogeHistory::addDialogHeading(const UString& parText) { - UString head("\n#00FF00"); + UString head("\n#D8C09A"); head.append(parText); - head.append("#FFFFFF\n"); + head.append("#B29154\n"); addText(head); }