Commit 09a73681 authored by sm's avatar sm

Version 0.4

- add NPoint hash function
- rename RandomRow to RandomTiles and add xml parser
- fix Coords bug
parent 732821e4
stmm-games (0.4) unstable; urgency=low
* Add NPoint hash function
* Rename RandomRow to RandomTiles and add xml parser
* Fix Coords bug
* Increase minor version
-- Stefano Marsili <efanomars@gmx.ch> Wed, 06 Mar 2019 19:29:39 +0100
stmm-games (0.3) unstable; urgency=low
* Improve initialization and xml parsing of RotateModifier, MaskModifier, TileAniModifier
......
......@@ -50,44 +50,82 @@ public:
}
int32_t gameAbortCount() const
{
return m_nGameAbort;
return m_nGameAbortCount;
}
int32_t gameAbortAskCount() const
{
return m_nGameAbortAskCount;
}
int32_t gameQuitCount() const
{
return m_nGameQuitCount;
}
int32_t gameQuitAskCount() const
{
return m_nGameQuitAskCount;
}
int32_t gameRestartCount() const
{
return m_nGameRestartCount;
}
int32_t gameRestartAskCount() const
{
return m_nGameRestartAskCount;
}
void gameEnded() override
{
++m_nGameEndedCount;
}
// void gamePause() override
// {
// ++m_nGamePauseCount;
// }
void gameInterrupt(GameProxy::INTERRUPT_TYPE /*eInterruptType*/) override
void gameInterrupt(GameProxy::INTERRUPT_TYPE eInterruptType) override
{
++m_nGameAbort;
if (eInterruptType == GameProxy::INTERRUPT_ABORT) {
++m_nGameAbortCount;
} else if (eInterruptType == GameProxy::INTERRUPT_ABORT_ASK) {
++m_nGameAbortAskCount;
} else if (eInterruptType == GameProxy::INTERRUPT_QUIT_APP) {
++m_nGameQuitCount;
} else if (eInterruptType == GameProxy::INTERRUPT_QUIT_APP_ASK) {
++m_nGameQuitAskCount;
} else if (eInterruptType == GameProxy::INTERRUPT_RESTART) {
++m_nGameRestartCount;
} else if (eInterruptType == GameProxy::INTERRUPT_RESTART_ASK) {
++m_nGameRestartAskCount;
} else if (eInterruptType == GameProxy::INTERRUPT_PAUSE) {
++m_nGamePauseCount;
} else {
assert(false);
}
}
protected:
virtual void setup()
{
m_nGameEndedCount = 0;
m_nGamePauseCount = 0;
m_nGameAbort = 0;
resetGameOwner();
}
virtual void teardown()
{
m_nGameEndedCount = 0;
m_nGamePauseCount = 0;
m_nGameAbort = 0;
resetGameOwner();
}
void resetGameOwner()
{
m_nGameEndedCount = 0;
m_nGamePauseCount = 0;
m_nGameAbort = 0;
m_nGameAbortCount = 0;
m_nGameAbortAskCount = 0;
m_nGameQuitCount = 0;
m_nGameQuitAskCount = 0;
m_nGameRestartCount = 0;
m_nGameRestartAskCount = 0;
}
public:
int32_t m_nGameEndedCount;
int32_t m_nGamePauseCount;
int32_t m_nGameAbort;
int32_t m_nGameAbortCount;
int32_t m_nGameAbortAskCount;
int32_t m_nGameQuitCount;
int32_t m_nGameQuitAskCount;
int32_t m_nGameRestartCount;
int32_t m_nGameRestartAskCount;
};
} // namespace testing
......
......@@ -60,7 +60,8 @@ void DumbBlockEvent::trigger(int32_t /*nMsg*/, int32_t /*nValue*/, Event* p0Trig
// if succeeded deactivate and add to level's falling blocks
// FALL expect and do nothing while falling
// (zombie state, cannot fall more than once without being reinitialized)
const int32_t nGameTick = level().game().gameElapsed();
Level& oLevel = level();
const int32_t nGameTick = oLevel.game().gameElapsed();
//std::cout << "DumbBlockEvent(" << blockGetId() << ")::trigger() nGameTick=" << nGameTick << '\n';
switch (m_eState)
{
......@@ -72,7 +73,7 @@ void DumbBlockEvent::trigger(int32_t /*nMsg*/, int32_t /*nValue*/, Event* p0Trig
}
m_eState = DUMB_BLK_EVENT_STATE_INIT;
if (p0TriggeringEvent != nullptr) {
level().activateEvent(this, nGameTick);
oLevel.activateEvent(this, nGameTick);
break;
}
} // fallthrough
......@@ -89,15 +90,15 @@ void DumbBlockEvent::trigger(int32_t /*nMsg*/, int32_t /*nValue*/, Event* p0Trig
if (p0TriggeringEvent != nullptr) {
return; //------------------------------------------------------
}
if (!level().blockAdd(this, LevelBlock::MGMT_TYPE_AUTO_STRICT_OWNER)) {
if (!oLevel.blockAdd(this, LevelBlock::MGMT_TYPE_AUTO_STRICT_OWNER)) {
//std::cout << "DumbBlockEvent(" << blockGetId() << ")::trigger blockAdd failed" << '\n';
m_eState = DUMB_BLK_EVENT_STATE_ZOMBIE;
informListeners(LISTENER_GROUP_CANNOT_PLACE, 0);
informListeners(LISTENER_GROUP_FINISHED, 0);
} else {
m_eState = DUMB_BLK_EVENT_STATE_FALL;
level().boardAddListener(this);
level().deactivateEvent(this);
oLevel.boardAddListener(this);
oLevel.deactivateEvent(this);
informListeners(LISTENER_GROUP_COULD_PLACE, 0);
}
}
......@@ -136,6 +137,7 @@ bool DumbBlockEvent::move(Direction::VALUE eDir) {
bool DumbBlockEvent::move(Direction::VALUE eDir, bool bDoMove
, int32_t nClipX, int32_t nClipY, int32_t nClipW, int32_t nClipH)
{
Level& oLevel = level();
assert((eDir >= 0) && (eDir < 4));
const int32_t nPosX = LevelBlock::blockPosX();
const int32_t nPosY = LevelBlock::blockPosY();
......@@ -155,12 +157,12 @@ bool DumbBlockEvent::move(Direction::VALUE eDir, bool bDoMove
// cannot move
return false; //------------------------------------------------
}
const Tile& oTile = level().boardGetTile(nBoardX, nBoardY);
const Tile& oTile = oLevel.boardGetTile(nBoardX, nBoardY);
if (!oTile.isEmpty()) {
// solid tile: cannot move
return false; //------------------------------------------------
} else {
LevelBlock* p0LevelBlock = level().boardGetOwner(nBoardX, nBoardY);
LevelBlock* p0LevelBlock = oLevel.boardGetOwner(nBoardX, nBoardY);
if (p0LevelBlock != nullptr) {
assert(p0LevelBlock != this);
return false; //--------------------------------------------
......
......@@ -41,7 +41,6 @@ void FakeLevelView::boardAnimateTiles(NRect oArea)
auto refCalled = make_unique<BoardAnimateTiles>();
refCalled->m_oArea = std::move(oArea);
m_oAllCalls.push_back(std::move(refCalled));
// m_eAnimateTilesCalls.push_back(oArea);
}
void FakeLevelView::boardAnimateTile(NPoint oXY)
{
......@@ -53,7 +52,6 @@ void FakeLevelView::boardAnimateTile(NPoint oXY)
oArea.m_nH = 1;
refCalled->m_oArea = std::move(oArea);
m_oAllCalls.push_back(std::move(refCalled));
// m_eAnimateTilesCalls.push_back(oArea);
}
bool FakeLevelView::animationCreate(const shared_ptr<LevelAnimation>& refLevelAnimation)
{
......@@ -226,17 +224,5 @@ int32_t FakeLevelView::totCalled(const shared_ptr<LevelAnimation>& refLevelAnima
}
return nTot;
}
//const std::vector<NRect>& FakeLevelView::getAnimateTilesCalled()
//{
// return m_eAnimateTilesCalls;
//}
//const std::vector<shared_ptr<LevelAnimation>>& FakeLevelView::getAnimationCreateCalled()
//{
// return m_eAnimationCreateCalls;
//}
//const std::vector<shared_ptr<LevelAnimation>>& FakeLevelView::getAnimationRemoveCalled()
//{
// return m_eAnimationRemoveCalls;
//}
} // namespace stmg
......@@ -20,12 +20,12 @@
# MINOR is REVISION (implementation of interface)
# AGE is always 0
set(STMM_GAMES_FAKE_MAJOR_VERSION 0)
set(STMM_GAMES_FAKE_MINOR_VERSION 3)
set(STMM_GAMES_FAKE_MINOR_VERSION 4)
set(STMM_GAMES_FAKE_VERSION "${STMM_GAMES_FAKE_MAJOR_VERSION}.${STMM_GAMES_FAKE_MINOR_VERSION}.0")
# required stmm-games version
set(STMM_GAMES_FAKE_REQ_STMM_GAMES_MAJOR_VERSION 0)
set(STMM_GAMES_FAKE_REQ_STMM_GAMES_MINOR_VERSION 3)
set(STMM_GAMES_FAKE_REQ_STMM_GAMES_MINOR_VERSION 4)
set(STMM_GAMES_FAKE_REQ_STMM_GAMES_VERSION "${STMM_GAMES_FAKE_REQ_STMM_GAMES_MAJOR_VERSION}.${STMM_GAMES_FAKE_REQ_STMM_GAMES_MINOR_VERSION}")
include("${PROJECT_SOURCE_DIR}/../libstmm-games/stmm-games-defs.cmake")
......
......@@ -80,27 +80,6 @@ private:
ImageSequenceThAniFactory& operator=(const ImageSequenceThAniFactory& oSource) = delete;
};
//////////////////////////////////////////////////////////////////////////////////
//class ImageSequenceExplosionThAniFactory : public StdThemeAnimationFactory
//{
//public:
// /** Constructor.
// * @param p1Owner The StdTheme object pointer. Cannot be null.
// * @param p0ImageSequenceThAniFactory The factory that actually does the animation. Cannot be null.
// */
// ImageSequenceExplosionThAniFactory(StdTheme* p1Owner, ImageSequenceThAniFactory* p0ImageSequenceThAniFactory);
//
// bool supports(const shared_ptr<LevelAnimation>& refLevelAnimation) override;
// shared_ptr<ThemeAnimation> create(const shared_ptr<StdThemeContext>& refThemeContext, const shared_ptr<LevelAnimation>& refLevelAnimation) override;
//
//private:
// ImageSequenceThAniFactory* m_p0ImageSequenceThAniFactory;
//private:
// ImageSequenceExplosionThAniFactory() = delete;
// ImageSequenceExplosionThAniFactory(const ImageSequenceExplosionThAniFactory& oSource) = delete;
// ImageSequenceExplosionThAniFactory& operator=(const ImageSequenceExplosionThAniFactory& oSource) = delete;
//};
} // namespace stmg
......
......@@ -309,9 +309,6 @@ std::pair<SegmentedFunction, SegmentedFunction> BoxThemeWidget<TOwnerFactory, TB
::calcSizeFunctions(int32_t nLayoutConfig)
{
const bool bIsVertical = m_p0BoxWidget->isVertical(nLayoutConfig);
// if (bSwitch && m_p0BoxWidget->isSwitchable()) {
// bIsVertical = !bIsVertical;
// }
SegmentedFunction oFunW;
SegmentedFunction oFunH;
auto& aChildTW = getChildren();
......@@ -337,8 +334,6 @@ void BoxThemeWidget<TOwnerFactory, TBoxThemeWidget, TBoxWidget>::onRecalcSizeFun
for (int32_t nLC = 0; nLC < s_nTotLayoutConfigs; ++nLC) {
m_aSizeFunctions[nLC] = calcSizeFunctions(nLC);
}
// m_oSizeFunctionsOn = calcSizeFunctions(true);
// m_oSizeFunctionsOff = calcSizeFunctions(false);
}
template<class TOwnerFactory, class TBoxThemeWidget, class TBoxWidget>
bool BoxThemeWidget<TOwnerFactory, TBoxThemeWidget, TBoxWidget>::canChange() const
......
......@@ -174,7 +174,6 @@ public:
private:
RelSizedGameWidget* m_p0RelSizedGameWidget;
std::array<std::pair<SegmentedFunction, SegmentedFunction>, s_nTotLayoutConfigs> m_aSizeFunctions;
// std::pair<SegmentedFunction, SegmentedFunction> m_oSizeFunctionsOff;
};
////////////////////////////////////////////////////////////////////////////////
......@@ -211,10 +210,11 @@ void StdLeafThemeWidget<TW>::reInit(double fTileWHRatio)
template< class TW >
void StdLeafThemeWidget<TW>::dump(int32_t /*nIndentSpaces*/) const
{
// auto sIndent = std::string(nIndentSpaces, ' ');
// if (getPixW() > 0) {
// std::cout << sIndent << " " << "Pix X:" << getPixX() << " Y:" << getPixY() << " W:" << getPixW() << " H:" << getPixH() << '\n';
// }
//TODO
// auto sIndent = std::string(nIndentSpaces, ' ');
// if (getPixW() > 0) {
// std::cout << sIndent << " " << "Pix X:" << getPixX() << " Y:" << getPixY() << " W:" << getPixW() << " H:" << getPixH() << '\n';
// }
}
#endif //NDEBUG
......
......@@ -52,11 +52,6 @@ void BackgroundThAniFactory::BackgroundThAni::draw(int32_t nViewTick, int32_t nT
FPoint oImgRelPos = m_refModel->getImageRelPos(nViewTick, nTotViewTicks);
FSize oImgSize = m_refModel->getImageSize();
if (nImageIdx != m_nCachedImgId) {
// if (!p0Theme->getNamed().images().isIndex(nImageIdx)) {
// // This image is not defined by the theme, draw nothing
////std::cout << " ::draw nImageIdx invalid" << '\n';
// return; // ---------------------------------------------------------
// }
shared_ptr<Image> refImage = p0Theme->getImageById(nImageIdx);
if (!refImage) {
// This image is not defined by the theme, draw nothing
......@@ -135,21 +130,6 @@ void BackgroundThAniFactory::BackgroundThAni::draw(int32_t nViewTick, int32_t nT
}
refCc->restore();
}
//NRect BackgroundThAniFactory::BackgroundThAni::getRect(int32_t /*nViewTick*/, int32_t /*nTotViewTicks*/)
//{
// assert(m_refModel);
// const NSize oTileSize = m_refThemeContext->getTileSize();
// const int32_t& nTileW = oTileSize.m_nW;
// const int32_t& nTileH = oTileSize.m_nH;
// FPoint oPos = m_refModel->getPos();
// FSize oSize = m_refModel->getSize();
// NRect oRect;
// oRect.m_nX = oPos.m_fX * nTileW;
// oRect.m_nY = oPos.m_fY * nTileH;
// oRect.m_nW = oSize.m_fW * nTileW;
// oRect.m_nH = oSize.m_fH * nTileH;
// return oRect;
//}
int32_t BackgroundThAniFactory::BackgroundThAni::getZ(int32_t /*nViewTick*/, int32_t /*nTotViewTicks*/)
{
return m_nZ;
......
......@@ -146,14 +146,6 @@ void ImageSequenceThAniFactory::ImageSeqThAni::draw(int32_t nViewTick, int32_t n
m_nLastPicDrawn = nBestPic;
}
//NRect ImageSequenceThAniFactory::ImageSeqThAni::getRect(int32_t nViewTick, int32_t nTotViewTicks)
//{
// assert(m_refModel);
// NRect oRect;
// int32_t nBestPic;
// getRectAndBestPic(nViewTick, nTotViewTicks, oRect, nBestPic);
// return oRect;
//}
int32_t ImageSequenceThAniFactory::ImageSeqThAni::getZ(int32_t /*nViewTick*/, int32_t /*nTotViewTicks*/)
{
return m_nZ;
......
......@@ -96,19 +96,6 @@ void PlainTextThAniFactory::PlainTextThAni::getRectAndScale(FRect& oRect, double
oRect.m_fW = fPixW;
oRect.m_fH = fPixH;
}
//NRect PlainTextThAniFactory::PlainTextThAni::getRect(int32_t /*nViewTick*/, int32_t /*nTotViewTicks*/)
//{
// FRect oFRect;
// double fScale;
// double fPixHLine;
// getRectAndScale(oFRect, fScale, fPixHLine);
// NRect oRect;
// oRect.m_nX = oFRect.m_fX;
// oRect.m_nY = oFRect.m_fY;
// oRect.m_nW = oFRect.m_fW;
// oRect.m_nH = oFRect.m_fH;
// return oRect;
//}
void PlainTextThAniFactory::PlainTextThAni::draw(int32_t nViewTick, int32_t nTotViewTicks, const Cairo::RefPtr<Cairo::Context>& refCc)
{
//std::cout << "PlainTextThAniFactory::ShowText::draw nViewTick=" << nViewTick << " nTotViewTicks=" << nTotViewTicks << '\n';
......
......@@ -110,11 +110,6 @@ void StaticGridThAniFactory::StaticGridThAni::draw(int32_t /*nViewTick*/, int32_
refCc->paint_with_alpha(p0Factory->m_fOpacity01);
refCc->restore();
}
//NRect StaticGridThAniFactory::StaticGridThAni::getRect(int32_t /*nViewTick*/, int32_t /*nTotViewTicks*/)
//{
// getRectInternal();
// return m_oPixRect;
//}
bool StaticGridThAniFactory::StaticGridThAni::getRectInternal()
{
const NSize oTileSize = m_refThemeContext->getTileSize();
......
......@@ -87,7 +87,6 @@ bool GameGtkDrawingArea::startGame(shared_ptr<Game>& refGame, shared_ptr<Theme>&
}
void GameGtkDrawingArea::endGame()
{
// set_double_buffered(true);
}
void GameGtkDrawingArea::beforeGameTick()
......
......@@ -172,11 +172,6 @@ void StdLevelView::onSizeChanged(int32_t nTileW, int32_t nTileH)
} else {
m_refThemeCtx->setTileSize(NSize{m_nTileW, m_nTileH});
}
//std::cout << " onSizeChanged m_nSubshowSurfPixW=" << m_nSubshowSurfPixW << " m_nSubshowSurfPixH=" << m_nSubshowSurfPixH << '\n';
// m_nSubshowSurfPixW = (m_bSubshows ? m_nSubshowW * m_nTileW : -1); //TODO used?
// m_nSubshowSurfPixH = (m_bSubshows ? m_nSubshowH * m_nTileH : -1);
//std::cout << " onSizeChanged m_nSubshowSurfPixW=" << m_nSubshowSurfPixW << " m_nSubshowSurfPixH=" << m_nSubshowSurfPixH << '\n';
recreateSurfs();
}
void StdLevelView::recreateSurfs()
......
......@@ -480,15 +480,15 @@ void StdView::redraw(const Cairo::RefPtr<Cairo::Context>& refCc)
#ifndef NDEBUG
void StdView::dump(bool /*bTickTileAnis*/) const
{
// if (bTickTileAnis) {
// std::cout << "StdView::dump() TickTileAnis (nX,nY)" << '\n';
// for (auto& nXY : m_oTickTileAnis) {
// const int32_t nX = Coords::getXFromXY(nXY);
// const int32_t nY = Coords::getYFromXY(nXY);
// std::cout << " (" << nX << "," << nY << ")";
// std::cout << '\n';
// }
// }
// if (bTickTileAnis) { //TODO
// std::cout << "StdView::dump() TickTileAnis (nX,nY)" << '\n';
// for (auto& nXY : m_oTickTileAnis) {
// const int32_t nX = Coords::getXFromXY(nXY);
// const int32_t nY = Coords::getYFromXY(nXY);
// std::cout << " (" << nX << "," << nY << ")";
// std::cout << '\n';
// }
// }
}
#endif //NDEBUG
......
......@@ -243,49 +243,6 @@ void StdViewLayout::calcLayout(int32_t nDestW, int32_t nDestH, int32_t nTileMinW
nBestMaxTileW = nMaxTileW;
}
}
// const std::pair<SegmentedFunction, SegmentedFunction>& oFunOff = refRootTW->getSizeFunctions(false);
// const SegmentedFunction& oWFunOff = oFunOff.first;
// const SegmentedFunction& oHFunOff = oFunOff.second;
//
// int32_t nPixWOff = nDestW;
// int32_t nPixHOff = nDestH;
// {
// const int32_t nMinPixW = oWFunOff.eval(nTileMinW);
// const int32_t nMinPixH = oHFunOff.eval(nTileMinW);
// if (nPixWOff < nMinPixW) {
// nPixWOff = nMinPixW;
// }
// if (nPixHOff < nMinPixH) {
// nPixHOff = nMinPixH;
// }
// }
// const int32_t nMaxTileWwOff = oWFunOff.evalInverse(nPixWOff);
// const int32_t nMaxTileWhOff = oHFunOff.evalInverse(nPixHOff);
// const int32_t nMaxTileWOff = std::min(nMaxTileWwOff, nMaxTileWhOff);
//
// const std::pair<SegmentedFunction, SegmentedFunction>& oFunOn = refRootTW->getSizeFunctions(true);
// const SegmentedFunction& oWFunOn = oFunOn.first;
// const SegmentedFunction& oHFunOn = oFunOn.second;
////std::cout << "StdViewLayout::calcLayout 3" << '\n';
//
// int32_t nPixWOn = nDestW;
// int32_t nPixHOn = nDestH;
// {
// const int32_t nMinPixW = oWFunOn.eval(nTileMinW);
// const int32_t nMinPixH = oHFunOn.eval(nTileMinW);
// if (nPixWOn < nMinPixW) {
// nPixWOn = nMinPixW;
// }
// if (nPixHOn < nMinPixH) {
// nPixHOn = nMinPixH;
// }
// }
// const int32_t nMaxTileWwOn = oWFunOn.evalInverse(nPixWOn);
// const int32_t nMaxTileWhOn = oHFunOn.evalInverse(nPixHOn);
// const int32_t nMaxTileWOn = std::min(nMaxTileWwOn, nMaxTileWhOn);
// bSwitch = (nMaxTileWOn >= nMaxTileWOff);
// nTileW = (bSwitch ? nMaxTileWOn : nMaxTileWOff);
nTileW = nBestMaxTileW;
nLayoutConfig = nBestLayoutConfig;
const double fTileH = 1.0 * nTileW / fWHTileRatio;
......
......@@ -222,27 +222,6 @@ bool ActionThWidgetFactory::KeyActionTWidget::handleXYInput(const shared_ptr<stm
// player has to be defined
return false; //--------------------------------------------------------
}
// const int32_t nWidgetMate = m_p0ActionWidget->getMate();
// const int32_t nWidgetTeam = m_p0ActionWidget->getTeam();
// if ((nWidgetMate < 0) && (nMate < 0)) {
// // no target player
// return; //--------------------------------------------------------------
// }
// if (nMate < 0) {
// nMate = nWidgetMate;
// } else if (nWidgetMate >= 0) {
// assert(nMate == nWidgetMate);
// }
// if (nTeam < 0) {
// assert(nWidgetTeam >= 0);
// nTeam = nWidgetTeam;
// } else if (nWidgetTeam >= 0) {
// assert(nTeam == nWidgetTeam);
// }
// if (nMate < 0) {
// // player has to be fully defined
// return;
// }
m_p0ActionWidget->handleXYInput(refXYEvent, nTeam, nMate);
return true;
}
......
......@@ -54,7 +54,6 @@ shared_ptr<ThemeWidget> BackgroundThWidgetFactory::create(const shared_ptr<GameW
shared_ptr<BackgroundTWidget> refWidget;
m_oBackgroundTWidgets.create(refWidget, this, refGameWidget, p0BackgroundWidget, refChildTW, fTileWHRatio);
// refWidget->reInit(this, refGameWidget, p0BackgroundWidget, refChildTW, fTileWHRatio);
return refWidget;
}
BackgroundThWidgetFactory::BackgroundTWidget::BackgroundTWidget(BackgroundThWidgetFactory* p1Owner
......@@ -73,7 +72,6 @@ BackgroundThWidgetFactory::BackgroundTWidget::BackgroundTWidget(BackgroundThWidg
, m_nPixH(0)
, m_bParentCanChange(false)
{
// setModel(refGameWidget);
reInitCommon(refChildTW);
}
void BackgroundThWidgetFactory::BackgroundTWidget::reInit(BackgroundThWidgetFactory* p1Owner
......@@ -128,11 +126,6 @@ const std::pair<SegmentedFunction, SegmentedFunction>& BackgroundThWidgetFactory
{
assert((nLayoutConfig >= 0) && (nLayoutConfig < s_nTotLayoutConfigs));
return m_aSizeFunctions[nLayoutConfig];
// if (bSwitch) {
// return m_oSizeFunctionsOn;
// } else {
// return m_oSizeFunctionsOff;
// }
}
void BackgroundThWidgetFactory::BackgroundTWidget::sizeAndConfig(int32_t nTileSize, int32_t nLayoutConfig)
{
......@@ -172,7 +165,6 @@ void BackgroundThWidgetFactory::BackgroundTWidget::placeAndMaybeResizeIn(const N
setPos(oWidget.m_nX, oWidget.m_nY);
setSize(oWidget.m_nW, oWidget.m_nH);
//
// assert(! m_p0BackgroundWidget->isSwitchable());
auto& aChildTW = getChildren();
assert(aChildTW.size() == 1);
auto& refChildTW = aChildTW[0];
......@@ -202,8 +194,6 @@ void BackgroundThWidgetFactory::BackgroundTWidget::onRecalcSizeFunctions(ThemeWi
for (int32_t nLC = 0; nLC < s_nTotLayoutConfigs; ++nLC) {
m_aSizeFunctions[nLC] = calcSizeFunctions(nLC);
}
// m_oSizeFunctionsOn = calcSizeFunctions(true);
// m_oSizeFunctionsOff = calcSizeFunctions(false);
}
bool BackgroundThWidgetFactory::BackgroundTWidget::canChange() const
{
......
......@@ -122,18 +122,10 @@ bHeader
}
std::cout << sIndent << " Margins (tiles): ";
std::cout << "(Top: " << m_fTop << ", Bottom: " << m_fBottom << ", Left: " << m_fLeft << ", Right: " << m_fRight << ")" << '\n';
// const bool bIsSwitchable = getLevelShowWidget()->isSwitchable();
// std::cout << sIndent << (bIsSwitchable ? " Margins (tiles) Switch=false: " : " ");
// std::cout << "(Top: " << m_aTop[0] << ", Bottom: " << m_aBottom[0] << ", Left: " << m_aLeft[0] << ", Right: " << m_aRight[0] << ")" << '\n';
// if (bIsSwitchable) {
// std::cout << sIndent << " Margins (tiles) Switch=true: ";
// std::cout << "(Top: " << m_aTop[1] << ", Bottom: " << m_aBottom[1] << ", Left: " << m_aLeft[1] << ", Right: " << m_aRight[1] << ")" << '\n';
// }
const bool bSizeAndConfigCalled = (m_oLeafTW.getTileSize() > 0);
if (bSizeAndConfigCalled) {
std::cout << sIndent << " " << "nTileW : " << m_oLeafTW.getTileSize() << '\n';
std::cout << sIndent << " " << "nLayoutConfig: " << m_oLeafTW.getLayoutConfig() << '\n';
// std::cout << sIndent << " " << "nLayoutConfig: " << (m_oLeafTW.getSwitched() ? "T" : "F") << '\n';
} else {
std::cout << sIndent << " " << "nTileW : Not calculated" << '\n';
std::cout << sIndent << " " << "nLayoutConfig: Not calculated" << '\n';
......@@ -145,8 +137,6 @@ const std::pair<SegmentedFunction, SegmentedFunction>& LevelShowThWidgetFactory:
{
//std::cout << "LevelShowThWidgetFactory::LevelShowTWidget::getSizeFunctions" << '\n';
return m_oSizeFunctions;
// const bool bIsSwitchable = getLevelShowWidget()->isSwitchable();
// return ((bIsSwitchable && bSwitch) ? m_oSizeFunctionsOn : m_oSizeFunctionsOff);
}
void LevelShowThWidgetFactory::LevelShowTWidget::onRecalcSizeFunctions(ThemeWidget*
#ifndef NDEBUG
......
......@@ -20,11 +20,11 @@
# MINOR is REVISION (implementation of interface)
# AGE is always 0
set(STMM_GAMES_GTK_MAJOR_VERSION 0)
set(STMM_GAMES_GTK_MINOR_VERSION 3)
set(STMM_GAMES_GTK_MINOR_VERSION 4)
set(STMM_GAMES_GTK_VERSION "${STMM_GAMES_GTK_MAJOR_VERSION}.${STMM_GAMES_GTK_MINOR_VERSION}.0")
set(STMM_GAMES_GTK_REQ_STMM_GAMES_MAJOR_VERSION 0)
set(STMM_GAMES_GTK_REQ_STMM_GAMES_MINOR_VERSION 3)
set(STMM_GAMES_GTK_REQ_STMM_GAMES_MINOR_VERSION 4)
set(STMM_GAMES_GTK_REQ_STMM_GAMES_VERSION "${STMM_GAMES_GTK_REQ_STMM_GAMES_MAJOR_VERSION}.${STMM_GAMES_GTK_REQ_STMM_GAMES_MINOR_VERSION}")
set(STMM_GAMES_GTK_REQ_STMM_INPUT_GTK_MAJOR_VERSION 0)
......
......@@ -52,6 +52,7 @@ set(STMMI_HEADERS
${STMMI_HEADERS_DIR}/xmlhighscoresloader.h
${STMMI_HEADERS_DIR}/xmlimageparser.h
${STMMI_HEADERS_DIR}/xmlmodifierparser.h
${STMMI_HEADERS_DIR}/xmlprobtilegen.h
${STMMI_HEADERS_DIR}/xmlpreferencesloader.h
${STMMI_HEADERS_DIR}/xmlthanimationfactoryparser.h
${STMMI_HEADERS_DIR}/xmlthemeloader.h
......@@ -198,6 +199,7 @@ set(STMMI_SOURCES
${STMMI_SOURCES_DIR}/xmllayoutparser.h
${STMMI_SOURCES_DIR}/xmllayoutparser.cc
${STMMI_SOURCES_DIR}/xmlmodifierparser.cc
${STMMI_SOURCES_DIR}/xmlprobtilegen.cc
${STMMI_SOURCES_DIR}/xmlpreferencesloader.cc
${STMMI_SOURCES_DIR}/xmlthanimationfactoryparser.cc
${STMMI_SOURCES_DIR}/xmlthemeaniparser.h
......
......@@ -153,12 +153,6 @@ private:
// else aNames for the sub directoriws of sTheDir are relative to their sub directory and there is no recursion
static void getFilesWithExt(const std::string& sTheDir, bool bDoSubdirs, const std::string& sOnlyExt
, std::vector<std::string>& aNames, std::vector<std::string>& aPaths);
// static void filterRegularFilesToAbs(const std::string& sFolder, const std::vector<std::string>& oNames, const std::string& sOnlyExt
// , std::vector<std::string>& aFiles);
// static void filterSubDirs(const std::string& sFolder, const std::vector<std::string>& aNames
// , std::vector<std::string>& aDirs);
// static void filterThemeDirToAbs(const std::string& sFolder, const std::vector<std::string>& oNames
// , std::vector<std::string>& aFiles);
static bool isImageFile(const std::string& sFile);
......
/*
* File: xmlprobtilegen.h
*
* Copyright © 2019 Stefano Marsili, <stemars@gmx.ch>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, see <http://www.gnu.org/licenses/>
*/
#ifndef STMG_XML_PROB_TILE_GEN_H
#define STMG_XML_PROB_TILE_GEN_H
#include "gamectx.h"
#include <stmm-games/randomtiles.h>
#include <stmm-games/tiletraitsets.h>
#include <string>
namespace stmg
{
static const std::string s_sEventRandomNodeName = "Random";
template<class TEventParser>
class XmlProbTileGenParser
{
public:
XmlProbTileGenParser()
: m_sRandomNodeName(s_sEventRandomNodeName)
{
}
explicit XmlProbTileGenParser(const std::string& sRandomNodeName)
: m_sRandomNodeName(sRandomNodeName)
{
}
RandomTiles::ProbTileGen parseEventProbTileGen(TEventParser& oXmlEventParser, GameCtx& oCtx, const xmlpp::Element* p0Element);
RandomTiles::ProbTraitSets parseEventRandom(TEventParser& oXmlEventParser, GameCtx& oCtx, const xmlpp::Element* p0Element);
private:
std::string m_sRandomNodeName;
private:
XmlProbTileGenParser(const XmlProbTileGenParser& oSource) = delete;
XmlProbTileGenParser& operator=(const XmlProbTileGenParser& oSource) = delete;
};
template<class TEventParser>
RandomTiles::ProbTileGen XmlProbTileGenParser<TEventParser>::parseEventProbTileGen(TEventParser& oXmlEventParser, GameCtx& oCtx, const xmlpp::Element* p0Element)
{
oCtx.addChecker(p0Element);
RandomTiles::ProbTileGen oNewRowTileGen;