summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <bjorn@lindeijer.nl>2024-03-26 17:47:11 +0100
committerThorbjørn Lindeijer <bjorn@lindeijer.nl>2024-04-08 13:44:29 +0200
commit8aa84d089e4233e17a6263cb0cf629331e63d051 (patch)
treefa46597046c977f17fd8f0d5a68a26b0bf320e47
parent59919635523d41f3a15120c83db4b7d080c155de (diff)
downloadmana-8aa84d089e4233e17a6263cb0cf629331e63d051.tar.gz
mana-8aa84d089e4233e17a6263cb0cf629331e63d051.tar.bz2
mana-8aa84d089e4233e17a6263cb0cf629331e63d051.tar.xz
mana-8aa84d089e4233e17a6263cb0cf629331e63d051.zip
Compile fixes for MSYS2 UCRT64
Also added instructions for installing the dependencies on MSYS2. The selection of the default language is commented out for now. It will be fixed in another change.
-rw-r--r--README.md12
-rw-r--r--src/client.cpp7
-rw-r--r--src/gui/npcdialog.cpp2
-rw-r--r--src/gui/truetypefont.h4
-rw-r--r--src/main.cpp4
5 files changed, 19 insertions, 10 deletions
diff --git a/README.md b/README.md
index 2b779725..852aeb2a 100644
--- a/README.md
+++ b/README.md
@@ -128,6 +128,18 @@ Installing the dependencies on Fedora:
SDL2_image-devel SDL2_mixer-devel SDL2_net-devel \
SDL2_ttf-devel
+Installing the dependencies on Windows (using MSYS2 UCRT64):
+
+ pacman -S mingw-w64-ucrt-x86_64-gcc \
+ mingw-w64-ucrt-x86_64-cmake \
+ mingw-w64-ucrt-x86_64-physfs \
+ mingw-w64-ucrt-x86_64-curl \
+ mingw-w64-ucrt-x86_64-SDL2_image \
+ mingw-w64-ucrt-x86_64-SDL2_mixer \
+ mingw-w64-ucrt-x86_64-SDL2_net \
+ mingw-w64-ucrt-x86_64-SDL2_ttf \
+ mingw-w64-ucrt-x86_64-libxml2
+
Once the dependencies are installed, use CMake:
cmake -B build .
diff --git a/src/client.cpp b/src/client.cpp
index 2a854bc0..63452112 100644
--- a/src/client.cpp
+++ b/src/client.cpp
@@ -80,8 +80,9 @@
#include <SDL_image.h>
#ifdef _WIN32
-#include <SDL_syswm.h>
#include "utils/specialfolder.h"
+#include <SDL_syswm.h>
+#include <winuser.h>
#endif
#include <sys/stat.h>
@@ -332,7 +333,7 @@ Client::Client(const Options &options):
logger->log("Loading icon from file: %s", iconFile.c_str());
#ifdef _WIN32
static SDL_SysWMinfo pInfo;
- SDL_GetWMInfo(&pInfo);
+ SDL_GetWindowWMInfo(mVideo.window(), &pInfo);
// Attempt to load icon from .ico file
HICON icon = (HICON) LoadImage(NULL,
iconFile.c_str(),
@@ -342,7 +343,7 @@ Client::Client(const Options &options):
icon = LoadIcon(GetModuleHandle(NULL), "A");
if (icon)
- SetClassLong(pInfo.window, GCL_HICON, (LONG) icon);
+ SetClassLongPtr(pInfo.info.win.window, GCLP_HICON, (LONG_PTR) icon);
#else
mIcon = IMG_Load(iconFile.c_str());
if (mIcon)
diff --git a/src/gui/npcdialog.cpp b/src/gui/npcdialog.cpp
index 8150a01a..90d3e37e 100644
--- a/src/gui/npcdialog.cpp
+++ b/src/gui/npcdialog.cpp
@@ -407,7 +407,7 @@ void NpcDialog::mouseClicked(gcn::MouseEvent &mouseEvent)
{
action(gcn::ActionEvent(mNextButton, mNextButton->getActionEventId()));
}
- if (mouseEvent.getSource() == mTextBox && isDoubleClick((int)(long)mTextBox))
+ if (mouseEvent.getSource() == mTextBox && isDoubleClick((int)(intptr_t)mTextBox))
{
if (mActionState == NPC_ACTION_NEXT || mActionState == NPC_ACTION_CLOSE)
action(gcn::ActionEvent(mNextButton,
diff --git a/src/gui/truetypefont.h b/src/gui/truetypefont.h
index b3ebcc73..9aa308b1 100644
--- a/src/gui/truetypefont.h
+++ b/src/gui/truetypefont.h
@@ -25,11 +25,7 @@
#include <guichan/font.hpp>
-#ifdef __WIN32__
-#include <SDL/SDL_ttf.h>
-#else
#include <SDL_ttf.h>
-#endif
#include <list>
#include <string>
diff --git a/src/main.cpp b/src/main.cpp
index b44f4d3a..9b29eba4 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -179,14 +179,14 @@ static void parseOptions(int argc, char *argv[], Client::Options &options)
}
#ifdef _WIN32
-extern "C" char const *_nl_locale_name_default(void);
+//extern "C" char const *_nl_locale_name_default(void);
#endif
static void initInternationalization()
{
#if ENABLE_NLS
#ifdef _WIN32
- SetEnvironmentVariable("LANG", _nl_locale_name_default());
+// SetEnvironmentVariable("LANG", _nl_locale_name_default());
// mingw doesn't like LOCALEDIR to be defined for some reason
bindtextdomain("mana", "translations/");
#else