mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-25 22:42:04 +02:00
Code formatting
This commit is contained in:
@@ -11,33 +11,27 @@
|
|||||||
#include "StdInc.h"
|
#include "StdInc.h"
|
||||||
#include "CMessage.h"
|
#include "CMessage.h"
|
||||||
|
|
||||||
#include "../CGameInfo.h"
|
|
||||||
#include "../../lib/CGeneralTextHandler.h"
|
|
||||||
#include "../../lib/TextOperations.h"
|
#include "../../lib/TextOperations.h"
|
||||||
|
|
||||||
#include "../windows/InfoWindows.h"
|
|
||||||
#include "../widgets/Images.h"
|
|
||||||
#include "../widgets/Buttons.h"
|
|
||||||
#include "../widgets/CComponent.h"
|
|
||||||
#include "../widgets/Slider.h"
|
|
||||||
#include "../widgets/TextControls.h"
|
|
||||||
#include "../gui/CGuiHandler.h"
|
#include "../gui/CGuiHandler.h"
|
||||||
#include "../render/CAnimation.h"
|
#include "../render/CAnimation.h"
|
||||||
#include "../render/IImage.h"
|
|
||||||
#include "../render/IRenderHandler.h"
|
|
||||||
#include "../render/Canvas.h"
|
#include "../render/Canvas.h"
|
||||||
#include "../render/Graphics.h"
|
#include "../render/Graphics.h"
|
||||||
#include "../render/IFont.h"
|
#include "../render/IFont.h"
|
||||||
#include "../renderSDL/SDL_Extensions.h"
|
#include "../render/IImage.h"
|
||||||
|
#include "../render/IRenderHandler.h"
|
||||||
|
#include "../widgets/Buttons.h"
|
||||||
|
#include "../widgets/CComponent.h"
|
||||||
|
#include "../widgets/Images.h"
|
||||||
|
#include "../widgets/Slider.h"
|
||||||
|
#include "../widgets/TextControls.h"
|
||||||
|
#include "../windows/InfoWindows.h"
|
||||||
|
|
||||||
const int BEFORE_COMPONENTS = 30;
|
const int BEFORE_COMPONENTS = 30;
|
||||||
const int SIDE_MARGIN = 30;
|
const int SIDE_MARGIN = 30;
|
||||||
|
|
||||||
namespace
|
static std::array<std::shared_ptr<CAnimation>, PlayerColor::PLAYER_LIMIT_I> dialogBorders;
|
||||||
{
|
static std::array<std::vector<std::shared_ptr<IImage>>, PlayerColor::PLAYER_LIMIT_I> piecesOfBox;
|
||||||
std::array<std::shared_ptr<CAnimation>, PlayerColor::PLAYER_LIMIT_I> dialogBorders;
|
|
||||||
std::array<std::vector<std::shared_ptr<IImage>>, PlayerColor::PLAYER_LIMIT_I> piecesOfBox;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CMessage::init()
|
void CMessage::init()
|
||||||
{
|
{
|
||||||
@@ -215,7 +209,7 @@ void CMessage::drawIWindow(CInfoWindow * ret, std::string text, PlayerColor play
|
|||||||
|
|
||||||
assert(ret && ret->text);
|
assert(ret && ret->text);
|
||||||
|
|
||||||
for (auto const & area : textAreaSizes)
|
for(const auto & area : textAreaSizes)
|
||||||
{
|
{
|
||||||
ret->text->resize(area);
|
ret->text->resize(area);
|
||||||
if(!ret->text->slider)
|
if(!ret->text->slider)
|
||||||
@@ -307,7 +301,8 @@ void CMessage::drawBorder(PlayerColor playerColor, Canvas & to, int w, int h, in
|
|||||||
int start_x = x + box[0]->width();
|
int start_x = x + box[0]->width();
|
||||||
const int stop_x = x + w - box[1]->width();
|
const int stop_x = x + w - box[1]->width();
|
||||||
const int bottom_y = y + h - box[7]->height() + 1;
|
const int bottom_y = y + h - box[7]->height() + 1;
|
||||||
while (start_x < stop_x) {
|
while(start_x < stop_x)
|
||||||
|
{
|
||||||
|
|
||||||
// Top border
|
// Top border
|
||||||
to.draw(box[6], Point(start_x, y));
|
to.draw(box[6], Point(start_x, y));
|
||||||
@@ -321,7 +316,8 @@ void CMessage::drawBorder(PlayerColor playerColor, Canvas & to, int w, int h, in
|
|||||||
int start_y = y + box[0]->height();
|
int start_y = y + box[0]->height();
|
||||||
const int stop_y = y + h - box[2]->height() + 1;
|
const int stop_y = y + h - box[2]->height() + 1;
|
||||||
const int right_x = x + w - box[5]->width();
|
const int right_x = x + w - box[5]->width();
|
||||||
while (start_y < stop_y) {
|
while(start_y < stop_y)
|
||||||
|
{
|
||||||
|
|
||||||
// Left border
|
// Left border
|
||||||
to.draw(box[4], Point(x, start_y));
|
to.draw(box[4], Point(x, start_y));
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ VCMI_LIB_NAMESPACE_BEGIN
|
|||||||
class ColorRGBA;
|
class ColorRGBA;
|
||||||
VCMI_LIB_NAMESPACE_END
|
VCMI_LIB_NAMESPACE_END
|
||||||
|
|
||||||
|
|
||||||
/// Class which draws formatted text messages and generates chat windows
|
/// Class which draws formatted text messages and generates chat windows
|
||||||
class CMessage
|
class CMessage
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -11,19 +11,14 @@
|
|||||||
#include "InfoWindows.h"
|
#include "InfoWindows.h"
|
||||||
|
|
||||||
#include "../CGameInfo.h"
|
#include "../CGameInfo.h"
|
||||||
#include "../PlayerLocalState.h"
|
|
||||||
#include "../CPlayerInterface.h"
|
#include "../CPlayerInterface.h"
|
||||||
#include "../CMusicHandler.h"
|
#include "../PlayerLocalState.h"
|
||||||
|
|
||||||
#include "../adventureMap/AdventureMapInterface.h"
|
#include "../adventureMap/AdventureMapInterface.h"
|
||||||
#include "../battle/BattleInterface.h"
|
|
||||||
#include "../battle/BattleInterfaceClasses.h"
|
|
||||||
#include "../gui/CGuiHandler.h"
|
#include "../gui/CGuiHandler.h"
|
||||||
#include "../gui/CursorHandler.h"
|
#include "../gui/CursorHandler.h"
|
||||||
#include "../gui/Shortcut.h"
|
#include "../gui/Shortcut.h"
|
||||||
#include "../gui/WindowHandler.h"
|
#include "../gui/WindowHandler.h"
|
||||||
#include "../render/Canvas.h"
|
|
||||||
#include "../renderSDL/SDL_Extensions.h"
|
|
||||||
#include "../widgets/Buttons.h"
|
#include "../widgets/Buttons.h"
|
||||||
#include "../widgets/CComponent.h"
|
#include "../widgets/CComponent.h"
|
||||||
#include "../widgets/Images.h"
|
#include "../widgets/Images.h"
|
||||||
@@ -35,12 +30,11 @@
|
|||||||
|
|
||||||
#include "../../lib/CConfigHandler.h"
|
#include "../../lib/CConfigHandler.h"
|
||||||
#include "../../lib/CondSh.h"
|
#include "../../lib/CondSh.h"
|
||||||
#include "../../lib/CGeneralTextHandler.h" //for Unicode related stuff
|
#include "../../lib/gameState/InfoAboutArmy.h"
|
||||||
#include "../../lib/mapObjects/CGCreature.h"
|
#include "../../lib/mapObjects/CGCreature.h"
|
||||||
#include "../../lib/mapObjects/CGHeroInstance.h"
|
#include "../../lib/mapObjects/CGHeroInstance.h"
|
||||||
#include "../../lib/mapObjects/CGTownInstance.h"
|
#include "../../lib/mapObjects/CGTownInstance.h"
|
||||||
#include "../../lib/mapObjects/MiscObjects.h"
|
#include "../../lib/mapObjects/MiscObjects.h"
|
||||||
#include "../../lib/gameState/InfoAboutArmy.h"
|
|
||||||
|
|
||||||
CSelWindow::CSelWindow( const std::string & Text, PlayerColor player, int charperline, const std::vector<std::shared_ptr<CSelectableComponent>> & comps, const std::vector<std::pair<AnimationPath, CFunctionList<void()>>> & Buttons, QueryID askID)
|
CSelWindow::CSelWindow( const std::string & Text, PlayerColor player, int charperline, const std::vector<std::shared_ptr<CSelectableComponent>> & comps, const std::vector<std::pair<AnimationPath, CFunctionList<void()>>> & Buttons, QueryID askID)
|
||||||
{
|
{
|
||||||
@@ -61,9 +55,7 @@ CSelWindow::CSelWindow(const std::string &Text, PlayerColor player, int charperl
|
|||||||
|
|
||||||
if(buttons.size() > 1 && askID.getNum() >= 0) //cancel button functionality
|
if(buttons.size() > 1 && askID.getNum() >= 0) //cancel button functionality
|
||||||
{
|
{
|
||||||
buttons.back()->addCallback([askID]() {
|
buttons.back()->addCallback([askID](){LOCPLINT->cb.get()->selectionMade(0, askID);});
|
||||||
LOCPLINT->cb.get()->selectionMade(0, askID);
|
|
||||||
});
|
|
||||||
//buttons.back()->addCallback(std::bind(&CCallback::selectionMade, LOCPLINT->cb.get(), 0, askID));
|
//buttons.back()->addCallback(std::bind(&CCallback::selectionMade, LOCPLINT->cb.get(), 0, askID));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -313,7 +305,8 @@ CInfoBoxPopup::CInfoBoxPopup(Point position, const CGCreature * creature)
|
|||||||
tooltip = std::make_shared<CreatureTooltip>(Point(9, 10), creature);
|
tooltip = std::make_shared<CreatureTooltip>(Point(9, 10), creature);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<WindowBase> CRClickPopup::createCustomInfoWindow(Point position, const CGObjectInstance * specific) //specific=0 => draws info about selected town/hero
|
std::shared_ptr<WindowBase>
|
||||||
|
CRClickPopup::createCustomInfoWindow(Point position, const CGObjectInstance * specific) //specific=0 => draws info about selected town/hero
|
||||||
{
|
{
|
||||||
if(nullptr == specific)
|
if(nullptr == specific)
|
||||||
specific = LOCPLINT->localState->getCurrentArmy();
|
specific = LOCPLINT->localState->getCurrentArmy();
|
||||||
|
|||||||
@@ -20,21 +20,14 @@ class CGTownInstance;
|
|||||||
class CGHeroInstance;
|
class CGHeroInstance;
|
||||||
class CGGarrison;
|
class CGGarrison;
|
||||||
class CGCreature;
|
class CGCreature;
|
||||||
class Rect;
|
|
||||||
|
|
||||||
VCMI_LIB_NAMESPACE_END
|
VCMI_LIB_NAMESPACE_END
|
||||||
|
|
||||||
struct SDL_Surface;
|
|
||||||
class CAnimImage;
|
|
||||||
class CLabel;
|
|
||||||
class CAnimation;
|
|
||||||
class CComponent;
|
class CComponent;
|
||||||
class CComponentBox;
|
class CComponentBox;
|
||||||
class CSelectableComponent;
|
class CSelectableComponent;
|
||||||
class CTextBox;
|
class CTextBox;
|
||||||
class CButton;
|
class CButton;
|
||||||
class CSlider;
|
|
||||||
class CArmyTooltip;
|
|
||||||
class CFilledTexture;
|
class CFilledTexture;
|
||||||
|
|
||||||
/// text + comp. + ok button
|
/// text + comp. + ok button
|
||||||
@@ -84,6 +77,7 @@ public:
|
|||||||
class CRClickPopupInt : public CRClickPopup
|
class CRClickPopupInt : public CRClickPopup
|
||||||
{
|
{
|
||||||
std::shared_ptr<CIntObject> inner;
|
std::shared_ptr<CIntObject> inner;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CRClickPopupInt(std::shared_ptr<CIntObject> our);
|
CRClickPopupInt(std::shared_ptr<CIntObject> our);
|
||||||
virtual ~CRClickPopupInt();
|
virtual ~CRClickPopupInt();
|
||||||
@@ -94,6 +88,7 @@ class CInfoBoxPopup : public CWindowObject
|
|||||||
{
|
{
|
||||||
std::shared_ptr<CIntObject> tooltip;
|
std::shared_ptr<CIntObject> tooltip;
|
||||||
Point toScreen(Point pos);
|
Point toScreen(Point pos);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CInfoBoxPopup(Point position, const CGTownInstance * town);
|
CInfoBoxPopup(Point position, const CGTownInstance * town);
|
||||||
CInfoBoxPopup(Point position, const CGHeroInstance * hero);
|
CInfoBoxPopup(Point position, const CGHeroInstance * hero);
|
||||||
@@ -108,6 +103,4 @@ public:
|
|||||||
void madeChoice(); //looks for selected component and calls callback
|
void madeChoice(); //looks for selected component and calls callback
|
||||||
void madeChoiceAndClose();
|
void madeChoiceAndClose();
|
||||||
CSelWindow(const std::string & text, PlayerColor player, int charperline, const std::vector<std::shared_ptr<CSelectableComponent>> & comps, const std::vector<std::pair<AnimationPath,CFunctionList<void()> > > &Buttons, QueryID askID);
|
CSelWindow(const std::string & text, PlayerColor player, int charperline, const std::vector<std::shared_ptr<CSelectableComponent>> & comps, const std::vector<std::pair<AnimationPath,CFunctionList<void()> > > &Buttons, QueryID askID);
|
||||||
|
|
||||||
//notification - this class inherits important destructor from CInfoWindow
|
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user