mirror of https://github.com/axmolengine/axmol.git
Merge pull request #4434 from martell/msys2
Msys2 and Mingw added fixed x64 cocos/audio on Windows for MSVC and MinGW
This commit is contained in:
commit
19c86c0e4f
|
@ -1,3 +1,28 @@
|
||||||
|
#/****************************************************************************
|
||||||
|
# Copyright (c) 2013 cocos2d-x.org
|
||||||
|
# Copyright (c) 2012-2013 martell malone
|
||||||
|
#
|
||||||
|
# http://www.cocos2d-x.org
|
||||||
|
#
|
||||||
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
# of this software and associated documentation files (the "Software"), to deal
|
||||||
|
# in the Software without restriction, including without limitation the rights
|
||||||
|
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
# copies of the Software, and to permit persons to whom the Software is
|
||||||
|
# furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
# The above copyright notice and this permission notice shall be included in
|
||||||
|
# all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
# THE SOFTWARE.
|
||||||
|
# ****************************************************************************/
|
||||||
|
|
||||||
cmake_minimum_required(VERSION 2.8)
|
cmake_minimum_required(VERSION 2.8)
|
||||||
project (Cocos2dx)
|
project (Cocos2dx)
|
||||||
|
|
||||||
|
@ -170,12 +195,6 @@ if(WIN32)
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
link_directories(
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/external/webp/prebuilt/${PLATFORM_FOLDER}
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/external/glfw3/prebuilt/${PLATFORM_FOLDER}
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/external/${PLATFORM_FOLDER}-specific/gles/prebuilt
|
|
||||||
)
|
|
||||||
|
|
||||||
elseif(APPLE)
|
elseif(APPLE)
|
||||||
|
|
||||||
else()
|
else()
|
||||||
|
|
|
@ -0,0 +1,62 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# msys2 Pacman Manager for cocos2d-x
|
||||||
|
|
||||||
|
#/****************************************************************************
|
||||||
|
# Copyright (c) 2012-2013 Martell Malone
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
# of this software and associated documentation files (the "Software"), to deal
|
||||||
|
# in the Software without restriction, including without limitation the rights
|
||||||
|
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
# copies of the Software, and to permit persons to whom the Software is
|
||||||
|
# furnished to do so, subject to the following conditions:
|
||||||
|
#
|
||||||
|
# The above copyright notice and this permission notice shall be included in
|
||||||
|
# all copies or substantial portions of the Software.
|
||||||
|
#
|
||||||
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
# THE SOFTWARE.
|
||||||
|
# ****************************************************************************/
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
THISDIR="$(dirname $0)"
|
||||||
|
test "$THISDIR" = "." && THISDIR=${PWD}
|
||||||
|
OSTYPE=${OSTYPE//[0-9.]/}
|
||||||
|
HOST_ARCH=$(uname -m)
|
||||||
|
|
||||||
|
if [ "${HOST_ARCH}" = "i686" ]; then
|
||||||
|
BITS=32
|
||||||
|
elif [ "${HOST_ARCH}" = "x86_64" ]; then
|
||||||
|
BITS=64
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "${OSTYPE}" = "msys" ]; then
|
||||||
|
|
||||||
|
CC=${HOST_ARCH}-w64-mingw32-gcc
|
||||||
|
CXX=${HOST_ARCH}-w64-mingw32-g++
|
||||||
|
PP=mingw-w64-${HOST_ARCH}
|
||||||
|
|
||||||
|
MINGW_PACKAGES=(glfw glew libwebp libjpeg-turbo libpng freetype libiconv zlib curl
|
||||||
|
make gcc binutils headers cmake libxml2)
|
||||||
|
|
||||||
|
MINGW_PACKAGES=(${MINGW_PACKAGES[@]/#/${PP}-})
|
||||||
|
|
||||||
|
pacman -S --force --noconfirm --needed ${MINGW_PACKAGES[@]}
|
||||||
|
|
||||||
|
mkdir -p mingw${BITS} && cd mingw${BITS}
|
||||||
|
|
||||||
|
export PATH=/mingw${BITS}/bin:${PATH}
|
||||||
|
|
||||||
|
cmake -G"MinGW Makefiles" -DCMAKE_MAKE_PROGRAM="mingw32-make" \
|
||||||
|
-DCMAKE_C_COMPILER="${CC}" -DCMAKE_CXX_COMPILER="${CXX}" ../..
|
||||||
|
|
||||||
|
mingw32-make
|
||||||
|
fi
|
|
@ -613,7 +613,7 @@ void Sprite::draw(void)
|
||||||
long offset = 0;
|
long offset = 0;
|
||||||
setGLBufferData(&_quad, 4 * kQuadSize, 0);
|
setGLBufferData(&_quad, 4 * kQuadSize, 0);
|
||||||
#else
|
#else
|
||||||
long offset = (long)&_quad;
|
size_t offset = (size_t)&_quad;
|
||||||
#endif // EMSCRIPTEN
|
#endif // EMSCRIPTEN
|
||||||
|
|
||||||
// vertex
|
// vertex
|
||||||
|
|
|
@ -439,7 +439,7 @@ int ZipUtils::inflateCCZBuffer(const unsigned char *buffer, long bufferLen, unsi
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned long destlen = len;
|
unsigned long destlen = len;
|
||||||
unsigned long source = (unsigned long) buffer + sizeof(*header);
|
size_t source = (size_t) buffer + sizeof(*header);
|
||||||
int ret = uncompress(*out, &destlen, (Bytef*)source, bufferLen - sizeof(*header) );
|
int ret = uncompress(*out, &destlen, (Bytef*)source, bufferLen - sizeof(*header) );
|
||||||
|
|
||||||
if( ret != Z_OK )
|
if( ret != Z_OK )
|
||||||
|
|
|
@ -22,6 +22,9 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
THE SOFTWARE.
|
THE SOFTWARE.
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#define __CC_PLATFORM_IMAGE_CPP__
|
#define __CC_PLATFORM_IMAGE_CPP__
|
||||||
|
#if _MSC_VER
|
||||||
|
#include <cctype>
|
||||||
|
#endif
|
||||||
#include "platform/CCImageCommon_cpp.h"
|
#include "platform/CCImageCommon_cpp.h"
|
||||||
|
|
||||||
NS_CC_BEGIN
|
NS_CC_BEGIN
|
||||||
|
|
|
@ -52,6 +52,12 @@ THE SOFTWARE.
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
|
#ifndef M_PI
|
||||||
|
#define M_PI 3.14159265358
|
||||||
|
#endif
|
||||||
|
#ifndef M_PI_2
|
||||||
|
#define M_PI_2 1.57079632679
|
||||||
|
#endif
|
||||||
// for MIN MAX and sys/time.h on win32 platform
|
// for MIN MAX and sys/time.h on win32 platform
|
||||||
#ifdef __MINGW32__
|
#ifdef __MINGW32__
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
|
@ -73,7 +79,9 @@ THE SOFTWARE.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define _WINSOCKAPI_
|
#define _WINSOCKAPI_
|
||||||
#define NOMINMAX
|
#ifndef NOMINMAX
|
||||||
|
#define NOMINMAX
|
||||||
|
#endif
|
||||||
// Structure timeval has define in winsock.h, include windows.h for it.
|
// Structure timeval has define in winsock.h, include windows.h for it.
|
||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
|
|
||||||
|
|
|
@ -8,11 +8,11 @@ namespace CocosDenshion {
|
||||||
static HINSTANCE s_hInstance;
|
static HINSTANCE s_hInstance;
|
||||||
static MCIERROR s_mciError;
|
static MCIERROR s_mciError;
|
||||||
|
|
||||||
static LRESULT WINAPI _SoundPlayProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
|
LRESULT WINAPI _SoundPlayProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
|
||||||
|
|
||||||
MciPlayer::MciPlayer()
|
MciPlayer::MciPlayer()
|
||||||
: _wnd(NULL)
|
: _wnd(NULL)
|
||||||
, _dev(NULL)
|
, _dev(0L)
|
||||||
, _soundID(0)
|
, _soundID(0)
|
||||||
, _times(0)
|
, _times(0)
|
||||||
, _playing(false)
|
, _playing(false)
|
||||||
|
@ -56,7 +56,7 @@ MciPlayer::MciPlayer()
|
||||||
NULL );
|
NULL );
|
||||||
if (_wnd)
|
if (_wnd)
|
||||||
{
|
{
|
||||||
SetWindowLong(_wnd, GWL_USERDATA, (LONG)this);
|
SetWindowLongPtr(_wnd, GWLP_USERDATA, (LONG_PTR)this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ void MciPlayer::Open(const char* pFileName, UINT uId)
|
||||||
mciOpen.lpstrDeviceType = (LPCTSTR)MCI_ALL_DEVICE_ID;
|
mciOpen.lpstrDeviceType = (LPCTSTR)MCI_ALL_DEVICE_ID;
|
||||||
mciOpen.lpstrElementName = pFileName;
|
mciOpen.lpstrElementName = pFileName;
|
||||||
|
|
||||||
mciError = mciSendCommand(0,MCI_OPEN, MCI_OPEN_ELEMENT, (DWORD)&mciOpen);
|
mciError = mciSendCommand(0,MCI_OPEN, MCI_OPEN_ELEMENT, reinterpret_cast<DWORD_PTR>(&mciOpen));
|
||||||
BREAK_IF(mciError);
|
BREAK_IF(mciError);
|
||||||
|
|
||||||
_dev = mciOpen.wDeviceID;
|
_dev = mciOpen.wDeviceID;
|
||||||
|
@ -101,8 +101,8 @@ void MciPlayer::Play(UINT uTimes /* = 1 */)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
MCI_PLAY_PARMS mciPlay = {0};
|
MCI_PLAY_PARMS mciPlay = {0};
|
||||||
mciPlay.dwCallback = (DWORD_PTR)_wnd;
|
mciPlay.dwCallback = reinterpret_cast<DWORD_PTR>(_wnd);
|
||||||
s_mciError = mciSendCommand(_dev,MCI_PLAY, MCI_FROM|MCI_NOTIFY,(DWORD)&mciPlay);
|
s_mciError = mciSendCommand(_dev,MCI_PLAY, MCI_FROM|MCI_NOTIFY,reinterpret_cast<DWORD_PTR>(&mciPlay));
|
||||||
if (! s_mciError)
|
if (! s_mciError)
|
||||||
{
|
{
|
||||||
_playing = true;
|
_playing = true;
|
||||||
|
@ -149,8 +149,8 @@ void MciPlayer::Rewind()
|
||||||
mciSendCommand(_dev, MCI_SEEK, MCI_SEEK_TO_START, 0);
|
mciSendCommand(_dev, MCI_SEEK, MCI_SEEK_TO_START, 0);
|
||||||
|
|
||||||
MCI_PLAY_PARMS mciPlay = {0};
|
MCI_PLAY_PARMS mciPlay = {0};
|
||||||
mciPlay.dwCallback = (DWORD)_wnd;
|
mciPlay.dwCallback = reinterpret_cast<DWORD_PTR>(_wnd);
|
||||||
_playing = mciSendCommand(_dev, MCI_PLAY, MCI_NOTIFY,(DWORD)&mciPlay) ? false : true;
|
_playing = mciSendCommand(_dev, MCI_PLAY, MCI_NOTIFY,reinterpret_cast<DWORD_PTR>(&mciPlay)) ? false : true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MciPlayer::IsPlaying()
|
bool MciPlayer::IsPlaying()
|
||||||
|
@ -185,7 +185,7 @@ LRESULT WINAPI _SoundPlayProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
|
||||||
MciPlayer * pPlayer = NULL;
|
MciPlayer * pPlayer = NULL;
|
||||||
if (MM_MCINOTIFY == Msg
|
if (MM_MCINOTIFY == Msg
|
||||||
&& MCI_NOTIFY_SUCCESSFUL == wParam
|
&& MCI_NOTIFY_SUCCESSFUL == wParam
|
||||||
&&(pPlayer = (MciPlayer *)GetWindowLong(hWnd, GWL_USERDATA)))
|
&&(pPlayer = (MciPlayer *)GetWindowLongPtr(hWnd, GWLP_USERDATA)))
|
||||||
{
|
{
|
||||||
if (pPlayer->_times)
|
if (pPlayer->_times)
|
||||||
{
|
{
|
||||||
|
@ -197,8 +197,8 @@ LRESULT WINAPI _SoundPlayProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
|
||||||
mciSendCommand(lParam, MCI_SEEK, MCI_SEEK_TO_START, 0);
|
mciSendCommand(lParam, MCI_SEEK, MCI_SEEK_TO_START, 0);
|
||||||
|
|
||||||
MCI_PLAY_PARMS mciPlay = {0};
|
MCI_PLAY_PARMS mciPlay = {0};
|
||||||
mciPlay.dwCallback = (DWORD)hWnd;
|
mciPlay.dwCallback = reinterpret_cast<DWORD_PTR>(hWnd);
|
||||||
mciSendCommand(lParam, MCI_PLAY, MCI_NOTIFY,(DWORD)&mciPlay);
|
mciSendCommand(lParam, MCI_PLAY, MCI_NOTIFY,reinterpret_cast<DWORD_PTR>(&mciPlay));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -133,7 +133,9 @@ Config of cocos2d-x project, per target platform.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32)
|
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32)
|
||||||
|
#ifndef __MINGW32__
|
||||||
#pragma warning (disable:4127)
|
#pragma warning (disable:4127)
|
||||||
|
#endif
|
||||||
#endif // CC_PLATFORM_WIN32
|
#endif // CC_PLATFORM_WIN32
|
||||||
|
|
||||||
#endif // __CC_PLATFORM_CONFIG_H__
|
#endif // __CC_PLATFORM_CONFIG_H__
|
||||||
|
|
Loading…
Reference in New Issue