Commit 0532a957 authored by sm's avatar sm

New version 0.13

* Fix hard coded user bug
* Improve build scripts
parent fdd391d2
stmm-games (0.13) unstable; urgency=low
* Fix hard coded user bug
* Improve build scripts
* Increase minor version
-- Stefano Marsili <efanomars@gmx.ch> Fri, 13 Sep 2019 19:29:39 +0100
stmm-games (0.12) unstable; urgency=low
* Add event priority
......
......@@ -29,7 +29,7 @@ CheckBinaryNotSourceTree()
CheckBuildType()
DefineSharedLibOption()
DefineCommonOptions()
DefineCommonCompileOptions()
DefineCommonCompileOptions("c++14")
# Headers dir
set(STMMI_INCLUDE_DIR "${PROJECT_SOURCE_DIR}/include")
......
......@@ -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 12)
set(STMM_GAMES_FAKE_MINOR_VERSION 13)
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 12)
set(STMM_GAMES_FAKE_REQ_STMM_GAMES_MINOR_VERSION 13)
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")
......
......@@ -29,7 +29,7 @@ CheckBinaryNotSourceTree()
CheckBuildType()
DefineSharedLibOption()
DefineCommonOptions()
DefineCommonCompileOptions()
DefineCommonCompileOptions("c++14")
# Headers dir
set(STMMI_INCLUDE_DIR "${PROJECT_SOURCE_DIR}/include")
......@@ -127,25 +127,17 @@ set(STMMI_HEADERS
set(STMMI_SOURCES_DIR "${PROJECT_SOURCE_DIR}/src")
# Source files (and headers only used for building)
set(STMMI_SOURCES
"${STMMI_SOURCES_DIR}/stdtheme.cc"
# "${STMMI_SOURCES_DIR}/stdtheme.cc"
"${STMMI_SOURCES_DIR}/commontheme.cc"
"${STMMI_SOURCES_DIR}/containermodifier.cc"
"${STMMI_SOURCES_DIR}/gameconstraints.cc"
"${STMMI_SOURCES_DIR}/gamedialog.h"
"${STMMI_SOURCES_DIR}/gamedialog.cc"
"${STMMI_SOURCES_DIR}/gamegtkdrawingarea.h"
"${STMMI_SOURCES_DIR}/gamegtkdrawingarea.cc"
"${STMMI_SOURCES_DIR}/gamewindow.h"
"${STMMI_SOURCES_DIR}/gamewindow.cc"
"${STMMI_SOURCES_DIR}/highscoredialog.h"
"${STMMI_SOURCES_DIR}/highscoredialog.cc"
"${STMMI_SOURCES_DIR}/inputstrings.h"
"${STMMI_SOURCES_DIR}/inputstrings.cc"
"${STMMI_SOURCES_DIR}/levelshowthemewidget.cc"
"${STMMI_SOURCES_DIR}/mainwindow.cc"
"${STMMI_SOURCES_DIR}/playersdialog.h"
"${STMMI_SOURCES_DIR}/playersdialog.cc"
"${STMMI_SOURCES_DIR}/stdlevelview.h"
"${STMMI_SOURCES_DIR}/stdlevelview.cc"
"${STMMI_SOURCES_DIR}/stdtheme.cc"
......@@ -158,11 +150,20 @@ set(STMMI_SOURCES
"${STMMI_SOURCES_DIR}/stdviewlayout.h"
"${STMMI_SOURCES_DIR}/stdviewlayout.cc"
"${STMMI_SOURCES_DIR}/themecontainerwidget.cc"
"${STMMI_SOURCES_DIR}/themedialog.h"
"${STMMI_SOURCES_DIR}/themedialog.cc"
"${STMMI_SOURCES_DIR}/themelayout.cc"
"${STMMI_SOURCES_DIR}/themewidget.cc"
#
"${STMMI_SOURCES_DIR}/dialogs/gamedialog.h"
"${STMMI_SOURCES_DIR}/dialogs/gamedialog.cc"
"${STMMI_SOURCES_DIR}/dialogs/highscoredialog.h"
"${STMMI_SOURCES_DIR}/dialogs/highscoredialog.cc"
"${STMMI_SOURCES_DIR}/dialogs/inputstrings.h"
"${STMMI_SOURCES_DIR}/dialogs/inputstrings.cc"
"${STMMI_SOURCES_DIR}/dialogs/playersdialog.h"
"${STMMI_SOURCES_DIR}/dialogs/playersdialog.cc"
"${STMMI_SOURCES_DIR}/dialogs/themedialog.h"
"${STMMI_SOURCES_DIR}/dialogs/themedialog.cc"
#
"${STMMI_SOURCES_DIR}/animations/backgroundthanifactory.cc"
"${STMMI_SOURCES_DIR}/animations/explosionthanifactory.cc"
"${STMMI_SOURCES_DIR}/animations/imagesequencethanifactory.cc"
......
......@@ -356,7 +356,7 @@ void GameDialog::regenerateGameInfos() noexcept
}
}
if (oGameConstraints.m_refPrefSelector) {
sConstraints.append("Game has additional undisclosed constraints (game options related)\n");
sConstraints.append("Game has additional constraints (game options related)\n");
}
m_refTextBufferConstraints->set_text(sConstraints);
std::string sAuthors;
......
......@@ -900,9 +900,6 @@ void GameWindow::onButtonAbout() noexcept
const Glib::ustring s_sStmmGamesWebSite = "http://www.efanomars.com/libraries/stmm-games";
std::vector<Glib::ustring> aAuthors;
std::copy(m_aAuthors.begin(), m_aAuthors.end(), std::back_inserter(aAuthors));
aAuthors.push_back("");
aAuthors.push_back("Based on the stmm-games library");
aAuthors.push_back("Stefano Marsili " + s_sStmmGamesWebSite);
Gtk::AboutDialog oDialog;
oDialog.set_logo(m_refLogoPixbuf);
......@@ -915,6 +912,7 @@ void GameWindow::onButtonAbout() noexcept
//oDialog.set_license("");
oDialog.set_website(m_sWebSite.empty() ? s_sStmmGamesWebSite : m_sWebSite);
//oDialog.set_translator_credits("");
oDialog.set_comments("(based on the stmm-games library)");
oDialog.run();
}
void GameWindow::onButtonQuit() noexcept
......
......@@ -24,10 +24,10 @@
#include "gamegtkdrawingarea.h"
#include "playersdialog.h"
#include "gamedialog.h"
#include "highscoredialog.h"
#include "themedialog.h"
#include "dialogs/playersdialog.h"
#include "dialogs/gamedialog.h"
#include "dialogs/highscoredialog.h"
#include "dialogs/themedialog.h"
#include <stmm-games/appconfig.h>
#include <stmm-games/gameproxy.h>
......
......@@ -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 12)
set(STMM_GAMES_GTK_MINOR_VERSION 13)
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 12)
set(STMM_GAMES_GTK_REQ_STMM_GAMES_MINOR_VERSION 13)
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)
......
......@@ -29,7 +29,7 @@ CheckBinaryNotSourceTree()
CheckBuildType()
DefineSharedLibOption()
DefineCommonOptions()
DefineCommonCompileOptions()
DefineCommonCompileOptions("c++14")
# Headers dir
set(STMMI_INCLUDE_DIR "${PROJECT_SOURCE_DIR}/include")
......@@ -355,7 +355,7 @@ DefineTargetPublicCompileOptions(stmm-games-xml)
set(STMMI_PKG_VERSION "${STMM_GAMES_XML_VERSION}")
include(GNUInstallDirs)
set(STMMI_PKG_DATA_DIR "${CMAKE_INSTALL_FULL_DATADIR}/stmm-games")
set(STMMI_PKG_USER_DATA_DIR "$ENV{HOME}/.local/${CMAKE_INSTALL_DATADIR}/stmm-games")
set(STMMI_PKG_USER_DATA_DIR ".local/${CMAKE_INSTALL_DATADIR}/stmm-games")
set(STMMI_RO_DATA_DIR_1 "/usr/local/${CMAKE_INSTALL_DATADIR}/stmm-games")
set(STMMI_RO_DATA_DIR_2 "/usr/${CMAKE_INSTALL_DATADIR}/stmm-games")
......
......@@ -66,7 +66,7 @@ std::vector<std::string> getDataDirs();
*
* @return The relative data directory. Can be empty.
*/
const std::string& getUserDataDir();
std::string getUserDataDir();
} // namespace xml
......
......@@ -22,6 +22,8 @@
#include <cassert>
#include <stdlib.h>
namespace stmg
{
......@@ -60,10 +62,11 @@ std::vector<std::string> getDataDirs()
return aDataDirs;
}
const std::string& getUserDataDir()
std::string getUserDataDir()
{
static std::string s_sUserDataDir = "@STMMI_PKG_USER_DATA_DIR@";
return s_sUserDataDir;
char* p0HomeDir = ::getenv("HOME");
static const std::string s_sUserDataDir = "@STMMI_PKG_USER_DATA_DIR@";
return std::string(p0HomeDir) + "/" + s_sUserDataDir;
}
} // namespace xml
......
......@@ -36,177 +36,6 @@ static const std::string s_sTraitAnyNameValue = "*";
const std::string XmlCommonParser::s_sAttrNameIgnorePrefix = "_ign_";
const std::string XmlCommonParser::s_sElementNameIgnorePrefix = "_Ign_";
//const std::string XmlCommonParser::s_sHexDigits = "0123456789ABCDEF";
//
//uint32_t XmlCommonParser::strToUint32(ParserCtx& oCtx, const xmlpp::Element* p0Element, const std::string& sAttrName
// , const std::string& sInt, bool bMin, uint32_t nMin, bool bMax, uint32_t nMax)
//{
// const auto nSize = sInt.size();
// if (nSize == 0) {
// throw XmlCommonErrors::errorAttrCannotBeEmpty(oCtx, p0Element, sAttrName);
// }
// if (nSize >= 2) {
// const gunichar c0 = sInt[0];
// const gunichar c1 = sInt[1];
// if ((c0 == '0') && (c1 == 'x')) {
// // hex number 0xF34
// const std::string sHex = Glib::ustring{sInt}.uppercase();
// const auto nHexSize = static_cast<uint32_t>(sHex.size());
// uint64_t nRes = 0;
// uint32_t nIdx = 0;
// for (; nIdx < nHexSize; ++nIdx) {
// auto nQ = s_sHexDigits.find(sHex[nIdx]);
// if (nQ == std::string::npos) {
// break; // while ----
// }
// nRes = (nRes << 4) | static_cast<uint8_t>(nQ);
// if (bMax && (nRes > nMax)) {
// throw XmlCommonErrors::error(oCtx, p0Element, sAttrName, Util::stringCompose("Attribute '%1' wrong hex number", sAttrName));
// }
// }
// if ((nIdx < nHexSize) || (nHexSize == 0)) {
// throw XmlCommonErrors::error(oCtx, p0Element, sAttrName, Util::stringCompose(
// "Attribute '%1' must be <= than %2", sAttrName, std::to_string(nMax)));
// }
// if (bMin && (nRes < nMin)) {
// throw XmlCommonErrors::error(oCtx, p0Element, sAttrName, Util::stringCompose(
// "Attribute '%1' must be >= than %2", sAttrName, std::to_string(nMin)));
// }
// return static_cast<uint32_t>(nRes); //-------------------------------
// }
// }
// //
// return strToNumber<uint32_t>(oCtx, p0Element, sAttrName, sInt, false, bMin, nMin, bMax, nMax);
//}
//
//TileChar XmlCommonParser::strToTileChar(ParserCtx& oCtx, const xmlpp::Element* p0Element, const std::string& sAttrName
// , const std::string& sChar)
//{
// const auto nSize = sChar.size();
// if (nSize == 0) {
// throw XmlCommonErrors::errorAttrCannotBeEmpty(oCtx, p0Element, sAttrName);
// }
// TileChar oTileChar;
// const gunichar c = sChar[0];
// if (c == '\'') {
// Glib::ustring sUChar = sChar;
// const auto nUSize = sUChar.size();
// if ((nUSize != 3) || (sUChar[2] != '\'')) {
// throw XmlCommonErrors::error(oCtx, p0Element, sAttrName, Util::stringCompose("Attribute '%1' wrong unicode char", sAttrName));
// }
// const gunichar cRes = sUChar[1];
// const auto nCode = static_cast<uint32_t>(cRes);
// if (! ((nCode >= TileChar::CHAR_UCS4_MIN) && (nCode <= TileChar::CHAR_UCS4_MAX))) {
// throw XmlCommonErrors::errorAttrUTF8CharInvalid(oCtx, p0Element, sAttrName, std::to_string(nCode));
// }
// oTileChar.setChar(nCode);
// } else if ((c >= '0') && (c <= '9')) {
// // char code
// const uint32_t nCode = strToUint32(oCtx, p0Element, sAttrName, sChar, true, TileChar::CHAR_UCS4_MIN, true, TileChar::CHAR_UCS4_MAX);
// oTileChar.setChar(nCode);
// } else {
// // char name
// validateName(oCtx, p0Element, sAttrName, sChar, false);
// const int32_t nCharIdx = oCtx.named().chars().addName(sChar);
// if (nCharIdx > TileChar::CHAR_INDEX_MAX) {
// throw XmlCommonErrors::errorAttrOneTooManyNames(oCtx, p0Element, sAttrName);
// }
// assert(nCharIdx >= TileChar::CHAR_INDEX_MIN);
// oTileChar.setCharIndex(nCharIdx);
// }
// return oTileChar;
//}
//
//TileColor XmlCommonParser::strToTileColor(ParserCtx& oCtx, const xmlpp::Element* p0Element, const std::string& sAttrName
// , const std::string& sColor)
//{
// const auto nSize = sColor.size();
// if (nSize == 0) {
// throw oCtx.error("Error: attribute " + sAttrName + " cannot be empty");
// }
// TileColor oTileColor;
// const gunichar c = sColor[0];
// if (c == '#') {
// // "#F0A80D"
// uint8_t nR;
// uint8_t nG;
// uint8_t nB;
// strHexToRGB(oCtx, p0Element, sAttrName, sColor, nR, nG, nB);
// oTileColor.setColorRGB(nR, nG, nB);
// } else if (c == '%') {
// // "%nR^nG^nB"
// const std::size_t nFoundDash1Pos = sColor.find('^', 1);
// std::size_t nFoundDash2Pos = std::string::npos;
// if (nFoundDash1Pos != std::string::npos) {
// nFoundDash2Pos = sColor.find('^', nFoundDash1Pos + 1);
// }
// if (nFoundDash2Pos != std::string::npos) {
// throw oCtx.error("Error: attribute " + sAttrName + " malformed, format is '%r^g^b'");
// }
// std::string sR = sColor.substr(1, nFoundDash1Pos - 1);
// const uint8_t nR = static_cast<uint8_t>(strToNumber<int32_t>(oCtx, p0Element, sAttrName, sR, false, true, 0, true, 255));
// std::string sG = sColor.substr(nFoundDash1Pos + 1, nFoundDash2Pos - (nFoundDash1Pos + 1));
// const uint8_t nG = static_cast<uint8_t>(strToNumber<int32_t>(oCtx, p0Element, sAttrName, sG, false, true, 0, true, 255));
// std::string sB = sColor.substr(nFoundDash2Pos + 1, nSize - (nFoundDash2Pos + 1));
// const uint8_t nB = static_cast<uint8_t>(strToNumber<int32_t>(oCtx, p0Element, sAttrName, sB, false, true, 0, true, 255));
// oTileColor.setColorRGB(nR, nG, nB);
// } else if ((c >= '0') && (c <= '9')) {
// // color pal
// const int32_t nPal = strToNumber<int32_t>(oCtx, p0Element, sAttrName, sColor, false, true, TileColor::COLOR_PAL_FIRST, true, TileColor::COLOR_PAL_LAST);
// oTileColor.setColorPal(nPal);
// } else {
// // color name
// validateName(oCtx, p0Element, sAttrName, sColor, false);
// const int32_t nColorIdx = oCtx.named().colors().addName(sColor);
// if (nColorIdx > TileColor::COLOR_INDEX_MAX) {
// throw XmlCommonErrors::errorAttrOneTooManyNames(oCtx, p0Element, sAttrName);
// }
// assert(nColorIdx >= TileColor::COLOR_INDEX_MIN);
// oTileColor.setColorIndex(nColorIdx);
// }
// return oTileColor;
//}
//void XmlCommonParser::strHexToRGB(ParserCtx& oCtx, const xmlpp::Element* p0Element, const std::string& sAttrName
// , const std::string& sHexNr, uint8_t& nR, uint8_t& nG, uint8_t& nB)
//{
// bool bFormatError = false;
// int32_t nHexIdx;
// const std::string sHex = Glib::ustring{sHexNr}.uppercase();
// const std::string::size_type nLen = sHex.length();
// if ((nLen == 1+6) && (sHex.at(0) == '#')) {
// nHexIdx = 1;
// } else {
// bFormatError = true;
// }
// if (!bFormatError) {
// if (sHex.find_first_not_of(s_sHexDigits, nHexIdx) != std::string::npos) {
// bFormatError = true;
// }
// }
// if (bFormatError) {
// throw XmlCommonErrors::errorAttrHexColorFormat(oCtx, p0Element, sAttrName);
// }
// auto nR1 = s_sHexDigits.find(sHex[nHexIdx + 0]); assert(nR1 != std::string::npos);
// auto nR2 = s_sHexDigits.find(sHex[nHexIdx + 1]); assert(nR2 != std::string::npos);
// auto nG1 = s_sHexDigits.find(sHex[nHexIdx + 2]); assert(nG1 != std::string::npos);
// auto nG2 = s_sHexDigits.find(sHex[nHexIdx + 3]); assert(nG2 != std::string::npos);
// auto nB1 = s_sHexDigits.find(sHex[nHexIdx + 4]); assert(nB1 != std::string::npos);
// auto nB2 = s_sHexDigits.find(sHex[nHexIdx + 5]); assert(nB2 != std::string::npos);
// nR = (static_cast<uint8_t>(nR1) << 4) | static_cast<uint8_t>(nR2);
// nG = (static_cast<uint8_t>(nG1) << 4) | static_cast<uint8_t>(nG2);
// nB = (static_cast<uint8_t>(nB1) << 4) | static_cast<uint8_t>(nB2);
//}
//
//bool XmlCommonParser::strToBool(ParserCtx& oCtx, const xmlpp::Element* p0Element, const std::string& sAttrName, const std::string& sTF)
//{
// auto oPair = Util::strToBool(sTF);
// std::string& sError = oPair.second;
// if (! sError.empty()) {
// throw XmlCommonErrors::error(oCtx, p0Element, sAttrName, (sAttrName.empty() ? "" : "Attribute '" + sAttrName + "':") + sError);
// }
// return oPair.first;
//}
bool XmlCommonParser::validateName(ParserCtx& oCtx, const xmlpp::Element* p0Element, const std::string& sAttrName
, const std::string& sName, bool bAllowAny)
{
......
......@@ -20,12 +20,12 @@
# MINOR is REVISION (implementation of interface)
# AGE is always 0
set(STMM_GAMES_XML_MAJOR_VERSION 0)
set(STMM_GAMES_XML_MINOR_VERSION 12)
set(STMM_GAMES_XML_MINOR_VERSION 13)
set(STMM_GAMES_XML_VERSION "${STMM_GAMES_XML_MAJOR_VERSION}.${STMM_GAMES_XML_MINOR_VERSION}.0")
# required stmm-games-gtk version
set(STMM_GAMES_XML_REQ_STMM_GAMES_GTK_MAJOR_VERSION 0)
set(STMM_GAMES_XML_REQ_STMM_GAMES_GTK_MINOR_VERSION 12)
set(STMM_GAMES_XML_REQ_STMM_GAMES_GTK_MINOR_VERSION 13)
set(STMM_GAMES_XML_REQ_STMM_GAMES_GTK_VERSION "${STMM_GAMES_XML_REQ_STMM_GAMES_GTK_MAJOR_VERSION}.${STMM_GAMES_XML_REQ_STMM_GAMES_GTK_MINOR_VERSION}")
# required libxml++-2.6 version
......
......@@ -29,7 +29,7 @@ CheckBinaryNotSourceTree()
CheckBuildType()
DefineSharedLibOption()
DefineCommonOptions()
DefineCommonCompileOptions()
DefineCommonCompileOptions("c++14")
# Headers dir
set(STMMI_INCLUDE_DIR "${PROJECT_SOURCE_DIR}/include")
......
......@@ -20,7 +20,7 @@
# MINOR is REVISION (implementation of interface)
# AGE is always 0
set(STMM_GAMES_MAJOR_VERSION 0)
set(STMM_GAMES_MINOR_VERSION 12)
set(STMM_GAMES_MINOR_VERSION 13)
set(STMM_GAMES_VERSION "${STMM_GAMES_MAJOR_VERSION}.${STMM_GAMES_MINOR_VERSION}.0")
# required stmm-input-ev version
......
......@@ -58,8 +58,11 @@ endfunction(DefineCommonOptions)
# DefineCommonCompileOptions Define compile options for all subprojects
#
function(DefineCommonCompileOptions)
string(STRIP "${CMAKE_CXX_FLAGS} -std=c++14" CMAKE_CXX_FLAGS)
# Parameters:
# STMMI_CPP_STD The compiler c++ standard to use (ex. c++14)
#
function(DefineCommonCompileOptions STMMI_CPP_STD)
string(STRIP "${CMAKE_CXX_FLAGS} -std=${STMMI_CPP_STD}" CMAKE_CXX_FLAGS)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}" PARENT_SCOPE)
if (("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") OR ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang"))
if ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
......
......@@ -73,7 +73,7 @@ def main():
os.chdir(sParentDirPath)
aExclPatterns = ["build*", "configure", "nbproject*", ".project", ".cproject", ".settings", "core"]
aExclPatterns = ["build*", "configure", "nbproject*", ".project", ".cproject", ".settings", "core", "*.geany", "*.geanywb"]
sExcludes = " --exclude=.metadata"
sExcludes += " --exclude=.git"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment