2017-07-13 10:26:03 +02:00
|
|
|
/*
|
|
|
|
* AdventureMapClasses.h, part of VCMI engine
|
|
|
|
*
|
|
|
|
* 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
|
|
|
|
*
|
|
|
|
*/
|
2012-06-13 16:04:06 +03:00
|
|
|
#pragma once
|
|
|
|
|
2014-07-15 10:14:49 +03:00
|
|
|
#include "ObjectLists.h"
|
|
|
|
#include "../../lib/FunctionList.h"
|
2012-06-13 16:04:06 +03:00
|
|
|
|
2022-07-26 15:07:42 +02:00
|
|
|
VCMI_LIB_NAMESPACE_BEGIN
|
|
|
|
|
2012-06-13 16:04:06 +03:00
|
|
|
class CArmedInstance;
|
|
|
|
class CGGarrison;
|
|
|
|
class CGObjectInstance;
|
|
|
|
class CGHeroInstance;
|
|
|
|
class CGTownInstance;
|
|
|
|
struct Component;
|
|
|
|
struct InfoAboutArmy;
|
|
|
|
struct InfoAboutHero;
|
|
|
|
struct InfoAboutTown;
|
2022-07-26 15:07:42 +02:00
|
|
|
|
|
|
|
VCMI_LIB_NAMESPACE_END
|
|
|
|
|
|
|
|
class CAnimation;
|
|
|
|
class CAnimImage;
|
|
|
|
class CShowableAnim;
|
|
|
|
class CFilledTexture;
|
|
|
|
class CButton;
|
|
|
|
class CComponent;
|
2018-04-07 13:34:11 +02:00
|
|
|
class CHeroTooltip;
|
|
|
|
class CTownTooltip;
|
|
|
|
class CTextBox;
|
2023-01-30 18:25:47 +02:00
|
|
|
class IImage;
|
2012-06-13 16:04:06 +03:00
|
|
|
|
|
|
|
/// Base UI Element for hero\town lists
|
|
|
|
class CList : public CIntObject
|
|
|
|
{
|
|
|
|
protected:
|
2018-04-07 13:34:11 +02:00
|
|
|
class CListItem : public CIntObject, public std::enable_shared_from_this<CListItem>
|
2012-06-13 16:04:06 +03:00
|
|
|
{
|
|
|
|
CList * parent;
|
2018-04-07 13:34:11 +02:00
|
|
|
std::shared_ptr<CIntObject> selection;
|
2012-06-13 16:04:06 +03:00
|
|
|
public:
|
|
|
|
CListItem(CList * parent);
|
|
|
|
~CListItem();
|
|
|
|
|
2015-10-12 15:47:10 +02:00
|
|
|
void clickRight(tribool down, bool previousState) override;
|
|
|
|
void clickLeft(tribool down, bool previousState) override;
|
|
|
|
void hover(bool on) override;
|
2012-06-13 16:04:06 +03:00
|
|
|
void onSelect(bool on);
|
|
|
|
|
|
|
|
/// create object with selection rectangle
|
2018-04-07 13:34:11 +02:00
|
|
|
virtual std::shared_ptr<CIntObject> genSelection()=0;
|
2012-06-13 16:04:06 +03:00
|
|
|
/// reaction on item selection (e.g. enable selection border)
|
|
|
|
/// NOTE: item may be deleted in selected state
|
|
|
|
virtual void select(bool on)=0;
|
|
|
|
/// open item (town or hero screen)
|
|
|
|
virtual void open()=0;
|
|
|
|
/// show right-click tooltip
|
|
|
|
virtual void showTooltip()=0;
|
|
|
|
/// get hover text for status bar
|
|
|
|
virtual std::string getHoverText()=0;
|
|
|
|
};
|
|
|
|
|
2018-04-07 13:34:11 +02:00
|
|
|
std::shared_ptr<CListBox> listBox;
|
2012-06-13 16:04:06 +03:00
|
|
|
const size_t size;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief CList - protected constructor
|
2013-11-07 15:48:41 +03:00
|
|
|
* @param size - maximal amount of visible at once items
|
2012-06-13 16:04:06 +03:00
|
|
|
* @param position - cordinates
|
|
|
|
* @param btnUp - path to image to use as top button
|
|
|
|
* @param btnDown - path to image to use as bottom button
|
|
|
|
* @param listAmount - amount of items in the list
|
|
|
|
* @param helpUp - index in zelp.txt for button help tooltip
|
|
|
|
* @param helpDown - index in zelp.txt for button help tooltip
|
|
|
|
* @param create - function for creating items in listbox
|
|
|
|
* @param destroy - function for deleting items in listbox
|
|
|
|
*/
|
2018-04-07 13:34:11 +02:00
|
|
|
CList(int size, Point position, std::string btnUp, std::string btnDown, size_t listAmount, int helpUp, int helpDown, CListBox::CreateFunc create);
|
2012-06-13 16:04:06 +03:00
|
|
|
|
|
|
|
//for selection\deselection
|
2018-04-07 13:34:11 +02:00
|
|
|
std::shared_ptr<CListItem> selected;
|
|
|
|
void select(std::shared_ptr<CListItem> which);
|
2012-06-13 16:04:06 +03:00
|
|
|
friend class CListItem;
|
|
|
|
|
2018-04-07 13:34:11 +02:00
|
|
|
std::shared_ptr<CButton> scrollUp;
|
|
|
|
std::shared_ptr<CButton> scrollDown;
|
|
|
|
|
2012-06-13 16:04:06 +03:00
|
|
|
/// should be called when list is invalidated
|
|
|
|
void update();
|
|
|
|
|
|
|
|
public:
|
|
|
|
/// functions that will be called when selection changes
|
|
|
|
CFunctionList<void()> onSelect;
|
|
|
|
|
|
|
|
/// return index of currently selected element
|
|
|
|
int getSelectedIndex();
|
|
|
|
|
|
|
|
/// set of methods to switch selection
|
|
|
|
void selectIndex(int which);
|
|
|
|
void selectNext();
|
|
|
|
void selectPrev();
|
|
|
|
};
|
|
|
|
|
|
|
|
/// List of heroes which is shown at the right of the adventure map screen
|
|
|
|
class CHeroList : public CList
|
|
|
|
{
|
|
|
|
/// Empty hero item used as placeholder for unused entries in list
|
|
|
|
class CEmptyHeroItem : public CIntObject
|
|
|
|
{
|
2018-04-07 13:34:11 +02:00
|
|
|
std::shared_ptr<CAnimImage> movement;
|
|
|
|
std::shared_ptr<CAnimImage> mana;
|
|
|
|
std::shared_ptr<CPicture> portrait;
|
2012-06-13 16:04:06 +03:00
|
|
|
public:
|
|
|
|
CEmptyHeroItem();
|
|
|
|
};
|
|
|
|
|
|
|
|
class CHeroItem : public CListItem
|
|
|
|
{
|
2018-04-07 13:34:11 +02:00
|
|
|
std::shared_ptr<CAnimImage> movement;
|
|
|
|
std::shared_ptr<CAnimImage> mana;
|
|
|
|
std::shared_ptr<CAnimImage> portrait;
|
2012-06-13 16:04:06 +03:00
|
|
|
public:
|
|
|
|
const CGHeroInstance * const hero;
|
|
|
|
|
2018-04-07 13:34:11 +02:00
|
|
|
CHeroItem(CHeroList * parent, const CGHeroInstance * hero);
|
2012-06-13 16:04:06 +03:00
|
|
|
|
2018-04-07 13:34:11 +02:00
|
|
|
std::shared_ptr<CIntObject> genSelection() override;
|
2012-06-13 16:04:06 +03:00
|
|
|
void update();
|
2015-10-12 15:47:10 +02:00
|
|
|
void select(bool on) override;
|
|
|
|
void open() override;
|
|
|
|
void showTooltip() override;
|
|
|
|
std::string getHoverText() override;
|
2012-06-13 16:04:06 +03:00
|
|
|
};
|
|
|
|
|
2018-04-07 13:34:11 +02:00
|
|
|
std::shared_ptr<CIntObject> createHeroItem(size_t index);
|
2012-06-13 16:04:06 +03:00
|
|
|
public:
|
|
|
|
/**
|
|
|
|
* @brief CHeroList
|
2013-11-07 15:48:41 +03:00
|
|
|
* @param size, position, btnUp, btnDown @see CList::CList
|
2012-06-13 16:04:06 +03:00
|
|
|
*/
|
|
|
|
CHeroList(int size, Point position, std::string btnUp, std::string btnDown);
|
|
|
|
|
|
|
|
/// Select specific hero and scroll if needed
|
|
|
|
void select(const CGHeroInstance * hero = nullptr);
|
|
|
|
|
|
|
|
/// Update hero. Will add or remove it from the list if needed
|
|
|
|
void update(const CGHeroInstance * hero = nullptr);
|
|
|
|
};
|
|
|
|
|
|
|
|
/// List of towns which is shown at the right of the adventure map screen or in the town screen
|
|
|
|
class CTownList : public CList
|
|
|
|
{
|
|
|
|
class CTownItem : public CListItem
|
|
|
|
{
|
2018-04-07 13:34:11 +02:00
|
|
|
std::shared_ptr<CAnimImage> picture;
|
2012-06-13 16:04:06 +03:00
|
|
|
public:
|
|
|
|
const CGTownInstance * const town;
|
|
|
|
|
|
|
|
CTownItem(CTownList *parent, const CGTownInstance * town);
|
|
|
|
|
2018-04-07 13:34:11 +02:00
|
|
|
std::shared_ptr<CIntObject> genSelection() override;
|
2012-06-13 16:04:06 +03:00
|
|
|
void update();
|
2015-10-12 15:47:10 +02:00
|
|
|
void select(bool on) override;
|
|
|
|
void open() override;
|
|
|
|
void showTooltip() override;
|
|
|
|
std::string getHoverText() override;
|
2012-06-13 16:04:06 +03:00
|
|
|
};
|
|
|
|
|
2018-04-07 13:34:11 +02:00
|
|
|
std::shared_ptr<CIntObject> createTownItem(size_t index);
|
2012-06-13 16:04:06 +03:00
|
|
|
public:
|
|
|
|
/**
|
|
|
|
* @brief CTownList
|
2013-11-07 15:48:41 +03:00
|
|
|
* @param size, position, btnUp, btnDown @see CList::CList
|
2012-06-13 16:04:06 +03:00
|
|
|
*/
|
|
|
|
CTownList(int size, Point position, std::string btnUp, std::string btnDown);
|
|
|
|
|
|
|
|
/// Select specific town and scroll if needed
|
|
|
|
void select(const CGTownInstance * town = nullptr);
|
|
|
|
|
|
|
|
/// Update town. Will add or remove it from the list if needed
|
|
|
|
void update(const CGTownInstance * town = nullptr);
|
|
|
|
};
|
|
|
|
|
|
|
|
class CMinimap;
|
|
|
|
|
|
|
|
class CMinimapInstance : public CIntObject
|
|
|
|
{
|
2018-04-07 13:34:11 +02:00
|
|
|
CMinimap * parent;
|
2012-06-13 16:04:06 +03:00
|
|
|
SDL_Surface * minimap;
|
|
|
|
int level;
|
|
|
|
|
|
|
|
//get color of selected tile on minimap
|
|
|
|
const SDL_Color & getTileColor(const int3 & pos);
|
|
|
|
|
2018-04-07 13:34:11 +02:00
|
|
|
void blitTileWithColor(const SDL_Color & color, const int3 & pos, SDL_Surface * to, int x, int y);
|
2012-06-13 16:04:06 +03:00
|
|
|
|
|
|
|
//draw minimap already scaled.
|
|
|
|
//result is not antialiased. Will result in "missing" pixels on huge maps (>144)
|
|
|
|
void drawScaled(int level);
|
|
|
|
public:
|
|
|
|
CMinimapInstance(CMinimap * parent, int level);
|
|
|
|
~CMinimapInstance();
|
|
|
|
|
2018-04-07 13:34:11 +02:00
|
|
|
void showAll(SDL_Surface * to) override;
|
|
|
|
void tileToPixels (const int3 & tile, int & x, int & y, int toX = 0, int toY = 0);
|
|
|
|
void refreshTile(const int3 & pos);
|
2012-06-13 16:04:06 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
/// Minimap which is displayed at the right upper corner of adventure map
|
|
|
|
class CMinimap : public CIntObject
|
|
|
|
{
|
2012-07-08 19:36:20 +03:00
|
|
|
protected:
|
2018-04-07 13:34:11 +02:00
|
|
|
std::shared_ptr<CPicture> aiShield; //the graphic displayed during AI turn
|
|
|
|
std::shared_ptr<CMinimapInstance> minimap;
|
2012-06-13 16:04:06 +03:00
|
|
|
int level;
|
|
|
|
|
|
|
|
//to initialize colors
|
2022-09-29 11:44:46 +02:00
|
|
|
std::map<TerrainId, std::pair<SDL_Color, SDL_Color> > loadColors();
|
2012-06-13 16:04:06 +03:00
|
|
|
|
2015-10-12 15:47:10 +02:00
|
|
|
void clickLeft(tribool down, bool previousState) override;
|
|
|
|
void clickRight(tribool down, bool previousState) override;
|
|
|
|
void hover (bool on) override;
|
|
|
|
void mouseMoved (const SDL_MouseMotionEvent & sEvent) override;
|
2012-06-13 16:04:06 +03:00
|
|
|
|
2012-07-07 11:45:45 +03:00
|
|
|
void moveAdvMapSelection();
|
|
|
|
|
2012-06-13 16:04:06 +03:00
|
|
|
public:
|
|
|
|
// terrainID -> (normal color, blocked color)
|
2022-09-29 11:44:46 +02:00
|
|
|
const std::map<TerrainId, std::pair<SDL_Color, SDL_Color> > colors;
|
2012-06-13 16:04:06 +03:00
|
|
|
|
|
|
|
CMinimap(const Rect & position);
|
|
|
|
|
|
|
|
//should be called to invalidate whole map - different player or level
|
2012-07-08 19:36:20 +03:00
|
|
|
int3 translateMousePosition();
|
2012-06-13 16:04:06 +03:00
|
|
|
void update();
|
|
|
|
void setLevel(int level);
|
|
|
|
void setAIRadar(bool on);
|
|
|
|
|
2015-10-12 15:47:10 +02:00
|
|
|
void showAll(SDL_Surface * to) override;
|
2012-06-13 16:04:06 +03:00
|
|
|
|
|
|
|
void hideTile(const int3 &pos); //puts FoW
|
|
|
|
void showTile(const int3 &pos); //removes FoW
|
|
|
|
};
|
|
|
|
|
|
|
|
/// Info box which shows next week/day information, hold the current date
|
|
|
|
class CInfoBar : public CIntObject
|
|
|
|
{
|
|
|
|
//all visible information located in one object - for ease of replacing
|
|
|
|
class CVisibleInfo : public CIntObject
|
|
|
|
{
|
2018-04-07 13:34:11 +02:00
|
|
|
public:
|
|
|
|
void show(SDL_Surface * to) override;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
std::shared_ptr<CPicture> background;
|
|
|
|
std::list<std::shared_ptr<CIntObject>> forceRefresh;
|
|
|
|
|
|
|
|
CVisibleInfo();
|
|
|
|
};
|
|
|
|
|
|
|
|
class EmptyVisibleInfo : public CVisibleInfo
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
EmptyVisibleInfo();
|
|
|
|
};
|
|
|
|
|
|
|
|
class VisibleHeroInfo : public CVisibleInfo
|
|
|
|
{
|
|
|
|
std::shared_ptr<CHeroTooltip> heroTooltip;
|
|
|
|
public:
|
|
|
|
VisibleHeroInfo(const CGHeroInstance * hero);
|
|
|
|
};
|
|
|
|
|
|
|
|
class VisibleTownInfo : public CVisibleInfo
|
|
|
|
{
|
|
|
|
std::shared_ptr<CTownTooltip> townTooltip;
|
|
|
|
public:
|
|
|
|
VisibleTownInfo(const CGTownInstance * town);
|
|
|
|
};
|
2012-06-13 16:04:06 +03:00
|
|
|
|
2018-04-07 13:34:11 +02:00
|
|
|
class VisibleDateInfo : public CVisibleInfo
|
|
|
|
{
|
|
|
|
std::shared_ptr<CShowableAnim> animation;
|
|
|
|
std::shared_ptr<CLabel> label;
|
2012-06-13 16:04:06 +03:00
|
|
|
|
|
|
|
std::string getNewDayName();
|
2018-04-07 13:34:11 +02:00
|
|
|
public:
|
|
|
|
VisibleDateInfo();
|
|
|
|
};
|
2012-06-13 16:04:06 +03:00
|
|
|
|
2018-04-07 13:34:11 +02:00
|
|
|
class VisibleEnemyTurnInfo : public CVisibleInfo
|
|
|
|
{
|
|
|
|
std::shared_ptr<CAnimImage> banner;
|
|
|
|
std::shared_ptr<CShowableAnim> glass;
|
|
|
|
std::shared_ptr<CShowableAnim> sand;
|
2012-06-13 16:04:06 +03:00
|
|
|
public:
|
2018-04-07 13:34:11 +02:00
|
|
|
VisibleEnemyTurnInfo(PlayerColor player);
|
|
|
|
};
|
2012-06-13 16:04:06 +03:00
|
|
|
|
2018-04-07 13:34:11 +02:00
|
|
|
class VisibleGameStatusInfo : public CVisibleInfo
|
|
|
|
{
|
|
|
|
std::shared_ptr<CLabel> allyLabel;
|
|
|
|
std::shared_ptr<CLabel> enemyLabel;
|
2012-06-13 16:04:06 +03:00
|
|
|
|
2018-04-07 13:34:11 +02:00
|
|
|
std::vector<std::shared_ptr<CAnimImage>> flags;
|
|
|
|
std::vector<std::shared_ptr<CAnimImage>> hallIcons;
|
|
|
|
std::vector<std::shared_ptr<CLabel>> hallLabels;
|
|
|
|
public:
|
|
|
|
VisibleGameStatusInfo();
|
|
|
|
};
|
2012-06-13 16:04:06 +03:00
|
|
|
|
2018-04-07 13:34:11 +02:00
|
|
|
class VisibleComponentInfo : public CVisibleInfo
|
|
|
|
{
|
|
|
|
std::shared_ptr<CComponent> comp;
|
|
|
|
std::shared_ptr<CTextBox> text;
|
|
|
|
public:
|
|
|
|
VisibleComponentInfo(const Component & compToDisplay, std::string message);
|
2012-06-13 16:04:06 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
enum EState
|
|
|
|
{
|
|
|
|
EMPTY, HERO, TOWN, DATE, GAME, AITURN, COMPONENT
|
|
|
|
};
|
|
|
|
|
2018-04-07 13:34:11 +02:00
|
|
|
std::shared_ptr<CVisibleInfo> visibleInfo;
|
2012-06-13 16:04:06 +03:00
|
|
|
EState state;
|
|
|
|
|
|
|
|
//removes all information about current state, deactivates timer (if any)
|
2018-04-07 13:34:11 +02:00
|
|
|
void reset();
|
2012-06-13 16:04:06 +03:00
|
|
|
|
2015-10-12 15:47:10 +02:00
|
|
|
void tick() override;
|
2012-06-13 16:04:06 +03:00
|
|
|
|
2015-10-12 15:47:10 +02:00
|
|
|
void clickLeft(tribool down, bool previousState) override;
|
|
|
|
void clickRight(tribool down, bool previousState) override;
|
|
|
|
void hover(bool on) override;
|
2012-06-13 16:04:06 +03:00
|
|
|
|
2018-04-07 13:34:11 +02:00
|
|
|
void playNewDaySound();
|
2012-06-13 16:04:06 +03:00
|
|
|
public:
|
|
|
|
CInfoBar(const Rect & pos);
|
|
|
|
|
|
|
|
/// show new day/week animation
|
|
|
|
void showDate();
|
|
|
|
|
|
|
|
/// show component for 3 seconds. Used to display picked up resources
|
2012-09-26 16:13:39 +03:00
|
|
|
void showComponent(const Component & comp, std::string message);
|
2012-06-13 16:04:06 +03:00
|
|
|
|
|
|
|
/// print enemy turn progress
|
2013-03-03 20:06:03 +03:00
|
|
|
void startEnemyTurn(PlayerColor color);
|
2012-06-13 16:04:06 +03:00
|
|
|
|
2012-06-22 14:40:16 +03:00
|
|
|
/// reset to default view - selected object
|
|
|
|
void showSelection();
|
|
|
|
|
2012-06-13 16:04:06 +03:00
|
|
|
/// show hero\town information
|
2012-06-22 14:40:16 +03:00
|
|
|
void showHeroSelection(const CGHeroInstance * hero);
|
|
|
|
void showTownSelection(const CGTownInstance * town);
|
2012-06-13 16:04:06 +03:00
|
|
|
|
|
|
|
/// for 3 seconds shows amount of town halls and players status
|
|
|
|
void showGameStatus();
|
2013-11-07 15:48:41 +03:00
|
|
|
};
|
2014-07-13 18:39:45 +03:00
|
|
|
|
2015-01-15 01:22:20 +02:00
|
|
|
/// simple panel that contains other displayable elements; used to separate groups of controls
|
|
|
|
class CAdvMapPanel : public CIntObject
|
|
|
|
{
|
2018-04-07 13:34:11 +02:00
|
|
|
std::vector<std::shared_ptr<CButton>> colorableButtons;
|
|
|
|
std::vector<std::shared_ptr<CIntObject>> otherObjects;
|
2015-01-15 01:22:20 +02:00
|
|
|
/// the surface passed to this obj will be freed in dtor
|
2023-01-30 18:25:47 +02:00
|
|
|
std::shared_ptr<IImage> background;
|
2015-01-15 01:22:20 +02:00
|
|
|
public:
|
2023-01-30 18:25:47 +02:00
|
|
|
CAdvMapPanel(std::shared_ptr<IImage> bg, Point position);
|
2015-01-15 01:22:20 +02:00
|
|
|
|
2018-04-07 13:34:11 +02:00
|
|
|
void addChildToPanel(std::shared_ptr<CIntObject> obj, ui8 actions = 0);
|
|
|
|
void addChildColorableButton(std::shared_ptr<CButton> button);
|
2015-01-15 01:22:20 +02:00
|
|
|
/// recolors all buttons to given player color
|
|
|
|
void setPlayerColor(const PlayerColor & clr);
|
|
|
|
|
2015-10-12 15:47:10 +02:00
|
|
|
void showAll(SDL_Surface * to) override;
|
2015-01-15 01:22:20 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
/// specialized version of CAdvMapPanel that handles recolorable def-based pictures for world view info panel
|
|
|
|
class CAdvMapWorldViewPanel : public CAdvMapPanel
|
|
|
|
{
|
|
|
|
/// data that allows reconstruction of panel info icons
|
|
|
|
std::vector<std::pair<int, Point>> iconsData;
|
|
|
|
/// ptrs to child-pictures constructed from iconsData
|
2018-04-07 13:34:11 +02:00
|
|
|
std::vector<std::shared_ptr<CAnimImage>> currentIcons;
|
2018-07-25 00:36:48 +02:00
|
|
|
/// surface drawn below world view panel on higher resolutions (won't be needed when world view panel is configured for extraResolutions mod)
|
|
|
|
std::shared_ptr<CFilledTexture> backgroundFiller;
|
2016-10-18 04:46:07 +02:00
|
|
|
std::shared_ptr<CAnimation> icons;
|
2015-01-15 01:22:20 +02:00
|
|
|
public:
|
2023-01-30 18:25:47 +02:00
|
|
|
CAdvMapWorldViewPanel(std::shared_ptr<CAnimation> _icons, std::shared_ptr<IImage> bg, Point position, int spaceBottom, const PlayerColor &color);
|
2015-01-29 19:39:46 +02:00
|
|
|
virtual ~CAdvMapWorldViewPanel();
|
2015-01-15 01:22:20 +02:00
|
|
|
|
2016-10-18 04:46:07 +02:00
|
|
|
void addChildIcon(std::pair<int, Point> data, int indexOffset);
|
2015-01-15 01:22:20 +02:00
|
|
|
/// recreates all pictures from given def to recolor them according to current player color
|
2018-04-07 13:34:11 +02:00
|
|
|
void recolorIcons(const PlayerColor & color, int indexOffset);
|
2015-01-15 01:22:20 +02:00
|
|
|
};
|
|
|
|
|
2014-07-13 18:39:45 +03:00
|
|
|
class CInGameConsole : public CIntObject
|
|
|
|
{
|
|
|
|
private:
|
2023-01-30 19:55:32 +02:00
|
|
|
std::list< std::pair< std::string, uint32_t > > texts; //list<text to show, time of add>
|
2014-07-13 18:39:45 +03:00
|
|
|
boost::mutex texts_mx; // protects texts
|
|
|
|
std::vector< std::string > previouslyEntered; //previously entered texts, for up/down arrows to work
|
|
|
|
int prevEntDisp; //displayed entry from previouslyEntered - if none it's -1
|
|
|
|
int defaultTimeout; //timeout for new texts (in ms)
|
|
|
|
int maxDisplayedTexts; //hiw many texts can be displayed simultaneously
|
2022-12-19 22:53:31 +02:00
|
|
|
|
|
|
|
std::weak_ptr<IStatusBar> currentStatusBar;
|
2014-07-13 18:39:45 +03:00
|
|
|
public:
|
|
|
|
std::string enteredText;
|
2015-10-12 15:47:10 +02:00
|
|
|
void show(SDL_Surface * to) override;
|
2014-07-13 18:39:45 +03:00
|
|
|
void print(const std::string &txt);
|
2015-10-12 15:47:10 +02:00
|
|
|
void keyPressed (const SDL_KeyboardEvent & key) override; //call-in
|
2014-07-13 18:39:45 +03:00
|
|
|
|
|
|
|
void textInputed(const SDL_TextInputEvent & event) override;
|
|
|
|
void textEdited(const SDL_TextEditingEvent & event) override;
|
|
|
|
|
|
|
|
void startEnteringText();
|
2023-01-06 22:01:00 +02:00
|
|
|
void endEnteringText(bool processEnteredText);
|
2014-07-13 18:39:45 +03:00
|
|
|
void refreshEnteredText();
|
|
|
|
|
2017-07-17 23:04:00 +02:00
|
|
|
CInGameConsole();
|
2014-07-13 18:39:45 +03:00
|
|
|
};
|