1
0
Fork 0

Apple: move project files from `build` folder (#111)

merge-requests/1/head
Maksym H 2022-12-02 11:40:55 +01:00 committed by GitHub
parent c7bb8e5baf
commit 6c5022f692
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
71 changed files with 661 additions and 937 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 817 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 183 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 183 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 399 KiB

View File

@ -1,61 +1,61 @@
{
"images" : [
{
"filename" : "AppIcon-16.png",
"filename" : "16x16@1x.png",
"idiom" : "mac",
"scale" : "1x",
"size" : "16x16"
},
{
"filename" : "AppIcon-32.png",
"filename" : "16x16@2x.png",
"idiom" : "mac",
"scale" : "2x",
"size" : "16x16"
},
{
"filename" : "AppIcon-32.png",
"filename" : "32x32@1x.png",
"idiom" : "mac",
"scale" : "1x",
"size" : "32x32"
},
{
"filename" : "AppIcon-64.png",
"filename" : "32x32@2x.png",
"idiom" : "mac",
"scale" : "2x",
"size" : "32x32"
},
{
"filename" : "AppIcon-128.png",
"filename" : "128x128@1x.png",
"idiom" : "mac",
"scale" : "1x",
"size" : "128x128"
},
{
"filename" : "AppIcon-256.png",
"filename" : "128x128@2x.png",
"idiom" : "mac",
"scale" : "2x",
"size" : "128x128"
},
{
"filename" : "AppIcon-256.png",
"filename" : "256х256@1x.png",
"idiom" : "mac",
"scale" : "1x",
"size" : "256x256"
},
{
"filename" : "AppIcon-512.png",
"filename" : "256х256@2x.png",
"idiom" : "mac",
"scale" : "2x",
"size" : "256x256"
},
{
"filename" : "AppIcon-512.png",
"filename" : "512х512@1x.png",
"idiom" : "mac",
"scale" : "1x",
"size" : "512x512"
},
{
"filename" : "AppIcon-1024.png",
"filename" : "512х512@2x.png",
"idiom" : "mac",
"scale" : "2x",
"size" : "512x512"

View File

@ -0,0 +1 @@

36
Apple/Start.sh Executable file
View File

@ -0,0 +1,36 @@
#!/bin/bash -e
echo
echo "Starting build MultiCraft for macOS..."
echo
echo "Build libraries:"
sh scripts/SDL2.sh
sh scripts/libjpeg.sh
sh scripts/libpng.sh
sh scripts/irrlicht.sh
sh scripts/gettext.sh
sh scripts/freetype.sh
sh scripts/leveldb.sh
sh scripts/libogg.sh
sh scripts/libvorbis.sh
sh scripts/luajit.sh
sh scripts/openal.sh
echo
echo "All libraries were built!"
echo
echo "Preparing assets:"
sh scripts/assets.sh
echo
echo "Preparing locales:"
sh scripts/locale.sh
echo
echo "All done! You can continue in Xcode!"
open MultiCraft/MultiCraft.xcodeproj

View File

@ -1,16 +1,15 @@
#!/bin/bash -e
. sdk.sh
SDL2_VERSION=2.24.2
SDL2_VERSION=2.26.1
. scripts/sdk.sh
mkdir -p deps; cd deps
if [ ! -d SDL2-src ]; then
wget https://github.com/libsdl-org/SDL/archive/release-$SDL2_VERSION.tar.gz
tar -xzvf release-$SDL2_VERSION.tar.gz
mv SDL-release-$SDL2_VERSION SDL2-src
rm release-$SDL2_VERSION.tar.gz
# patch SDL2
patch -p1 < SDL2.diff
patch -p1 < SDL2-command-modifier.diff
# Disable some features that are not needed
sed -i '' 's/#define SDL_AUDIO_DRIVER_COREAUDIO 1/#define SDL_AUDIO_DRIVER_COREAUDIO 0/g' SDL2-src/include/SDL_config_macosx.h
sed -i '' 's/#define SDL_AUDIO_DRIVER_DISK 1/#define SDL_AUDIO_DRIVER_DISK 0/g' SDL2-src/include/SDL_config_macosx.h

19
Apple/scripts/assets.sh Executable file
View File

@ -0,0 +1,19 @@
#!/bin/bash -e
ALL_FONTS=true
if [ ! -d MultiCraft/MultiCraft.xcodeproj ]; then
echo "Run this from Apple folder"
exit 1
fi
DEST=$(pwd)/assets
mkdir -p $DEST/fonts
if $ALL_FONTS
then
cp ../fonts/*.ttf $DEST/fonts/
else
cp ../fonts/MultiCraftFont.ttf $DEST/fonts/
fi

View File

@ -1,8 +1,10 @@
#!/bin/bash -e
. sdk.sh
FREETYPE_VERSION=2.12.1
. scripts/sdk.sh
mkdir -p deps; cd deps
if [ ! -d freetype-src ]; then
wget http://download.savannah.gnu.org/releases/freetype/freetype-$FREETYPE_VERSION.tar.gz
tar -xzvf freetype-$FREETYPE_VERSION.tar.gz

View File

@ -1,8 +1,10 @@
#!/bin/bash -e
. sdk.sh
GETTEXT_VERSION=0.21.1
. scripts/sdk.sh
mkdir -p deps; cd deps
if [ ! -d gettext-src ]; then
wget https://ftp.gnu.org/pub/gnu/gettext/gettext-$GETTEXT_VERSION.tar.gz
tar -xzvf gettext-$GETTEXT_VERSION.tar.gz

View File

@ -1,6 +1,7 @@
#!/bin/bash -e
. sdk.sh
. scripts/sdk.sh
mkdir -p deps; cd deps
[ ! -d irrlicht-src ] && \
git clone --depth 1 -b SDL2 https://github.com/MoNTE48/Irrlicht irrlicht-src

View File

@ -1,8 +1,10 @@
#!/bin/bash -e
. sdk.sh
LEVELDB_VERSION=1.23
. scripts/sdk.sh
mkdir -p deps; cd deps
if [ ! -d leveldb-src ]; then
git clone -b $LEVELDB_VERSION --depth 1 https://github.com/google/leveldb leveldb-src
mkdir leveldb-src/build

View File

@ -1,8 +1,10 @@
#!/bin/bash -e
. sdk.sh
JPEG_VERSION=2.1.4
. scripts/sdk.sh
mkdir -p deps; cd deps
if [ ! -d libjpeg-src ]; then
wget https://download.sourceforge.net/libjpeg-turbo/libjpeg-turbo-$JPEG_VERSION.tar.gz
tar -xzvf libjpeg-turbo-$JPEG_VERSION.tar.gz

View File

@ -1,8 +1,10 @@
#!/bin/bash -e
. sdk.sh
OGG_VERSION=1.3.5
. scripts/sdk.sh
mkdir -p deps; cd deps
if [ ! -d libogg-src ]; then
git clone -b v$OGG_VERSION --depth 1 https://github.com/xiph/ogg libogg-src
mkdir libogg-src/build

View File

@ -1,7 +1,9 @@
#!/bin/bash -e
. sdk.sh
PNG_VERSION=1.6.38
PNG_VERSION=1.6.39
. scripts/sdk.sh
mkdir -p deps; cd deps
if [ ! -d libpng-src ]; then
wget https://download.sourceforge.net/libpng/libpng-$PNG_VERSION.tar.gz

View File

@ -1,8 +1,10 @@
#!/bin/bash -e
. sdk.sh
VORBIS_VERSION=1.3.7
. scripts/sdk.sh
mkdir -p deps; cd deps
if [ ! -d libvorbis-src ]; then
git clone -b v$VORBIS_VERSION --depth 1 https://github.com/xiph/vorbis libvorbis-src
mkdir libvorbis-src/build

View File

@ -1,13 +1,13 @@
#!/bin/bash -e
if [ ! -d MultiCraft/MultiCraft.xcodeproj ]; then
echo "Run this in build/macOS"
echo "Run this from Apple folder"
exit 1
fi
DEST=$(pwd)/assets/locale
pushd ../../po
pushd ../po
for lang in *; do
[ ${#lang} -ne 2 ] && continue
mopath=$DEST/$lang/LC_MESSAGES

View File

@ -1,10 +1,11 @@
#!/bin/bash -e
. sdk.sh
export MACOSX_DEPLOYMENT_TARGET=10.15
LUAJIT_VERSION="v2.1"
. scripts/sdk.sh
export MACOSX_DEPLOYMENT_TARGET=10.15
mkdir -p deps; cd deps
if [ ! -d luajit-src ]; then
git clone -b $LUAJIT_VERSION --depth 1 -c core.autocrlf=false https://github.com/LuaJIT/LuaJIT luajit-src
fi

View File

@ -1,8 +1,10 @@
#!/bin/bash -e
. sdk.sh
OPENAL_VERSION=1.22.2
. scripts/sdk.sh
mkdir -p deps; cd deps
if [ ! -d openal-src ]; then
git clone -b $OPENAL_VERSION --depth 1 https://github.com/kcat/openal-soft openal-src
fi

View File

@ -1,6 +1,6 @@
#!/bin/bash -e
# This file sets the appropriate compiler and flags for compiling for macOS without Xcode
# This file sets the appropriate compiler and flags for compiling for macOS
sdk=macosx
export OSX_OSVER=10.11

Binary file not shown.

Before

Width:  |  Height:  |  Size: 588 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 832 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 76 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 217 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.3 KiB

View File

@ -1,31 +0,0 @@
#!/bin/bash -e
echo
echo "Starting build MultiCraft for macOS..."
echo
echo "Build Libraries:"
cd deps
sh libraries.sh
cd ..
echo
echo "Preparing Assets:"
sh assets.sh
echo
echo "Preparing Locales:"
sh locale.sh
echo
echo "Creating App Icon:"
echo "Skipping..."
#sh appicon.sh
echo
echo "All done! You can continue in Xcode!"
open MultiCraft/MultiCraft.xcodeproj

View File

@ -1,15 +0,0 @@
#!/bin/bash -e
# Generates different AppIcon images with correct dimensions
# (brew package: imagemagick)
# (install: brew install imagemagick)
SIZES="16 32 64 128 256 512 1024"
SRCFILE=icon.png
DSTDIR=MultiCraft/MultiCraft/Assets.xcassets/AppIcon.appiconset
for sz in $SIZES; do
echo "Creating ${sz}x${sz} icon"
convert -resize ${sz}x${sz} $SRCFILE $DSTDIR/AppIcon-${sz}.png
done
echo "App Icon create successful"

View File

@ -1,11 +0,0 @@
#!/bin/bash -e
if [ ! -d MultiCraft/MultiCraft.xcodeproj ]; then
echo "Run this in build/macOS"
exit 1
fi
DEST=$(pwd)/assets
mkdir -p $DEST/fonts
cp ../../fonts/*.ttf $DEST/fonts/

View File

@ -1,263 +0,0 @@
diff --git a/src/video/cocoa/SDL_cocoakeyboard.m b/src/video/cocoa/SDL_cocoakeyboard.m
index 02c99e8e72a5..6b68a2b807b3 100644
--- a/SDL2-src/src/video/cocoa/SDL_cocoakeyboard.m
+++ b/SDL2-src/src/video/cocoa/SDL_cocoakeyboard.m
@@ -177,209 +177,49 @@ - (NSArray *)validAttributesForMarkedText
@end
-
-/* This is a helper function for HandleModifierSide. This
- * function reverts back to behavior before the distinction between
- * sides was made.
- */
-static void
-HandleNonDeviceModifier(unsigned int device_independent_mask,
- unsigned int oldMods,
- unsigned int newMods,
- SDL_Scancode scancode)
-{
- unsigned int oldMask, newMask;
-
- /* Isolate just the bits we care about in the depedent bits so we can
- * figure out what changed
- */
- oldMask = oldMods & device_independent_mask;
- newMask = newMods & device_independent_mask;
-
- if (oldMask && oldMask != newMask) {
- SDL_SendKeyboardKey(SDL_RELEASED, scancode);
- } else if (newMask && oldMask != newMask) {
- SDL_SendKeyboardKey(SDL_PRESSED, scancode);
- }
-}
-
-/* This is a helper function for HandleModifierSide.
- * This function sets the actual SDL_PrivateKeyboard event.
- */
-static void
-HandleModifierOneSide(unsigned int oldMods, unsigned int newMods,
- SDL_Scancode scancode,
- unsigned int sided_device_dependent_mask)
-{
- unsigned int old_dep_mask, new_dep_mask;
-
- /* Isolate just the bits we care about in the depedent bits so we can
- * figure out what changed
- */
- old_dep_mask = oldMods & sided_device_dependent_mask;
- new_dep_mask = newMods & sided_device_dependent_mask;
-
- /* We now know that this side bit flipped. But we don't know if
- * it went pressed to released or released to pressed, so we must
- * find out which it is.
- */
- if (new_dep_mask && old_dep_mask != new_dep_mask) {
- SDL_SendKeyboardKey(SDL_PRESSED, scancode);
- } else {
- SDL_SendKeyboardKey(SDL_RELEASED, scancode);
- }
-}
-
-/* This is a helper function for DoSidedModifiers.
- * This function will figure out if the modifier key is the left or right side,
- * e.g. left-shift vs right-shift.
- */
-static void
-HandleModifierSide(int device_independent_mask,
- unsigned int oldMods, unsigned int newMods,
- SDL_Scancode left_scancode,
- SDL_Scancode right_scancode,
- unsigned int left_device_dependent_mask,
- unsigned int right_device_dependent_mask)
-{
- unsigned int device_dependent_mask = (left_device_dependent_mask |
- right_device_dependent_mask);
- unsigned int diff_mod;
-
- /* On the basis that the device independent mask is set, but there are
- * no device dependent flags set, we'll assume that we can't detect this
- * keyboard and revert to the unsided behavior.
- */
- if ((device_dependent_mask & newMods) == 0) {
- /* Revert to the old behavior */
- HandleNonDeviceModifier(device_independent_mask, oldMods, newMods, left_scancode);
- return;
- }
-
- /* XOR the previous state against the new state to see if there's a change */
- diff_mod = (device_dependent_mask & oldMods) ^
- (device_dependent_mask & newMods);
- if (diff_mod) {
- /* A change in state was found. Isolate the left and right bits
- * to handle them separately just in case the values can simulataneously
- * change or if the bits don't both exist.
- */
- if (left_device_dependent_mask & diff_mod) {
- HandleModifierOneSide(oldMods, newMods, left_scancode, left_device_dependent_mask);
- }
- if (right_device_dependent_mask & diff_mod) {
- HandleModifierOneSide(oldMods, newMods, right_scancode, right_device_dependent_mask);
- }
- }
-}
-
-/* This is a helper function for DoSidedModifiers.
- * This function will release a key press in the case that
- * it is clear that the modifier has been released (i.e. one side
- * can't still be down).
- */
-static void
-ReleaseModifierSide(unsigned int device_independent_mask,
- unsigned int oldMods, unsigned int newMods,
- SDL_Scancode left_scancode,
- SDL_Scancode right_scancode,
- unsigned int left_device_dependent_mask,
- unsigned int right_device_dependent_mask)
-{
- unsigned int device_dependent_mask = (left_device_dependent_mask |
- right_device_dependent_mask);
-
- /* On the basis that the device independent mask is set, but there are
- * no device dependent flags set, we'll assume that we can't detect this
- * keyboard and revert to the unsided behavior.
- */
- if ((device_dependent_mask & oldMods) == 0) {
- /* In this case, we can't detect the keyboard, so use the left side
- * to represent both, and release it.
- */
- SDL_SendKeyboardKey(SDL_RELEASED, left_scancode);
- return;
- }
-
- /*
- * This could have been done in an if-else case because at this point,
- * we know that all keys have been released when calling this function.
- * But I'm being paranoid so I want to handle each separately,
- * so I hope this doesn't cause other problems.
- */
- if ( left_device_dependent_mask & oldMods ) {
- SDL_SendKeyboardKey(SDL_RELEASED, left_scancode);
- }
- if ( right_device_dependent_mask & oldMods ) {
- SDL_SendKeyboardKey(SDL_RELEASED, right_scancode);
- }
-}
-
-/* This function will handle the modifier keys and also determine the
- * correct side of the key.
- */
-static void
-DoSidedModifiers(unsigned short scancode,
- unsigned int oldMods, unsigned int newMods)
-{
- /* Set up arrays for the key syms for the left and right side. */
- const SDL_Scancode left_mapping[] = {
- SDL_SCANCODE_LSHIFT,
- SDL_SCANCODE_LCTRL,
- SDL_SCANCODE_LALT,
- SDL_SCANCODE_LGUI
- };
- const SDL_Scancode right_mapping[] = {
- SDL_SCANCODE_RSHIFT,
- SDL_SCANCODE_RCTRL,
- SDL_SCANCODE_RALT,
- SDL_SCANCODE_RGUI
- };
- /* Set up arrays for the device dependent masks with indices that
- * correspond to the _mapping arrays
- */
- const unsigned int left_device_mapping[] = { NX_DEVICELSHIFTKEYMASK, NX_DEVICELCTLKEYMASK, NX_DEVICELALTKEYMASK, NX_DEVICELCMDKEYMASK };
- const unsigned int right_device_mapping[] = { NX_DEVICERSHIFTKEYMASK, NX_DEVICERCTLKEYMASK, NX_DEVICERALTKEYMASK, NX_DEVICERCMDKEYMASK };
-
- unsigned int i, bit;
-
- /* Iterate through the bits, testing each against the old modifiers */
- for (i = 0, bit = NSEventModifierFlagShift; bit <= NSEventModifierFlagCommand; bit <<= 1, ++i) {
- unsigned int oldMask, newMask;
-
- oldMask = oldMods & bit;
- newMask = newMods & bit;
-
- /* If the bit is set, we must always examine it because the left
- * and right side keys may alternate or both may be pressed.
- */
- if (newMask) {
- HandleModifierSide(bit, oldMods, newMods,
- left_mapping[i], right_mapping[i],
- left_device_mapping[i], right_device_mapping[i]);
- }
- /* If the state changed from pressed to unpressed, we must examine
- * the device dependent bits to release the correct keys.
- */
- else if (oldMask && oldMask != newMask) {
- ReleaseModifierSide(bit, oldMods, newMods,
- left_mapping[i], right_mapping[i],
- left_device_mapping[i], right_device_mapping[i]);
- }
- }
-}
-
static void
HandleModifiers(_THIS, unsigned short scancode, unsigned int modifierFlags)
{
- SDL_VideoData *data = (__bridge SDL_VideoData *) _this->driverdata;
-
- if (modifierFlags == data.modifierFlags) {
- return;
+ SDL_Scancode code = darwin_scancode_table[scancode];
+
+ const SDL_Scancode codes[] = {
+ SDL_SCANCODE_LSHIFT,
+ SDL_SCANCODE_LCTRL,
+ SDL_SCANCODE_LALT,
+ SDL_SCANCODE_LGUI,
+ SDL_SCANCODE_RSHIFT,
+ SDL_SCANCODE_RCTRL,
+ SDL_SCANCODE_RALT,
+ SDL_SCANCODE_RGUI,
+ SDL_SCANCODE_LSHIFT,
+ SDL_SCANCODE_LCTRL,
+ SDL_SCANCODE_LALT,
+ SDL_SCANCODE_LGUI, };
+
+ const unsigned int modifiers[] = {
+ NX_DEVICELSHIFTKEYMASK,
+ NX_DEVICELCTLKEYMASK,
+ NX_DEVICELALTKEYMASK,
+ NX_DEVICELCMDKEYMASK,
+ NX_DEVICERSHIFTKEYMASK,
+ NX_DEVICERCTLKEYMASK,
+ NX_DEVICERALTKEYMASK,
+ NX_DEVICERCMDKEYMASK,
+ NX_SHIFTMASK,
+ NX_CONTROLMASK,
+ NX_ALTERNATEMASK,
+ NX_COMMANDMASK };
+
+ for (int i = 0; i < 12; i++)
+ {
+ if (code == codes[i])
+ {
+ if (modifierFlags & modifiers[i])
+ SDL_SendKeyboardKey(SDL_PRESSED, code);
+ else
+ SDL_SendKeyboardKey(SDL_RELEASED, code);
+ }
}
-
- DoSidedModifiers(scancode, data.modifierFlags, modifierFlags);
- data.modifierFlags = modifierFlags;
}
static void
@@ -579,8 +419,7 @@ - (NSArray *)validAttributesForMarkedText
SDL_SendKeyboardKey(SDL_RELEASED, code);
break;
case NSEventTypeFlagsChanged:
- /* FIXME CW 2007-08-14: check if this whole mess that takes up half of this file is really necessary */
- HandleModifiers(_this, scancode, (unsigned int)[event modifierFlags]);
+ HandleModifiers(_this, scancode, (unsigned int)[event modifierFlags]);
break;
default: /* just to avoid compiler warnings */
break;

View File

@ -1,16 +0,0 @@
diff --git a/src/video/cocoa/SDL_cocoawindow.m b/src/video/cocoa/SDL_cocoawindow.m
index ad7d9e2af..f8666352a 100644
--- a/SDL2-src/src/video/cocoa/SDL_cocoawindow.m
+++ b/SDL2-src/src/video/cocoa/SDL_cocoawindow.m
@@ -783,6 +783,11 @@ - (void)windowDidResize:(NSNotification *)aNotification
return;
}
+ if (focusClickPending) {
+ focusClickPending = 0;
+ [self onMovingOrFocusClickPendingStateCleared];
+ }
+
window = _data.window;
nswindow = _data.nswindow;
rect = [nswindow contentRectForFrameRect:[nswindow frame]];

View File

@ -1,16 +0,0 @@
#!/bin/bash -e
sh SDL2.sh
sh libjpeg.sh
sh libpng.sh
sh irrlicht.sh
sh gettext.sh
sh freetype.sh
sh leveldb.sh
sh libogg.sh
sh libvorbis.sh
sh luajit.sh
sh openal.sh
echo
echo "All libraries were built!"