Skip to content

Commit

Permalink
test trying to use qt mingw
Browse files Browse the repository at this point in the history
  • Loading branch information
Robosturm committed Nov 11, 2023
1 parent 3cec981 commit 91613c8
Show file tree
Hide file tree
Showing 20 changed files with 394 additions and 32 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ jobs:
COMPILER_VERSION: 'win64_mingw'
target: 'desktop'
qtPath: 'mingw_64'
qtTools: 'qt.tools.win64_mingw1120'
installerCommands1: choco install openssl --force -y --install-arguments="'/DIR=C:/openSsl/'"
installerCommands2: ''
cmakeOptions: '"-DCMAKE_GENERATOR:STRING=MinGW Makefiles" -DOPENSSL_LIB_PATH="C:/openSsl/bin" -DOPENSSL_INCLUDE_DIR="C:/openSsl/include" -DOPENSSL_USE_STATIC_LIBS="ON" -DPRECOMPILEDOPENSSL="ON"'
Expand All @@ -28,6 +29,7 @@ jobs:
COMPILER_VERSION: 'win64_mingw'
target: 'desktop'
qtPath: 'mingw_64'
qtTools: 'qt.tools.win64_mingw1120'
installerCommands1: choco install openssl --force -y --install-arguments="'/DIR=C:/openSsl/'"
installerCommands2: ''
cmakeOptions: '"-DCMAKE_GENERATOR:STRING=MinGW Makefiles" -DOPENSSL_LIB_PATH="C:/openSsl/bin" -DOPENSSL_INCLUDE_DIR="C:/openSsl/include" -DOPENSSL_USE_STATIC_LIBS="ON" -DPRECOMPILEDOPENSSL="ON" -DGRAPHICSUPPORT=OFF -DAUDIOSUPPORT=OFF -DUPDATESUPPORT=OFF'
Expand All @@ -36,13 +38,15 @@ jobs:
COMPILER_VERSION: ''
target: 'desktop'
qtPath: ''
qtTools: ''
installerCommands1: 'sudo apt-get update'
installerCommands2: 'sudo apt-get install gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-libav gstreamer1.0-tools gstreamer1.0-x gstreamer1.0-alsa gstreamer1.0-gl gstreamer1.0-gtk3 gstreamer1.0-qt5 gstreamer1.0-pulseaudio'
cmakeOptions: ''
- buildTarget: macos-desktop
os: macos-latest
COMPILER_VERSION: 'clang_64'
qtPath: 'clang_64'
qtTools: ''
target: 'desktop'
installerCommands1: ''
installerCommands2: ''
Expand All @@ -51,6 +55,7 @@ jobs:
os: windows-latest
COMPILER_VERSION: 'android_armv7'
qtPath: 'android_armv7'
qtTools: ''
target: 'android'
target-api-level: '23'
abi : "armeabi-v7a"
Expand All @@ -64,6 +69,7 @@ jobs:
os: windows-latest
COMPILER_VERSION: 'android_arm64_v8a'
qtPath: 'android_arm64_v8a'
qtTools: ''
target: 'android'
target-api-level: '23'
abi : "arm64-v8a"
Expand Down Expand Up @@ -115,6 +121,8 @@ jobs:
modules: 'qtmultimedia'
dir: '${{github.workspace}}/qt/'
install-deps: "true"
tools: '${{qtTools}}'
add-tools-to-path: "true"

- name: Install OS Dependencies 1
run: ${{matrix.installerCommands1}}
Expand Down
11 changes: 6 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,6 @@ elseif(PRECOMPILEDOPENSSL AND "${CMAKE_SYSTEM_NAME}" STREQUAL "Windows")
set(OPENSSL_LIBS
${OPENSSL_LIB_PATH}/libcrypto-3-x64.dll
${OPENSSL_LIB_PATH}/libssl-3-x64.dll
${OPENSSL_LIB_PATH}/capi.dll
${OPENSSL_LIB_PATH}/dasync.dll
${OPENSSL_LIB_PATH}/legacy.dll
${OPENSSL_LIB_PATH}/loader_attic.dll
${OPENSSL_LIB_PATH}/padlock.dll
CACHE INTERNAL "")
include_directories(${OPENSSL_INCLUDE_DIR})
message ("OpenSsL Include directories:" ${OPENSSL_INCLUDE_DIR})
Expand All @@ -127,6 +122,10 @@ else()
)
endif()

# todo kernel32.dll
# todo shell32.dll
# todo msvcrt.dll

###################################################################################
# Set build dependend defines
###################################################################################
Expand Down Expand Up @@ -766,6 +765,7 @@ set(${PROJECT_NAME}_SRCS
multiplayer/dialogotherlobbyinfo.h multiplayer/dialogotherlobbyinfo.cpp
multiplayer/dialogcostatsinfo.cpp multiplayer/dialogcostatsinfo.h
multiplayer/dialogAutoMatches.cpp multiplayer/dialogAutoMatches.h
multiplayer/dialogselectdownloadmap.cpp multiplayer/dialogselectdownloadmap.h
multiplayer/networkcommands.h

#campaign support
Expand Down Expand Up @@ -1244,6 +1244,7 @@ if("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows")
"$<TARGET_FILE:${PROJECT_NAME}>"
--libdir \"${FullInstallPath}\"
--plugindir \"${FullInstallPath}\"
--compiler-runtime
--no-quick-import
--no-translations
COMMENT "Running windeployqt..."
Expand Down
2 changes: 2 additions & 0 deletions coreengine/metatyperegister.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include "menue/movementplanner.h"
#include "menue/generatormenu.h"

#include "multiplayer/lobbymenu.h"
#include "multiplayer/multiplayermenu.h"
#include "multiplayer/networkgamedataview.h"
#include "multiplayer/dialogotherlobbyinfo.h"
Expand Down Expand Up @@ -233,6 +234,7 @@ void MetaTypeRegister::registerInterfaceData()
qmlRegisterInterface<EditorMenue>("EditorMenue", 1);
qmlRegisterInterface<BaseGamemenu>("BaseGamemenu", 1);
qmlRegisterInterface<Basemenu>("Basemenu", 1);
qmlRegisterInterface<LobbyMenu>("LobbyMenu", 1);
qmlRegisterInterface<GeneratorMenu>("GeneratorMenu", 1);
qmlRegisterInterface<PageData>("PageData", 1);
qmlRegisterInterface<DialogOtherLobbyInfo>("DialogOtherLobbyInfo", 1);
Expand Down
6 changes: 5 additions & 1 deletion game/gamemap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1651,6 +1651,10 @@ void GameMap::readMapHeader(QDataStream& pStream, MapHeaderInfo & headerInfo)
return;
}
}
else
{
headerInfo.m_mapMagic = GlobalUtils::MAP_MAGIC;
}
if (headerInfo.m_Version > 1)
{
pStream >> headerInfo.m_mapName;
Expand Down Expand Up @@ -1686,7 +1690,7 @@ void GameMap::deserializer(QDataStream& pStream, bool fast)
spLoadingScreen pLoadingScreen = LoadingScreen::getInstance();
// restore map header
readMapHeader(pStream, m_headerInfo);
if (validMap(m_headerInfo))
if (!validMap(m_headerInfo))
{
return;
}
Expand Down
4 changes: 4 additions & 0 deletions game/player.h
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,10 @@ class Player : public QObject, public oxygine::Actor, public FileSerializable, p
{
updatePlayerID();
}
else if (m_pMap == nullptr && m_playerId < 0)
{
m_playerId = 0;
}
return m_playerId;
}
/**
Expand Down
5 changes: 5 additions & 0 deletions mapsupport/mapfilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,11 @@ bool MapFilter::matchesMapFlags(const QVector<FlagFilter> & filters, GameEnums::
return matches && (!hasOptional || count > 0);
}

const QVector<MapFilter::FlagFilter> & MapFilter::getFlagFilter() const
{
return m_filter;
}

QString MapFilter::getMapName() const
{
return m_mapName;
Expand Down
18 changes: 11 additions & 7 deletions mapsupport/mapfilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,6 @@

class MapFilter final
{
struct FlagFilter
{
GameEnums::MapFilterFlags flag;
bool isActive{false};
bool isOptional{false};
bool matches(GameEnums::MapFilterFlags flags) const;
};
struct MinMaxFilter
{
qint32 minValue{0};
Expand All @@ -22,6 +15,14 @@ class MapFilter final
};

public:
struct FlagFilter
{
GameEnums::MapFilterFlags flag;
bool isActive{false};
bool isOptional{false};
bool matches(GameEnums::MapFilterFlags flags) const;
};

explicit MapFilter() = default;
virtual ~MapFilter() = default;
QJsonObject toJson() const;
Expand Down Expand Up @@ -57,7 +58,10 @@ class MapFilter final
QString getMapName() const;
void setMapName(const QString &newMapName);

const QVector<FlagFilter> & getFlagFilter() const;

static bool matchesMapFlags(const QVector<FlagFilter> & filters, GameEnums::MapFilterFlags flags);

private:

QVector<FlagFilter> m_filter;
Expand Down
7 changes: 6 additions & 1 deletion multiplayer/dialogotherlobbyinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ DialogOtherLobbyInfo::DialogOtherLobbyInfo(LobbyMenu *pBaseMenu)
loadXmlFile(m_uiXml);
}

LobbyMenu* DialogOtherLobbyInfo::getLobbyMenu()
{
return m_pLobbyMenu;
}

QStringList DialogOtherLobbyInfo::getFoundPlayers()
{
return m_foundPlayers;
Expand Down Expand Up @@ -70,4 +75,4 @@ void DialogOtherLobbyInfo::showAutoMatches()
void DialogOtherLobbyInfo::receivedShowAutoMatches(const QJsonObject & objData)
{

}
}
1 change: 1 addition & 0 deletions multiplayer/dialogotherlobbyinfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class DialogOtherLobbyInfo final : public CustomDialog
Q_INVOKABLE QString getUserName(qint32 idx);
Q_INVOKABLE void showPlayerStats(const QString & player);
Q_INVOKABLE void showAutoMatches();
Q_INVOKABLE LobbyMenu* getLobbyMenu();
private slots:
void onSearchedPlayersReceived(const QStringList & foundPlayers);
void receivedPlayerStats(const QJsonObject & objData);
Expand Down
150 changes: 150 additions & 0 deletions multiplayer/dialogselectdownloadmap.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
#include "coreengine/globalutils.h"
#include "coreengine/mainapp.h"

#include "multiplayer/lobbymenu.h"
#include "multiplayer/networkcommands.h"
#include "multiplayer/dialogselectdownloadmap.h"

#include "network/JsonKeys.h"

#include "objects/dialogs/mapSelection/mapselectionfilterdialog.h"
#include "objects/base/spriteobject.h"

#include "ui_reader/uifactory.h"

DialogSelectDownloadMap::DialogSelectDownloadMap(LobbyMenu* pBaseMenu)
: CustomDialog("", "", pBaseMenu, tr("Close")),
m_pBaseMenu(pBaseMenu)
{
m_uiXml = "ui/multiplayer/selectDownloadMap.xml";
loadXmlFile(m_uiXml);
}

void DialogSelectDownloadMap::showMapFilter()
{
spMapSelectionFilterDialog mapSelectionFilterDialog = MemoryManagement::create<MapSelectionFilterDialog>(&m_mapFilter);
addChild(mapSelectionFilterDialog);
connect(mapSelectionFilterDialog.get(), &MapSelectionFilterDialog::sigFinished, this, &DialogSelectDownloadMap::filterChanged, Qt::QueuedConnection);
}

qint32 DialogSelectDownloadMap::getCurrentPage() const
{
return m_currentPage;
}

void DialogSelectDownloadMap::setCurrentPage(qint32 newCurrentPage)
{
m_currentPage = newCurrentPage;
}

void DialogSelectDownloadMap::filterChanged()
{
QString command = QString(NetworkCommands::REQUESTAVAILABLEMAPS);
QJsonObject data = m_mapFilter.toJson();
data.insert(JsonKeys::JSONKEY_COMMAND, command);
m_pBaseMenu->requestAvailableMaps(data);
}

void DialogSelectDownloadMap::receivedMapData(const QJsonObject &objData)
{
m_mapData = objData;
m_minimapImages.clear();
QJsonArray mapArray = m_mapData.value(JsonKeys::JSONKEY_FOUNDITEMS).toArray();
for (const auto & mapData : mapArray)
{
QByteArray data = GlobalUtils::toByteArray(mapData.toObject().value(JsonKeys::JSONKEY_MINIMAPDATA).toArray());
QImage img;
QBuffer buffer(&data);
buffer.open(QIODevice::ReadOnly);
img.load(&buffer, "PNG");
m_minimapImages.push_back(img);
oxygine::spSingleResAnim minimapImage = MemoryManagement::create<oxygine::SingleResAnim>();
Mainapp::getInstance()->loadResAnim(minimapImage, img, 1, 1, 1);
m_minimapSprites.push_back(minimapImage);
}
refreshUi();
}

oxygine::spActor DialogSelectDownloadMap::loadCustomId(const QString & item, qint32 x, qint32 y, bool enabled, bool visible, float scale,
const QString & id, const QString & tooltip, const QString & onEvent,
UiFactory* pFactoty, CreatedGui* pMenu, qint32 loopIdx, qint32 & scaledWidth, qint32 & scaledHeight)
{
if (item == "MINIMAP")
{
spSpriteObject pSprite = MemoryManagement::create<SpriteObject>();
pSprite->setObjectName(id);
pSprite->setResAnim(m_minimapSprites[loopIdx].get());
pSprite->setScale(scale);
pSprite->setPosition(x, y);
pSprite->setVisible(visible);
pSprite->setEnabled(enabled);
pSprite->setSize(m_minimapSprites[loopIdx]->getSize() * scale);
scaledWidth = m_minimapSprites[loopIdx]->getWidth() * scale;
scaledHeight = m_minimapSprites[loopIdx]->getHeight() * scale;
if (!onEvent.isEmpty())
{
pSprite->addClickListener([pFactoty, onEvent, id, loopIdx, pMenu](oxygine::Event*)
{
emit pFactoty->sigDoEvent(onEvent, id, loopIdx, pMenu);
});
}
return pSprite;
}
else
{
return oxygine::spActor();
}
}

void DialogSelectDownloadMap::downloadMap(qint32 mapIndex)
{

}

QString DialogSelectDownloadMap::getMapPath(qint32 mapIndex)
{
QJsonArray mapArray = m_mapData.value(JsonKeys::JSONKEY_FOUNDITEMS).toArray();
return mapArray[mapIndex].toObject().value(JsonKeys::JSONKEY_MAPPATH).toString();
}

QString DialogSelectDownloadMap::getMapName(qint32 mapIndex)
{
QJsonArray mapArray = m_mapData.value(JsonKeys::JSONKEY_FOUNDITEMS).toArray();
return mapArray[mapIndex].toObject().value(JsonKeys::JSONKEY_MAPNAME).toString();
}

QString DialogSelectDownloadMap::getMapAuthor(qint32 mapIndex)
{
QJsonArray mapArray = m_mapData.value(JsonKeys::JSONKEY_FOUNDITEMS).toArray();
return mapArray[mapIndex].toObject().value(JsonKeys::JSONKEY_MAPAUTHOR).toString();
}

qint32 DialogSelectDownloadMap::getMapPlayers(qint32 mapIndex)
{
QJsonArray mapArray = m_mapData.value(JsonKeys::JSONKEY_FOUNDITEMS).toArray();
return mapArray[mapIndex].toObject().value(JsonKeys::JSONKEY_MAPPLAYERS).toInt();
}

qint32 DialogSelectDownloadMap::getMapWidth(qint32 mapIndex)
{
QJsonArray mapArray = m_mapData.value(JsonKeys::JSONKEY_FOUNDITEMS).toArray();
return mapArray[mapIndex].toObject().value(JsonKeys::JSONKEY_MAPWIDTH).toInt();
}

qint32 DialogSelectDownloadMap::getMapHeight(qint32 mapIndex)
{
QJsonArray mapArray = m_mapData.value(JsonKeys::JSONKEY_FOUNDITEMS).toArray();
return mapArray[mapIndex].toObject().value(JsonKeys::JSONKEY_MAPHEIGHT).toInt();
}

qint64 DialogSelectDownloadMap::getMapFlags(qint32 mapIndex)
{
QJsonArray mapArray = m_mapData.value(JsonKeys::JSONKEY_FOUNDITEMS).toArray();
return mapArray[mapIndex].toObject().value(JsonKeys::JSONKEY_MAPFLAGS).toInteger();
}

qint32 DialogSelectDownloadMap::getMapCounts()
{
return m_mapData.value(JsonKeys::JSONKEY_FOUNDITEMS).toArray().size();
}

Loading

0 comments on commit 91613c8

Please sign in to comment.