2014-07-13 18:39:45 +03:00
|
|
|
#pragma once
|
|
|
|
|
2014-07-13 20:53:37 +03:00
|
|
|
#include "../widgets/AdventureMapClasses.h"
|
2014-07-15 10:14:49 +03:00
|
|
|
#include "../widgets/TextControls.h"
|
|
|
|
#include "../widgets/MiscWidgets.h"
|
|
|
|
#include "../widgets/Images.h"
|
|
|
|
#include "CWindowObject.h"
|
2012-07-06 22:12:04 +03:00
|
|
|
|
|
|
|
/*
|
2012-07-08 09:33:41 +03:00
|
|
|
* CQuestLog.h, part of VCMI engine
|
2012-07-06 22:12:04 +03:00
|
|
|
*
|
|
|
|
* Authors: listed in file AUTHORS in main folder
|
|
|
|
*
|
|
|
|
* License: GNU General Public License v2.0 or later
|
|
|
|
* Full text of license available in license.txt file, in main folder
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
class CCreature;
|
|
|
|
class CStackInstance;
|
2014-08-03 14:16:19 +03:00
|
|
|
class CButton;
|
2012-07-06 22:12:04 +03:00
|
|
|
class CGHeroInstance;
|
|
|
|
class CComponent;
|
|
|
|
class LRClickableAreaWText;
|
2014-08-03 14:16:19 +03:00
|
|
|
class CButton;
|
2012-07-06 22:12:04 +03:00
|
|
|
class CPicture;
|
|
|
|
class CCreaturePic;
|
|
|
|
class LRClickableAreaWTextComp;
|
|
|
|
class CSlider;
|
|
|
|
class CLabel;
|
|
|
|
struct QuestInfo;
|
|
|
|
|
2012-07-07 11:45:45 +03:00
|
|
|
const int QUEST_COUNT = 9;
|
|
|
|
|
2013-08-29 16:46:27 +03:00
|
|
|
class CQuestLabel : public LRClickableAreaWText, public CMultiLineLabel
|
2012-07-07 11:45:45 +03:00
|
|
|
{
|
|
|
|
public:
|
2013-06-26 14:18:27 +03:00
|
|
|
std::function<void()> callback;
|
2012-07-07 11:45:45 +03:00
|
|
|
|
2013-08-29 19:41:14 +03:00
|
|
|
CQuestLabel (Rect position, EFonts Font = FONT_SMALL, EAlignment Align = TOPLEFT, const SDL_Color &Color = Colors::WHITE, const std::string &Text = "")
|
|
|
|
: CMultiLineLabel (position, FONT_SMALL, TOPLEFT, Colors::WHITE, Text){};
|
2012-07-07 11:45:45 +03:00
|
|
|
void clickLeft(tribool down, bool previousState);
|
2012-07-08 09:33:41 +03:00
|
|
|
void showAll(SDL_Surface * to);
|
2012-07-07 11:45:45 +03:00
|
|
|
};
|
|
|
|
|
2012-07-21 23:16:54 +03:00
|
|
|
class CQuestIcon : public CAnimImage
|
2012-07-06 22:12:04 +03:00
|
|
|
{
|
2012-07-08 19:36:20 +03:00
|
|
|
public:
|
2014-03-23 15:59:03 +03:00
|
|
|
std::function<void()> callback; //TODO: merge with other similar classes?
|
2012-07-08 19:36:20 +03:00
|
|
|
|
2012-07-21 23:16:54 +03:00
|
|
|
CQuestIcon (const std::string &defname, int index, int x=0, int y=0);
|
2012-07-08 19:36:20 +03:00
|
|
|
|
2012-07-07 11:45:45 +03:00
|
|
|
void clickLeft(tribool down, bool previousState);
|
2012-07-08 19:36:20 +03:00
|
|
|
void showAll(SDL_Surface * to);
|
|
|
|
};
|
|
|
|
|
|
|
|
class CQuestMinimap : public CMinimap
|
|
|
|
{
|
|
|
|
std::vector <CQuestIcon *> icons;
|
|
|
|
|
|
|
|
void clickLeft(tribool down, bool previousState){}; //minimap ignores clicking on its surface
|
|
|
|
void iconClicked();
|
2012-07-06 23:19:54 +03:00
|
|
|
void mouseMoved (const SDL_MouseMotionEvent & sEvent){};
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
2012-07-07 11:45:45 +03:00
|
|
|
const QuestInfo * currentQuest;
|
|
|
|
|
2012-07-08 19:36:20 +03:00
|
|
|
CQuestMinimap (const Rect & position);
|
2012-07-06 23:19:54 +03:00
|
|
|
//should be called to invalidate whole map - different player or level
|
2012-07-07 11:45:45 +03:00
|
|
|
void update();
|
|
|
|
void setLevel(int level);
|
2012-07-08 19:36:20 +03:00
|
|
|
void addQuestMarks (const QuestInfo * q);
|
2012-07-06 23:19:54 +03:00
|
|
|
|
2012-07-08 19:36:20 +03:00
|
|
|
void showAll(SDL_Surface * to);
|
2012-07-06 22:12:04 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
class CQuestLog : public CWindowObject
|
|
|
|
{
|
2012-07-07 11:45:45 +03:00
|
|
|
int questIndex;
|
|
|
|
const QuestInfo * currentQuest;
|
|
|
|
|
2012-07-06 23:19:54 +03:00
|
|
|
const std::vector<QuestInfo> quests;
|
2012-07-07 11:45:45 +03:00
|
|
|
std::vector<CQuestLabel *> labels;
|
2012-07-06 22:12:04 +03:00
|
|
|
CTextBox * description;
|
|
|
|
CQuestMinimap * minimap;
|
|
|
|
CSlider * slider; //scrolls quests
|
2014-08-03 14:16:19 +03:00
|
|
|
CButton *ok;
|
2012-07-06 22:12:04 +03:00
|
|
|
|
2012-07-21 23:16:54 +03:00
|
|
|
void init ();
|
2012-07-06 22:12:04 +03:00
|
|
|
public:
|
|
|
|
|
2012-07-06 23:19:54 +03:00
|
|
|
CQuestLog (const std::vector<QuestInfo> & Quests);
|
2012-07-06 22:12:04 +03:00
|
|
|
|
|
|
|
~CQuestLog(){};
|
|
|
|
|
2012-07-07 11:45:45 +03:00
|
|
|
void selectQuest (int which);
|
2012-07-06 22:12:04 +03:00
|
|
|
void updateMinimap (int which){};
|
|
|
|
void printDescription (int which){};
|
2012-07-07 11:45:45 +03:00
|
|
|
void sliderMoved (int newpos);
|
|
|
|
void recreateQuestList (int pos);
|
|
|
|
void showAll (SDL_Surface * to);
|
2014-07-13 18:39:45 +03:00
|
|
|
};
|