Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 20, 2006, 4:34:09 PM (18 years ago)
Author:
hejja
Message:

Quest-Klasse implementiert

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/gui/src/world_entities/questGUI/quest_gui.cc

    r10069 r10129  
    1212
    1313   ### File Specific:
    14    main-programmer: Andreas Hejj
     14   main-programmer    std::string             questName;
     15    std::string             questDescription;
     16    std::string             questPicture;
     17    std::string             questDifficulty;
     18    std::string             rewardDescription;
     19    std::string             rewardPicture;: Andreas Hejj
    1520
    1621*/
     
    3540#include "sound_source.h"
    3641
     42#include "glgui_widget.h"
    3743#include "glgui.h"
    3844#include "menu/glgui_imagebutton.h"
     
    4147
    4248
     49#include "quest.h"
     50
    4351#include "shell_command.h"
    4452
     
    6068 
    6169  this->questBox = NULL; 
    62 
    63   if( root != NULL)
    64     this->loadParams(root);
     70 
     71  this->bKillGui = false;
     72
     73  this->myQuest = new Quest(root);
     74  if(root)
     75    this->loadParams( root);
    6576
    6677}
     
    7283QuestGUI::~QuestGUI ()
    7384{
    74 }
    75 
    76 
    77 
     85  if( this->myQuest)
     86    delete this->myQuest;
     87}
    7888
    7989/**
     
    8393void QuestGUI::loadParams(const TiXmlElement* root)
    8494{
    85    WorldEntity::loadParams(root);
    86    
    87    LoadParam(root, "quest-name", this, QuestGUI, setQuestName)
    88        .describe("sets the name of a quest");
    89    LoadParam(root, "quest-description", this, QuestGUI, setQuestDescription)
    90        .describe("sets the description of a quest");
    91    LoadParam(root, "quest-picture", this, QuestGUI, setQuestPicture)
    92        .describe("sets the picture of a quest");
    93    LoadParam(root, "quest-difficulty", this, QuestGUI, setQuestDifficulty)
    94        .describe("sets the difficulty of a quest");
    95    LoadParam(root, "reward-description", this, QuestGUI, setRewardDescription)
    96        .describe("sets the description of a reward");
    97    LoadParam(root, "reward-picture", this, QuestGUI, setRewardPicture)
    98        .describe("sets the Picture of a reward");
    99    
    100 }
     95  WorldEntity::loadParams(root);
     96}
     97
    10198
    10299
     
    109106  {
    110107    this->questBox= new OrxGui::GLGuiBox(OrxGui::Vertical);
     108    this->bKillGui = false;
    111109   
    112110    OrxGui::GLGuiBox* headerBox = new OrxGui::GLGuiBox(OrxGui::Horizontal);
     
    114112      OrxGui::GLGuiImage* questImage = new OrxGui::GLGuiImage();
    115113      questImage->setWidgetSize(100, 100);
    116       questImage->loadImageFromFile(questPicture);
     114      questImage->loadImageFromFile(this->myQuest->getQuestPicture());
    117115      questImage->show();
     116      questImage->setBorderBottom(20);
    118117      headerBox->pack(questImage);
     118      headerBox->setBorderBottom(20);
    119119     
    120120      OrxGui::GLGuiBox* outlineBox = new OrxGui::GLGuiBox(OrxGui::Vertical);
    121121      {
    122122        OrxGui::GLGuiText* questDifficulty = new OrxGui::GLGuiText();
    123         questDifficulty->setText(this->questDifficulty);
     123        questDifficulty->setText(this->myQuest->getQuestDifficulty());
    124124        outlineBox->pack(questDifficulty);
    125125      }
    126126      headerBox->pack(outlineBox);
     127      headerBox->setBorderBottom(75);
    127128     
    128129    }
     
    131132    {
    132133      OrxGui::GLGuiText* questTxt = new OrxGui::GLGuiText();
    133       questTxt->setText(this->questDescription);
     134      questTxt->setText(this->myQuest->getQuestDescription());
    134135      labelBox->pack(questTxt);
     136      labelBox->setBorderBottom(75);
    135137    }
    136138   
     
    140142      OrxGui::GLGuiImage* rewardImage = new OrxGui::GLGuiImage();
    141143      rewardImage->setWidgetSize(50, 50);
    142       rewardImage->loadImageFromFile(rewardPicture);
     144      rewardImage->loadImageFromFile(this->myQuest->getRewardPicture());
    143145      rewardImage->show();
    144146      rewardBox->pack(rewardImage);
     147      rewardImage->setBorderBottom(50);
    145148   
    146149      OrxGui::GLGuiText* rewardTxt = new OrxGui::GLGuiText();
    147       rewardTxt->setText(this->rewardDescription);
     150      rewardTxt->setText(this->myQuest->getRewardDescription());
    148151      rewardBox->pack(rewardTxt);
     152      rewardBox->setBorderBottom(75);
     153     
    149154    }
    150155   
     
    152157    {
    153158      OrxGui::GLGuiButton* acceptButton = new OrxGui::GLGuiPushButton("Accept");
     159      acceptButton->released.connect(this, &QuestGUI::accept);
    154160      answerBox->pack(acceptButton);
     161      acceptButton->select();
    155162     
    156163      OrxGui::GLGuiButton* refuseButton = new OrxGui::GLGuiPushButton("Refuse");
     164      refuseButton->released.connect(this, &QuestGUI::refuse);
    157165      answerBox->pack(refuseButton);
    158166    }
     
    170178  else
    171179  {
    172     OrxGui::GLGuiHandler::getInstance()->deactivate();
    173     OrxGui::GLGuiHandler::getInstance()->deactivateCursor();
    174     delete this->questBox;
    175     this->questBox = NULL;
     180    this->bKillGui = true;
    176181  }
    177182 
    178183}
    179184
    180 
    181 
    182 
     185   
     186void QuestGUI::tick(float dt)
     187{
     188  if( this->bKillGui)
     189    this->killgui();
     190}
     191   
     192
     193void QuestGUI::accept()
     194{
     195  this->bKillGui = true;
     196 
     197}
     198
     199void QuestGUI::refuse()
     200{
     201  this->bKillGui = true;
     202}
     203
     204void QuestGUI::killgui()
     205{
     206  OrxGui::GLGuiHandler::getInstance()->deactivate();
     207  OrxGui::GLGuiHandler::getInstance()->deactivateCursor();
     208  delete this->questBox;
     209  this->questBox = NULL;
     210}
Note: See TracChangeset for help on using the changeset viewer.