mirror of https://github.com/axmolengine/axmol.git
Merge branch 'v3' of https://github.com/cocos2d/cocos2d-x into v3_hot_fix
This commit is contained in:
commit
d7d1bf037b
|
@ -1,10 +1,11 @@
|
|||
cocos2d-x-3.2 ??
|
||||
cocos2d-x-3.2 Jul.17 2014
|
||||
[NEW] Node: added getChildByName method for get a node that can be cast to Type T
|
||||
[NEW] FileUtils: could add seach path and resolution order path in front
|
||||
|
||||
[FIX] Animation3D: getOrCreate is deprecated and replaced with Animation3D::create
|
||||
[FIX] Animate3D: setSpeed() accept negtive value, which means play reverse, getPlayback and setPlayBack are deprecated
|
||||
[FIX] EditBox: can not set/get text in password mode on Mac OS X
|
||||
[FIX] Game Controller: joystick y value inversed on iOS
|
||||
[FIX] GLView: cursor position is not correct if design resolution is different from device resolution
|
||||
[FIX] Label: color can not be set correctly if using system font
|
||||
[FIX] Lua-binding: support UIVideoPlayer
|
||||
|
@ -16,9 +17,11 @@ cocos2d-x-3.2 ??
|
|||
[FIX] SpriteBatchNode: opacity can not work
|
||||
[FIX] Sprite3D: may crash on Android if playing animation and replace Scene after come from background
|
||||
[FIX] UIdget: opacity is wrong when replace texture
|
||||
[FIX] UIRichText: will crash when using utf8 string and the length exceed specified length
|
||||
[FIX] UIText: can not wrap words automatically
|
||||
[FIX] UITextField: keyboard can not hide if touching space outside of keyboard
|
||||
[FIX] UITextField: can not wrap words automatically
|
||||
[FIX] UIVideoPlayer: can not exit full screen mode on Android
|
||||
|
||||
[FIX] Others: don't release singleton objects correctly that are needed in the whole game, which will be treated
|
||||
as memory leak when using VLD.
|
||||
|
|
|
@ -570,6 +570,14 @@ void RenderTexture::onBegin()
|
|||
Mat4::createOrthographicOffCenter((float)-1.0 / widthRatio, (float)1.0 / widthRatio, (float)-1.0 / heightRatio, (float)1.0 / heightRatio, -1, 1, &orthoMatrix);
|
||||
director->multiplyMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION, orthoMatrix);
|
||||
}
|
||||
else
|
||||
{
|
||||
#if CC_TARGET_PLATFORM == CC_PLATFORM_WP8
|
||||
Mat4 modifiedProjection = director->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION);
|
||||
modifiedProjection = CCEGLView::sharedOpenGLView()->getReverseOrientationMatrix() * modifiedProjection;
|
||||
director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION, modifiedProjection);
|
||||
#endif
|
||||
}
|
||||
|
||||
//calculate viewport
|
||||
{
|
||||
|
|
|
@ -42,7 +42,12 @@ ActionManagerEx* ActionManagerEx::getInstance()
|
|||
|
||||
void ActionManagerEx::destroyInstance()
|
||||
{
|
||||
CC_SAFE_DELETE(sharedActionManager);
|
||||
if(sharedActionManager != nullptr)
|
||||
{
|
||||
sharedActionManager->releaseActions();
|
||||
CC_SAFE_DELETE(sharedActionManager);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
ActionManagerEx::ActionManagerEx()
|
||||
|
@ -154,6 +159,13 @@ void ActionManagerEx::releaseActions()
|
|||
for (iter = _actionDic.begin(); iter != _actionDic.end(); iter++)
|
||||
{
|
||||
cocos2d::Vector<ActionObject*> objList = iter->second;
|
||||
int listCount = objList.size();
|
||||
for (int i = 0; i < listCount; i++) {
|
||||
ActionObject* action = objList.at(i);
|
||||
if (action != nullptr) {
|
||||
action->stop();
|
||||
}
|
||||
}
|
||||
objList.clear();
|
||||
}
|
||||
|
||||
|
|
|
@ -292,6 +292,7 @@ public class Cocos2dxGLSurfaceView extends GLSurfaceView {
|
|||
public boolean onKeyDown(final int pKeyCode, final KeyEvent pKeyEvent) {
|
||||
switch (pKeyCode) {
|
||||
case KeyEvent.KEYCODE_BACK:
|
||||
Cocos2dxVideoHelper.mVideoHandler.sendEmptyMessage(Cocos2dxVideoHelper.KeyEventBack);
|
||||
case KeyEvent.KEYCODE_MENU:
|
||||
case KeyEvent.KEYCODE_DPAD_LEFT:
|
||||
case KeyEvent.KEYCODE_DPAD_RIGHT:
|
||||
|
|
|
@ -40,7 +40,7 @@ public class Cocos2dxVideoHelper {
|
|||
private FrameLayout mLayout = null;
|
||||
private Cocos2dxActivity mActivity = null;
|
||||
private SparseArray<Cocos2dxVideoView> sVideoViews = null;
|
||||
private static VideoHandler mVideoHandler = null;
|
||||
static VideoHandler mVideoHandler = null;
|
||||
|
||||
Cocos2dxVideoHelper(Cocos2dxActivity activity,FrameLayout layout)
|
||||
{
|
||||
|
@ -64,6 +64,8 @@ public class Cocos2dxVideoHelper {
|
|||
private final static int VideoTaskSetVisible = 9;
|
||||
private final static int VideoTaskRestart = 10;
|
||||
private final static int VideoTaskKeepRatio = 11;
|
||||
private final static int VideoTaskFullScreen = 12;
|
||||
final static int KeyEventBack = 1000;
|
||||
|
||||
static class VideoHandler extends Handler{
|
||||
WeakReference<Cocos2dxVideoHelper> mReference;
|
||||
|
@ -101,6 +103,16 @@ public class Cocos2dxVideoHelper {
|
|||
helper._setVideoRect(msg.arg1, rect.left, rect.top, rect.right, rect.bottom);
|
||||
break;
|
||||
}
|
||||
case VideoTaskFullScreen:{
|
||||
Cocos2dxVideoHelper helper = mReference.get();
|
||||
Rect rect = (Rect)msg.obj;
|
||||
if (msg.arg2 == 1) {
|
||||
helper._setFullScreenEnabled(msg.arg1, true, rect.right, rect.bottom);
|
||||
} else {
|
||||
helper._setFullScreenEnabled(msg.arg1, false, rect.right, rect.bottom);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case VideoTaskPause: {
|
||||
Cocos2dxVideoHelper helper = mReference.get();
|
||||
helper._pauseVideo(msg.arg1);
|
||||
|
@ -144,6 +156,11 @@ public class Cocos2dxVideoHelper {
|
|||
}
|
||||
break;
|
||||
}
|
||||
case KeyEventBack: {
|
||||
Cocos2dxVideoHelper helper = mReference.get();
|
||||
helper.onBackKeyEvent();
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -255,6 +272,38 @@ public class Cocos2dxVideoHelper {
|
|||
}
|
||||
}
|
||||
|
||||
public static void setFullScreenEnabled(int index,boolean enabled, int width,int height) {
|
||||
Message msg = new Message();
|
||||
msg.what = VideoTaskFullScreen;
|
||||
msg.arg1 = index;
|
||||
if (enabled) {
|
||||
msg.arg2 = 1;
|
||||
} else {
|
||||
msg.arg2 = 0;
|
||||
}
|
||||
msg.obj = new Rect(0, 0, width, height);
|
||||
mVideoHandler.sendMessage(msg);
|
||||
}
|
||||
|
||||
private void _setFullScreenEnabled(int index, boolean enabled, int width,int height) {
|
||||
Cocos2dxVideoView videoView = sVideoViews.get(index);
|
||||
if (videoView != null) {
|
||||
videoView.setFullScreenEnabled(enabled, width, height);
|
||||
}
|
||||
}
|
||||
|
||||
private void onBackKeyEvent() {
|
||||
int viewCount = sVideoViews.size();
|
||||
for (int i = 0; i < viewCount; i++) {
|
||||
int key = sVideoViews.keyAt(i);
|
||||
Cocos2dxVideoView videoView = sVideoViews.get(key);
|
||||
if (videoView != null) {
|
||||
videoView.setFullScreenEnabled(false, 0, 0);
|
||||
mActivity.runOnGLThread(new VideoEventRunnable(key, KeyEventBack));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void startVideo(int index) {
|
||||
Message msg = new Message();
|
||||
msg.what = VideoTaskStart;
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
package org.cocos2dx.lib;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.res.AssetFileDescriptor;
|
||||
|
@ -27,7 +26,6 @@ import android.media.AudioManager;
|
|||
import android.media.MediaPlayer;
|
||||
import android.media.MediaPlayer.OnErrorListener;
|
||||
import android.net.Uri;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.SurfaceHolder;
|
||||
|
@ -75,7 +73,7 @@ public class Cocos2dxVideoView extends SurfaceView implements MediaPlayerControl
|
|||
// recording the seek position while preparing
|
||||
private int mSeekWhenPrepared;
|
||||
|
||||
protected Context mContext = null;
|
||||
protected Cocos2dxActivity mCocos2dxActivity = null;
|
||||
|
||||
protected int mViewLeft = 0;
|
||||
protected int mViewTop = 0;
|
||||
|
@ -87,27 +85,17 @@ public class Cocos2dxVideoView extends SurfaceView implements MediaPlayerControl
|
|||
protected int mVisibleWidth = 0;
|
||||
protected int mVisibleHeight = 0;
|
||||
|
||||
protected boolean mFullScreenEnabled = false;
|
||||
protected int mFullScreenWidth = 0;
|
||||
protected int mFullScreenHeight = 0;
|
||||
|
||||
private int mViewTag = 0;
|
||||
|
||||
public Cocos2dxVideoView(Context context,int tag) {
|
||||
super(context);
|
||||
public Cocos2dxVideoView(Cocos2dxActivity activity,int tag) {
|
||||
super(activity);
|
||||
|
||||
mViewTag = tag;
|
||||
mContext = context;
|
||||
initVideoView();
|
||||
}
|
||||
|
||||
public Cocos2dxVideoView(Context context, AttributeSet attrs) {
|
||||
this(context, attrs, 0);
|
||||
|
||||
mContext = context;
|
||||
initVideoView();
|
||||
}
|
||||
|
||||
public Cocos2dxVideoView(Context context, AttributeSet attrs, int defStyle) {
|
||||
super(context, attrs, defStyle);
|
||||
|
||||
mContext = context;
|
||||
mCocos2dxActivity = activity;
|
||||
initVideoView();
|
||||
}
|
||||
|
||||
|
@ -115,11 +103,11 @@ public class Cocos2dxVideoView extends SurfaceView implements MediaPlayerControl
|
|||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||
if (mVideoWidth == 0 || mVideoHeight == 0) {
|
||||
setMeasuredDimension(mViewWidth, mViewHeight);
|
||||
Log.e(TAG, ""+mViewWidth+ ":" +mViewHeight);
|
||||
Log.i(TAG, ""+mViewWidth+ ":" +mViewHeight);
|
||||
}
|
||||
else {
|
||||
setMeasuredDimension(mVisibleWidth, mVisibleHeight);
|
||||
Log.e(TAG, ""+mVisibleWidth+ ":" +mVisibleHeight);
|
||||
Log.i(TAG, ""+mVisibleWidth+ ":" +mVisibleHeight);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -131,6 +119,18 @@ public class Cocos2dxVideoView extends SurfaceView implements MediaPlayerControl
|
|||
mViewHeight = maxHeight;
|
||||
|
||||
if (mVideoWidth != 0 && mVideoHeight != 0) {
|
||||
fixSize(mViewLeft, mViewTop, mViewWidth, mVideoHeight);
|
||||
}
|
||||
}
|
||||
|
||||
public void setFullScreenEnabled(boolean enabled, int width, int height) {
|
||||
if (mFullScreenEnabled != enabled) {
|
||||
mFullScreenEnabled = enabled;
|
||||
if (width != 0 && height != 0) {
|
||||
mFullScreenWidth = width;
|
||||
mFullScreenHeight = height;
|
||||
}
|
||||
|
||||
fixSize();
|
||||
}
|
||||
}
|
||||
|
@ -265,7 +265,7 @@ public class Cocos2dxVideoView extends SurfaceView implements MediaPlayerControl
|
|||
// TODO: these constants need to be published somewhere in the framework.
|
||||
Intent i = new Intent("com.android.music.musicservicecommand");
|
||||
i.putExtra("command", "pause");
|
||||
mContext.sendBroadcast(i);
|
||||
mCocos2dxActivity.sendBroadcast(i);
|
||||
|
||||
// we shouldn't clear the target state, because somebody might have
|
||||
// called start() previously
|
||||
|
@ -288,10 +288,10 @@ public class Cocos2dxVideoView extends SurfaceView implements MediaPlayerControl
|
|||
mDuration = -1;
|
||||
mCurrentBufferPercentage = 0;
|
||||
if (isAssetRouse) {
|
||||
AssetFileDescriptor afd = mContext.getAssets().openFd(fileName);
|
||||
AssetFileDescriptor afd = mCocos2dxActivity.getAssets().openFd(fileName);
|
||||
mMediaPlayer.setDataSource(afd.getFileDescriptor(),afd.getStartOffset(),afd.getLength());
|
||||
} else {
|
||||
mMediaPlayer.setDataSource(mContext, mUri);
|
||||
mMediaPlayer.setDataSource(mCocos2dxActivity, mUri);
|
||||
}
|
||||
|
||||
mMediaPlayer.prepareAsync();
|
||||
|
@ -321,27 +321,35 @@ public class Cocos2dxVideoView extends SurfaceView implements MediaPlayerControl
|
|||
}
|
||||
|
||||
public void fixSize() {
|
||||
if (mViewWidth != 0 && mViewHeight != 0) {
|
||||
if (mFullScreenEnabled) {
|
||||
fixSize(0, 0, mFullScreenWidth, mFullScreenHeight);
|
||||
} else {
|
||||
fixSize(mViewLeft, mViewTop, mViewWidth, mVideoHeight);
|
||||
}
|
||||
}
|
||||
|
||||
public void fixSize(int left,int top,int width,int height) {
|
||||
if (width != 0 && height != 0) {
|
||||
if (mKeepRatio) {
|
||||
if ( mVideoWidth * mViewHeight > mViewWidth * mVideoHeight ) {
|
||||
mVisibleWidth = mViewWidth;
|
||||
mVisibleHeight = mViewWidth * mVideoHeight / mVideoWidth;
|
||||
} else if ( mVideoWidth * mViewHeight < mViewWidth * mVideoHeight ) {
|
||||
mVisibleWidth = mViewHeight * mVideoWidth / mVideoHeight;
|
||||
mVisibleHeight = mViewHeight;
|
||||
if ( mVideoWidth * height > width * mVideoHeight ) {
|
||||
mVisibleWidth = width;
|
||||
mVisibleHeight = width * mVideoHeight / mVideoWidth;
|
||||
} else if ( mVideoWidth * height < width * mVideoHeight ) {
|
||||
mVisibleWidth = height * mVideoWidth / mVideoHeight;
|
||||
mVisibleHeight = height;
|
||||
}
|
||||
mVisibleLeft = mViewLeft + (mViewWidth - mVisibleWidth) / 2;
|
||||
mVisibleTop = mViewTop + (mViewHeight - mVisibleHeight) / 2;
|
||||
mVisibleLeft = left + (width - mVisibleWidth) / 2;
|
||||
mVisibleTop = top + (height - mVisibleHeight) / 2;
|
||||
} else {
|
||||
mVisibleLeft = mViewLeft;
|
||||
mVisibleTop = mViewTop;
|
||||
mVisibleWidth = mViewWidth;
|
||||
mVisibleHeight = mViewHeight;
|
||||
mVisibleLeft = left;
|
||||
mVisibleTop = top;
|
||||
mVisibleWidth = width;
|
||||
mVisibleHeight = height;
|
||||
}
|
||||
}
|
||||
else {
|
||||
mVisibleLeft = mViewLeft;
|
||||
mVisibleTop = mViewTop;
|
||||
mVisibleLeft = left;
|
||||
mVisibleTop = top;
|
||||
mVisibleWidth = mVideoWidth;
|
||||
mVisibleHeight = mVideoHeight;
|
||||
}
|
||||
|
@ -437,7 +445,7 @@ public class Cocos2dxVideoView extends SurfaceView implements MediaPlayerControl
|
|||
* longer have a window, don't bother showing the user an error.
|
||||
*/
|
||||
if (getWindowToken() != null) {
|
||||
Resources r = mContext.getResources();
|
||||
Resources r = mCocos2dxActivity.getResources();
|
||||
int messageId;
|
||||
|
||||
if (framework_err == MediaPlayer.MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK) {
|
||||
|
@ -451,7 +459,7 @@ public class Cocos2dxVideoView extends SurfaceView implements MediaPlayerControl
|
|||
int titleId = r.getIdentifier("VideoView_error_title", "string", "android");
|
||||
int buttonStringId = r.getIdentifier("VideoView_error_button", "string", "android");
|
||||
|
||||
new AlertDialog.Builder(mContext)
|
||||
new AlertDialog.Builder(mCocos2dxActivity)
|
||||
.setTitle(r.getString(titleId))
|
||||
.setMessage(messageId)
|
||||
.setPositiveButton(r.getString(buttonStringId),
|
||||
|
|
|
@ -58,7 +58,7 @@
|
|||
--------------------------------
|
||||
-- @function [parent=#VideoPlayer] onPlayEvent
|
||||
-- @param self
|
||||
-- @param #cc.experimental::ui::VideoPlayer::EventType eventtype
|
||||
-- @param #int int
|
||||
|
||||
--------------------------------
|
||||
-- @function [parent=#VideoPlayer] isFullScreenEnabled
|
||||
|
|
|
@ -522,7 +522,7 @@ int lua_cocos2dx_experimental_video_VideoPlayer_onPlayEvent(lua_State* tolua_S)
|
|||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 1)
|
||||
{
|
||||
cocos2d::experimental::ui::VideoPlayer::EventType arg0;
|
||||
int arg0;
|
||||
|
||||
ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0);
|
||||
if(!ok)
|
||||
|
|
|
@ -26,26 +26,47 @@
|
|||
#include "platform/CCFileUtils.h"
|
||||
#include "2d/CCLabel.h"
|
||||
#include "2d/CCSprite.h"
|
||||
#include "base/ccUTF8.h"
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
namespace ui {
|
||||
|
||||
static int _calcCharCount(const char * pszText)
|
||||
static std::string utf8_substr(const std::string& str, unsigned long start, unsigned long leng)
|
||||
{
|
||||
int n = 0;
|
||||
char ch = 0;
|
||||
while ((ch = *pszText))
|
||||
if (leng==0)
|
||||
{
|
||||
CC_BREAK_IF(! ch);
|
||||
|
||||
if (0x80 != (0xC0 & ch))
|
||||
{
|
||||
++n;
|
||||
}
|
||||
++pszText;
|
||||
return "";
|
||||
}
|
||||
return n;
|
||||
unsigned long c, i, ix, q, min=std::string::npos, max=std::string::npos;
|
||||
for (q=0, i=0, ix=str.length(); i < ix; i++, q++)
|
||||
{
|
||||
if (q==start)
|
||||
{
|
||||
min = i;
|
||||
}
|
||||
if (q <= start+leng || leng==std::string::npos)
|
||||
{
|
||||
max = i;
|
||||
}
|
||||
|
||||
c = (unsigned char) str[i];
|
||||
|
||||
if (c<=127) i+=0;
|
||||
else if ((c & 0xE0) == 0xC0) i+=1;
|
||||
else if ((c & 0xF0) == 0xE0) i+=2;
|
||||
else if ((c & 0xF8) == 0xF0) i+=3;
|
||||
else return "";//invalid utf8
|
||||
}
|
||||
if (q <= start+leng || leng == std::string::npos)
|
||||
{
|
||||
max = i;
|
||||
}
|
||||
if (min==std::string::npos || max==std::string::npos)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
return str.substr(min,max);
|
||||
}
|
||||
|
||||
bool RichElement::init(int tag, const Color3B &color, GLubyte opacity)
|
||||
|
@ -295,20 +316,20 @@ void RichText::handleTextRenderer(const std::string& text, const std::string& fo
|
|||
{
|
||||
float overstepPercent = (-_leftSpaceWidth) / textRendererWidth;
|
||||
std::string curText = text;
|
||||
size_t stringLength = _calcCharCount(text.c_str());
|
||||
size_t stringLength = StringUtils::getCharacterCountInUTF8String(text);
|
||||
int leftLength = stringLength * (1.0f - overstepPercent);
|
||||
std::string leftWords = curText.substr(0, leftLength);
|
||||
std::string cutWords = curText.substr(leftLength, curText.length()-1);
|
||||
std::string leftWords = utf8_substr(curText,0,leftLength);
|
||||
std::string cutWords = utf8_substr(curText, leftLength, curText.length() - leftLength);
|
||||
if (leftLength > 0)
|
||||
{
|
||||
Label* leftRenderer = nullptr;
|
||||
if (fileExist)
|
||||
{
|
||||
leftRenderer = Label::createWithTTF(leftWords.substr(0, leftLength).c_str(), fontName, fontSize);
|
||||
}
|
||||
leftRenderer = Label::createWithTTF(utf8_substr(leftWords, 0, leftLength), fontName, fontSize);
|
||||
}
|
||||
else
|
||||
{
|
||||
leftRenderer = Label::createWithSystemFont(leftWords.substr(0, leftLength).c_str(), fontName, fontSize);
|
||||
leftRenderer = Label::createWithSystemFont(utf8_substr(leftWords, 0, leftLength), fontName, fontSize);
|
||||
}
|
||||
if (leftRenderer)
|
||||
{
|
||||
|
|
|
@ -73,7 +73,7 @@ namespace experimental{
|
|||
|
||||
virtual void addEventListener(const VideoPlayer::ccVideoPlayerCallback& callback);
|
||||
|
||||
virtual void onPlayEvent(VideoPlayer::EventType event);
|
||||
virtual void onPlayEvent(int event);
|
||||
virtual void draw(Renderer *renderer, const Mat4& transform, uint32_t flags) override;
|
||||
|
||||
protected:
|
||||
|
|
|
@ -37,10 +37,12 @@
|
|||
//-----------------------------------------------------------------------------------------------------------
|
||||
#define CLASS_NAME "org/cocos2dx/lib/Cocos2dxVideoHelper"
|
||||
|
||||
void executeVideoCallback(int index,int event);
|
||||
|
||||
USING_NS_CC;
|
||||
|
||||
static void executeVideoCallback(int index,int event);
|
||||
|
||||
#define QUIT_FULLSCREEN 1000
|
||||
|
||||
extern "C" {
|
||||
void Java_org_cocos2dx_lib_Cocos2dxVideoHelper_nativeExecuteVideoCallback(JNIEnv * env, jobject obj, jint index,jint event) {
|
||||
executeVideoCallback(index,event);
|
||||
|
@ -87,6 +89,17 @@ void setVideoRectJNI(int index,int left,int top,int width,int height)
|
|||
}
|
||||
}
|
||||
|
||||
void setFullScreenEnabledJni(int index,bool enabled, int width, int height)
|
||||
{
|
||||
JniMethodInfo t;
|
||||
|
||||
if (JniHelper::getStaticMethodInfo(t, CLASS_NAME, "setFullScreenEnabled", "(IZII)V")) {
|
||||
t.env->CallStaticVoidMethod(t.classID, t.methodID, index, enabled, width, height);
|
||||
|
||||
t.env->DeleteLocalRef(t.classID);
|
||||
}
|
||||
}
|
||||
|
||||
void setVideoURLJNI(int index,int videoSource,const std::string& videoUrl)
|
||||
{
|
||||
JniMethodInfo t;
|
||||
|
@ -166,16 +179,6 @@ VideoPlayer::VideoPlayer()
|
|||
{
|
||||
_videoPlayerIndex = createVideoWidgetJNI();
|
||||
s_allVideoPlayers[_videoPlayerIndex] = this;
|
||||
|
||||
auto listener = EventListenerKeyboard::create();
|
||||
listener->onKeyReleased = [&](EventKeyboard::KeyCode keycode, cocos2d::Event* event){
|
||||
if (keycode == EventKeyboard::KeyCode::KEY_BACKSPACE && _fullScreenEnabled)
|
||||
{
|
||||
this->setFullScreenEnabled(false);
|
||||
}
|
||||
};
|
||||
|
||||
_eventDispatcher->addEventListenerWithSceneGraphPriority(listener, this);
|
||||
}
|
||||
|
||||
VideoPlayer::~VideoPlayer()
|
||||
|
@ -202,31 +205,23 @@ void VideoPlayer::draw(Renderer* renderer, const Mat4 &transform, uint32_t flags
|
|||
{
|
||||
cocos2d::ui::Widget::draw(renderer,transform,flags);
|
||||
|
||||
if ((flags&FLAGS_TRANSFORM_DIRTY) || _fullScreenDirty)
|
||||
if (flags & FLAGS_TRANSFORM_DIRTY)
|
||||
{
|
||||
_fullScreenDirty = false;
|
||||
auto directorInstance = Director::getInstance();
|
||||
auto glView = directorInstance->getOpenGLView();
|
||||
auto frameSize = glView->getFrameSize();
|
||||
|
||||
if (_fullScreenEnabled)
|
||||
{
|
||||
setVideoRectJNI(_videoPlayerIndex,0,0,frameSize.width,frameSize.height);
|
||||
}
|
||||
else
|
||||
{
|
||||
auto winSize = directorInstance->getWinSize();
|
||||
auto winSize = directorInstance->getWinSize();
|
||||
|
||||
auto leftBottom = convertToWorldSpace(Point::ZERO);
|
||||
auto rightTop = convertToWorldSpace(Point(_contentSize.width,_contentSize.height));
|
||||
auto leftBottom = convertToWorldSpace(Point::ZERO);
|
||||
auto rightTop = convertToWorldSpace(Point(_contentSize.width,_contentSize.height));
|
||||
|
||||
auto uiLeft = frameSize.width / 2 + (leftBottom.x - winSize.width / 2 ) * glView->getScaleX();
|
||||
auto uiTop = frameSize.height /2 - (rightTop.y - winSize.height / 2) * glView->getScaleY();
|
||||
auto uiLeft = frameSize.width / 2 + (leftBottom.x - winSize.width / 2 ) * glView->getScaleX();
|
||||
auto uiTop = frameSize.height /2 - (rightTop.y - winSize.height / 2) * glView->getScaleY();
|
||||
|
||||
setVideoRectJNI(_videoPlayerIndex,uiLeft,uiTop,
|
||||
(rightTop.x - leftBottom.x) * glView->getScaleX(),
|
||||
(rightTop.y - leftBottom.y) * glView->getScaleY());
|
||||
}
|
||||
setVideoRectJNI(_videoPlayerIndex,uiLeft,uiTop,
|
||||
(rightTop.x - leftBottom.x) * glView->getScaleX(),
|
||||
(rightTop.y - leftBottom.y) * glView->getScaleY());
|
||||
}
|
||||
|
||||
#if CC_VIDEOPLAYER_DEBUG_DRAW
|
||||
|
@ -241,7 +236,9 @@ void VideoPlayer::setFullScreenEnabled(bool enabled)
|
|||
if (_fullScreenEnabled != enabled)
|
||||
{
|
||||
_fullScreenEnabled = enabled;
|
||||
_fullScreenDirty = true;
|
||||
|
||||
auto frameSize = Director::getInstance()->getOpenGLView()->getFrameSize();
|
||||
setFullScreenEnabledJni(_videoPlayerIndex, enabled, frameSize.width, frameSize.height);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -344,17 +341,25 @@ void VideoPlayer::addEventListener(const VideoPlayer::ccVideoPlayerCallback& cal
|
|||
_eventCallback = callback;
|
||||
}
|
||||
|
||||
void VideoPlayer::onPlayEvent(VideoPlayer::EventType event)
|
||||
void VideoPlayer::onPlayEvent(int event)
|
||||
{
|
||||
if (event == VideoPlayer::EventType::PLAYING) {
|
||||
_isPlaying = true;
|
||||
} else {
|
||||
_isPlaying = false;
|
||||
}
|
||||
|
||||
if (_eventCallback)
|
||||
if (event == QUIT_FULLSCREEN)
|
||||
{
|
||||
_eventCallback(this,event);
|
||||
_fullScreenEnabled = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
VideoPlayer::EventType videoEvent = (VideoPlayer::EventType)event;
|
||||
if (videoEvent == VideoPlayer::EventType::PLAYING) {
|
||||
_isPlaying = true;
|
||||
} else {
|
||||
_isPlaying = false;
|
||||
}
|
||||
|
||||
if (_eventCallback)
|
||||
{
|
||||
_eventCallback(this,videoEvent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -385,7 +390,7 @@ void executeVideoCallback(int index,int event)
|
|||
auto it = s_allVideoPlayers.find(index);
|
||||
if (it != s_allVideoPlayers.end())
|
||||
{
|
||||
s_allVideoPlayers[index]->onPlayEvent((VideoPlayer::EventType)event);
|
||||
s_allVideoPlayers[index]->onPlayEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -171,7 +171,7 @@ using namespace cocos2d::experimental::ui;
|
|||
{
|
||||
if([self.moviePlayer playbackState] != MPMoviePlaybackStateStopped)
|
||||
{
|
||||
_videoPlayer->onPlayEvent(VideoPlayer::EventType::COMPLETED);
|
||||
_videoPlayer->onPlayEvent((int)VideoPlayer::EventType::COMPLETED);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -181,13 +181,13 @@ using namespace cocos2d::experimental::ui;
|
|||
MPMoviePlaybackState state = [self.moviePlayer playbackState];
|
||||
switch (state) {
|
||||
case MPMoviePlaybackStatePaused:
|
||||
_videoPlayer->onPlayEvent(VideoPlayer::EventType::PAUSED);
|
||||
_videoPlayer->onPlayEvent((int)VideoPlayer::EventType::PAUSED);
|
||||
break;
|
||||
case MPMoviePlaybackStateStopped:
|
||||
_videoPlayer->onPlayEvent(VideoPlayer::EventType::STOPPED);
|
||||
_videoPlayer->onPlayEvent((int)VideoPlayer::EventType::STOPPED);
|
||||
break;
|
||||
case MPMoviePlaybackStatePlaying:
|
||||
_videoPlayer->onPlayEvent(VideoPlayer::EventType::PLAYING);
|
||||
_videoPlayer->onPlayEvent((int)VideoPlayer::EventType::PLAYING);
|
||||
break;
|
||||
case MPMoviePlaybackStateInterrupted:
|
||||
break;
|
||||
|
@ -449,9 +449,9 @@ void VideoPlayer::addEventListener(const VideoPlayer::ccVideoPlayerCallback& cal
|
|||
_eventCallback = callback;
|
||||
}
|
||||
|
||||
void VideoPlayer::onPlayEvent(VideoPlayer::EventType event)
|
||||
void VideoPlayer::onPlayEvent(int event)
|
||||
{
|
||||
if (event == VideoPlayer::EventType::PLAYING) {
|
||||
if (event == (int)VideoPlayer::EventType::PLAYING) {
|
||||
_isPlaying = true;
|
||||
} else {
|
||||
_isPlaying = false;
|
||||
|
@ -459,7 +459,7 @@ void VideoPlayer::onPlayEvent(VideoPlayer::EventType event)
|
|||
|
||||
if (_eventCallback)
|
||||
{
|
||||
_eventCallback(this,event);
|
||||
_eventCallback(this, (VideoPlayer::EventType)event);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{
|
||||
"templateVersion":"1.2",
|
||||
"runtimeVersion":"1.2"
|
||||
"templateVersion":"1.3",
|
||||
"runtimeVersion":"1.3"
|
||||
}
|
|
@ -4,7 +4,8 @@
|
|||
"name": "HelloLua",
|
||||
"width": 960,
|
||||
"height": 640,
|
||||
"entry": "src/main.lua"
|
||||
"entry": "src/main.lua",
|
||||
"consolePort": 6010
|
||||
},
|
||||
"simulator_screen_size": [
|
||||
{
|
||||
|
|
|
@ -46,9 +46,7 @@ bool AppDelegate::applicationDidFinishLaunching()
|
|||
#endif
|
||||
}
|
||||
|
||||
// turn on display FPS
|
||||
director->setDisplayStats(true);
|
||||
|
||||
|
||||
// set FPS. the default value is 1.0/60 if you don't call this
|
||||
director->setAnimationInterval(1.0 / 60);
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@ bool ConfigParser::isInit()
|
|||
void ConfigParser::readConfig()
|
||||
{
|
||||
_isInit = true;
|
||||
_consolePort = 6010;
|
||||
string filecfg = "config.json";
|
||||
|
||||
string fileContent;
|
||||
|
@ -69,6 +70,9 @@ void ConfigParser::readConfig()
|
|||
if (objectInitView.HasMember("entry") && objectInitView["entry"].IsString()) {
|
||||
_entryfile = objectInitView["entry"].GetString();
|
||||
}
|
||||
if (objectInitView.HasMember("consolePort")){
|
||||
_consolePort = objectInitView["consolePort"].GetUint();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (_docRootjson.HasMember("simulator_screen_size"))
|
||||
|
@ -123,6 +127,10 @@ bool ConfigParser::isLanscape()
|
|||
return _isLandscape;
|
||||
}
|
||||
|
||||
int ConfigParser::getConsolePort()
|
||||
{
|
||||
return _consolePort;
|
||||
}
|
||||
int ConfigParser::getScreenSizeCount(void)
|
||||
{
|
||||
return (int)_screenSizeArray.size();
|
||||
|
|
|
@ -36,6 +36,7 @@ public:
|
|||
string getEntryFile();
|
||||
rapidjson::Document& getConfigJsonRoot();
|
||||
const SimulatorScreenSize getScreenSize(int index);
|
||||
int getConsolePort();
|
||||
bool isLanscape();
|
||||
bool isInit();
|
||||
|
||||
|
@ -48,6 +49,7 @@ private:
|
|||
string _entryfile;
|
||||
bool _isLandscape;
|
||||
bool _isInit;
|
||||
int _consolePort;
|
||||
|
||||
rapidjson::Document _docRootjson;
|
||||
};
|
||||
|
|
|
@ -0,0 +1,137 @@
|
|||
// Protocol Buffers - Google's data interchange format
|
||||
// Copyright 2012 Google Inc. All rights reserved.
|
||||
// http://code.google.com/p/protobuf/
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
// This module gets enough CPU information to optimize the
|
||||
// atomicops module on x86.
|
||||
|
||||
#include <cstring>
|
||||
|
||||
#include <google/protobuf/stubs/atomicops.h>
|
||||
|
||||
// This file only makes sense with atomicops_internals_x86_gcc.h -- it
|
||||
// depends on structs that are defined in that file. If atomicops.h
|
||||
// doesn't sub-include that file, then we aren't needed, and shouldn't
|
||||
// try to do anything.
|
||||
#ifdef GOOGLE_PROTOBUF_ATOMICOPS_INTERNALS_X86_GCC_H_
|
||||
|
||||
// Inline cpuid instruction. In PIC compilations, %ebx contains the address
|
||||
// of the global offset table. To avoid breaking such executables, this code
|
||||
// must preserve that register's value across cpuid instructions.
|
||||
#if defined(__i386__)
|
||||
#define cpuid(a, b, c, d, inp) \
|
||||
asm("mov %%ebx, %%edi\n" \
|
||||
"cpuid\n" \
|
||||
"xchg %%edi, %%ebx\n" \
|
||||
: "=a" (a), "=D" (b), "=c" (c), "=d" (d) : "a" (inp))
|
||||
#elif defined(__x86_64__)
|
||||
#define cpuid(a, b, c, d, inp) \
|
||||
asm("mov %%rbx, %%rdi\n" \
|
||||
"cpuid\n" \
|
||||
"xchg %%rdi, %%rbx\n" \
|
||||
: "=a" (a), "=D" (b), "=c" (c), "=d" (d) : "a" (inp))
|
||||
#endif
|
||||
|
||||
#if defined(cpuid) // initialize the struct only on x86
|
||||
|
||||
namespace google {
|
||||
namespace protobuf {
|
||||
namespace internal {
|
||||
|
||||
// Set the flags so that code will run correctly and conservatively, so even
|
||||
// if we haven't been initialized yet, we're probably single threaded, and our
|
||||
// default values should hopefully be pretty safe.
|
||||
struct AtomicOps_x86CPUFeatureStruct AtomicOps_Internalx86CPUFeatures = {
|
||||
false, // bug can't exist before process spawns multiple threads
|
||||
false, // no SSE2
|
||||
};
|
||||
|
||||
namespace {
|
||||
|
||||
// Initialize the AtomicOps_Internalx86CPUFeatures struct.
|
||||
void AtomicOps_Internalx86CPUFeaturesInit() {
|
||||
uint32_t eax;
|
||||
uint32_t ebx;
|
||||
uint32_t ecx;
|
||||
uint32_t edx;
|
||||
|
||||
// Get vendor string (issue CPUID with eax = 0)
|
||||
cpuid(eax, ebx, ecx, edx, 0);
|
||||
char vendor[13];
|
||||
memcpy(vendor, &ebx, 4);
|
||||
memcpy(vendor + 4, &edx, 4);
|
||||
memcpy(vendor + 8, &ecx, 4);
|
||||
vendor[12] = 0;
|
||||
|
||||
// get feature flags in ecx/edx, and family/model in eax
|
||||
cpuid(eax, ebx, ecx, edx, 1);
|
||||
|
||||
int family = (eax >> 8) & 0xf; // family and model fields
|
||||
int model = (eax >> 4) & 0xf;
|
||||
if (family == 0xf) { // use extended family and model fields
|
||||
family += (eax >> 20) & 0xff;
|
||||
model += ((eax >> 16) & 0xf) << 4;
|
||||
}
|
||||
|
||||
// Opteron Rev E has a bug in which on very rare occasions a locked
|
||||
// instruction doesn't act as a read-acquire barrier if followed by a
|
||||
// non-locked read-modify-write instruction. Rev F has this bug in
|
||||
// pre-release versions, but not in versions released to customers,
|
||||
// so we test only for Rev E, which is family 15, model 32..63 inclusive.
|
||||
if (strcmp(vendor, "AuthenticAMD") == 0 && // AMD
|
||||
family == 15 &&
|
||||
32 <= model && model <= 63) {
|
||||
AtomicOps_Internalx86CPUFeatures.has_amd_lock_mb_bug = true;
|
||||
} else {
|
||||
AtomicOps_Internalx86CPUFeatures.has_amd_lock_mb_bug = false;
|
||||
}
|
||||
|
||||
// edx bit 26 is SSE2 which we use to tell use whether we can use mfence
|
||||
AtomicOps_Internalx86CPUFeatures.has_sse2 = ((edx >> 26) & 1);
|
||||
}
|
||||
|
||||
class AtomicOpsx86Initializer {
|
||||
public:
|
||||
AtomicOpsx86Initializer() {
|
||||
AtomicOps_Internalx86CPUFeaturesInit();
|
||||
}
|
||||
};
|
||||
|
||||
// A global to get use initialized on startup via static initialization :/
|
||||
AtomicOpsx86Initializer g_initer;
|
||||
|
||||
} // namespace
|
||||
|
||||
} // namespace internal
|
||||
} // namespace protobuf
|
||||
} // namespace google
|
||||
|
||||
#endif // __i386__
|
||||
|
||||
#endif // GOOGLE_PROTOBUF_ATOMICOPS_INTERNALS_X86_GCC_H_
|
|
@ -35,6 +35,7 @@ THE SOFTWARE.
|
|||
#include "ConfigParser.h"
|
||||
#include "Protos.pb.h"
|
||||
#include "zlib.h"
|
||||
#include "lua.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <direct.h>
|
||||
|
@ -49,7 +50,7 @@ using namespace std;
|
|||
using namespace cocos2d;
|
||||
|
||||
std::string g_resourcePath;
|
||||
extern string getIPAddress();
|
||||
|
||||
|
||||
//1M size
|
||||
#define MAXPROTOLENGTH 1048576
|
||||
|
@ -60,11 +61,81 @@ extern string getIPAddress();
|
|||
#define usleep(t) usleep(t)
|
||||
#endif
|
||||
|
||||
extern string getIPAddress();
|
||||
const char* getRuntimeVersion()
|
||||
{
|
||||
return "1.2";
|
||||
return "1.3";
|
||||
}
|
||||
|
||||
static string& replaceAll(string& str,const string& old_value,const string& new_value)
|
||||
{
|
||||
while(true)
|
||||
{
|
||||
int pos=0;
|
||||
if((pos=str.find(old_value,0))!=string::npos)
|
||||
str.replace(pos,old_value.length(),new_value);
|
||||
else break;
|
||||
}
|
||||
return str;
|
||||
}
|
||||
static bool resetLuaModule(string fileName)
|
||||
{
|
||||
if (fileName.empty())
|
||||
{
|
||||
CCLOG("fileName is null");
|
||||
return false;
|
||||
}
|
||||
auto engine = LuaEngine::getInstance();
|
||||
LuaStack* luaStack = engine->getLuaStack();
|
||||
lua_State* stack=luaStack->getLuaState();
|
||||
lua_getglobal(stack, "package"); /* L: package */
|
||||
lua_getfield(stack, -1, "loaded"); /* L: package loaded */
|
||||
lua_pushnil(stack); /* L: lotable ?-.. nil */
|
||||
while ( 0 != lua_next(stack, -2 ) ) /* L: lotable ?-.. key value */
|
||||
{
|
||||
//CCLOG("%s - %s \n", tolua_tostring(stack, -2, ""), lua_typename(stack, lua_type(stack, -1)));
|
||||
std::string key=tolua_tostring(stack, -2, "");
|
||||
std::string tableKey =key;
|
||||
int found = tableKey.rfind(".lua");
|
||||
if (found!=std::string::npos)
|
||||
tableKey = tableKey.substr(0,found);
|
||||
tableKey=replaceAll(tableKey,".","/");
|
||||
tableKey=replaceAll(tableKey,"\\","/");
|
||||
tableKey.append(".lua");
|
||||
found = fileName.rfind(tableKey);
|
||||
if (0 == found || ( found!=std::string::npos && fileName.at(found-1) == '/'))
|
||||
{
|
||||
lua_pushstring(stack, key.c_str());
|
||||
lua_pushnil(stack);
|
||||
if (lua_istable(stack, -5))
|
||||
{
|
||||
lua_settable(stack, -5);
|
||||
}
|
||||
}
|
||||
lua_pop(stack, 1);
|
||||
}
|
||||
lua_pop(stack, 2);
|
||||
return true;
|
||||
}
|
||||
bool reloadScript(string modulefile)
|
||||
{
|
||||
auto director = Director::getInstance();
|
||||
FontFNT::purgeCachedData();
|
||||
if (director->getOpenGLView())
|
||||
{
|
||||
SpriteFrameCache::getInstance()->removeSpriteFrames();
|
||||
director->getTextureCache()->removeAllTextures();
|
||||
}
|
||||
FileUtils::getInstance()->purgeCachedEntries();
|
||||
if (!resetLuaModule(modulefile))
|
||||
{
|
||||
modulefile = ConfigParser::getInstance()->getEntryFile().c_str();
|
||||
}
|
||||
auto engine = LuaEngine::getInstance();
|
||||
LuaStack* luaStack = engine->getLuaStack();
|
||||
std::string require = "require \'" + modulefile + "\'";
|
||||
return luaStack->executeString(require.c_str());
|
||||
}
|
||||
void startScript(string strDebugArg)
|
||||
{
|
||||
// register lua engine
|
||||
|
@ -77,28 +148,8 @@ void startScript(string strDebugArg)
|
|||
engine->executeScriptFile(ConfigParser::getInstance()->getEntryFile().c_str());
|
||||
}
|
||||
|
||||
bool reloadScript(const string& modulefile)
|
||||
{
|
||||
string strfile = modulefile;
|
||||
if (strfile.empty())
|
||||
{
|
||||
strfile = ConfigParser::getInstance()->getEntryFile().c_str();
|
||||
}
|
||||
|
||||
auto director = Director::getInstance();
|
||||
FontFNT::purgeCachedData();
|
||||
if (director->getOpenGLView())
|
||||
{
|
||||
SpriteFrameCache::getInstance()->removeSpriteFrames();
|
||||
director->getTextureCache()->removeAllTextures();
|
||||
}
|
||||
FileUtils::getInstance()->purgeCachedEntries();
|
||||
|
||||
director->getScheduler()->unscheduleAll();
|
||||
director->getScheduler()->scheduleUpdate(director->getActionManager(), Scheduler::PRIORITY_SYSTEM, false);
|
||||
|
||||
return (LuaEngine::getInstance()->reload(strfile.c_str())==0);
|
||||
}
|
||||
|
||||
|
||||
#if defined(_MSC_VER) || defined(__MINGW32__)
|
||||
#include <io.h>
|
||||
|
@ -231,7 +282,7 @@ void FileServer::readResFileFinfo()
|
|||
if (!pFile) return ;
|
||||
fwrite(str,sizeof(char),strlen(str),pFile);
|
||||
fclose(pFile);
|
||||
},this, 10.0f, false, "fileinfo");
|
||||
},this, 5.0f, false, "fileinfo");
|
||||
}
|
||||
|
||||
void FileServer::addResFileInfo(const char* filename,uint64_t u64)
|
||||
|
@ -337,19 +388,8 @@ void FileServer::stop()
|
|||
}
|
||||
}
|
||||
|
||||
string& replaceAll(string& str,const string& old_value,const string& new_value)
|
||||
{
|
||||
while(true)
|
||||
{
|
||||
int pos=0;
|
||||
if((pos=str.find(old_value,0))!=string::npos)
|
||||
str.replace(pos,old_value.length(),new_value);
|
||||
else break;
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
bool CreateDir(const char *sPathName)
|
||||
static bool CreateDir(const char *sPathName)
|
||||
{
|
||||
char DirName[256]={0};
|
||||
strcpy(DirName, sPathName);
|
||||
|
@ -382,7 +422,7 @@ bool CreateDir(const char *sPathName)
|
|||
return true;
|
||||
}
|
||||
|
||||
void recvBuf(int fd,char *pbuf,int bufsize)
|
||||
static void recvBuf(int fd,char *pbuf,int bufsize)
|
||||
{
|
||||
int startFlagLen = bufsize;
|
||||
while (startFlagLen != 0){
|
||||
|
@ -447,7 +487,14 @@ void FileServer::loopReceiveFile()
|
|||
}
|
||||
}
|
||||
int contentSize = recvDataBuf.fileProto.content_size();
|
||||
if (contentSize>0){
|
||||
if (contentSize == 0)
|
||||
{
|
||||
recvDataBuf.contentBuf="";
|
||||
_recvBufListMutex.lock();
|
||||
_recvBufList.push_back(recvDataBuf);
|
||||
_recvBufListMutex.unlock();
|
||||
}else if(contentSize>0)
|
||||
{
|
||||
//recv body data
|
||||
Bytef *contentbuf= new Bytef[contentSize+1];
|
||||
memset(contentbuf,0,contentSize+1);
|
||||
|
@ -513,7 +560,7 @@ void FileServer::loopWriteFile()
|
|||
_fileNameMutex.lock();
|
||||
_strFileName = filename;
|
||||
_fileNameMutex.unlock();
|
||||
cocos2d::log("WriteFile:: fullfilename = %s",filename.c_str());
|
||||
//cocos2d::log("WriteFile:: fullfilename = %s",filename.c_str());
|
||||
CreateDir(fullfilename.substr(0,fullfilename.find_last_of("/")).c_str());
|
||||
|
||||
FILE *fp= nullptr;
|
||||
|
@ -531,7 +578,7 @@ void FileServer::loopWriteFile()
|
|||
continue;
|
||||
}
|
||||
if (fp){
|
||||
if (0 == fwrite(recvDataBuf.contentBuf.c_str(), sizeof(char), recvDataBuf.contentBuf.size(),fp)){
|
||||
if (recvDataBuf.contentBuf.size() > 0 && 0 == fwrite(recvDataBuf.contentBuf.c_str(), sizeof(char), recvDataBuf.contentBuf.size(),fp)){
|
||||
addResponse(recvDataBuf.fd,filename,runtime::FileSendComplete::RESULTTYPE::FileSendComplete_RESULTTYPE_FWRITE_ERROR,errno);
|
||||
fclose(fp);
|
||||
continue;
|
||||
|
@ -751,16 +798,23 @@ public:
|
|||
for (int i=0;i< sizeof(commands)/sizeof(Console::Command);i++) {
|
||||
_console->addCommand(commands[i]);
|
||||
}
|
||||
#if(CC_PLATFORM_MAC == CC_TARGET_PLATFORM || CC_PLATFORM_WIN32 == CC_TARGET_PLATFORM)
|
||||
_console->listenOnTCP(ConfigParser::getInstance()->getConsolePort());
|
||||
#else
|
||||
_console->listenOnTCP(6010);
|
||||
|
||||
#endif
|
||||
_fileserver = nullptr;
|
||||
#if(CC_PLATFORM_MAC != CC_TARGET_PLATFORM && CC_PLATFORM_WIN32 != CC_TARGET_PLATFORM)
|
||||
_fileserver= FileServer::getShareInstance();
|
||||
_fileserver->listenOnTCP(6020);
|
||||
_fileserver->readResFileFinfo();
|
||||
#endif
|
||||
}
|
||||
|
||||
~ConsoleCustomCommand()
|
||||
{
|
||||
Director::getInstance()->getConsole()->stop();
|
||||
if(_fileserver)
|
||||
_fileserver->stop();
|
||||
}
|
||||
|
||||
|
@ -810,9 +864,11 @@ public:
|
|||
dReplyParse.AddMember("code",0,dReplyParse.GetAllocator());
|
||||
}else if(strcmp(strcmd.c_str(),"getfileinfo")==0){
|
||||
rapidjson::Value bodyvalue(rapidjson::kObjectType);
|
||||
rapidjson::Document* filecfgjson = _fileserver->getFileCfgJson();
|
||||
for (auto it=filecfgjson->MemberonBegin();it!=filecfgjson->MemberonEnd();++it){
|
||||
bodyvalue.AddMember(it->name.GetString(),it->value.GetString(),dReplyParse.GetAllocator());
|
||||
if(_fileserver){
|
||||
rapidjson::Document* filecfgjson = _fileserver->getFileCfgJson();
|
||||
for (auto it=filecfgjson->MemberonBegin();it!=filecfgjson->MemberonEnd();++it){
|
||||
bodyvalue.AddMember(it->name.GetString(),it->value.GetString(),dReplyParse.GetAllocator());
|
||||
}
|
||||
}
|
||||
dReplyParse.AddMember("body",bodyvalue,dReplyParse.GetAllocator());
|
||||
dReplyParse.AddMember("code",0,dReplyParse.GetAllocator());
|
||||
|
@ -1056,6 +1112,11 @@ bool initRuntime()
|
|||
searchPathArray.insert(searchPathArray.begin(),g_resourcePath);
|
||||
FileUtils::getInstance()->setSearchPaths(searchPathArray);
|
||||
|
||||
auto engine = LuaEngine::getInstance();
|
||||
ScriptEngineManager::getInstance()->setScriptEngine(engine);
|
||||
LuaStack* stack = engine->getLuaStack();
|
||||
register_runtime_override_function(stack->getLuaState());
|
||||
luaopen_debugger(engine->getLuaStack()->getLuaState());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1075,16 +1136,13 @@ bool startRuntime()
|
|||
#endif
|
||||
#endif
|
||||
|
||||
static ConsoleCustomCommand s_customCommand;
|
||||
s_customCommand.init();
|
||||
auto engine = LuaEngine::getInstance();
|
||||
ScriptEngineManager::getInstance()->setScriptEngine(engine);
|
||||
// turn on display FPS
|
||||
Director::getInstance()->setDisplayStats(true);
|
||||
|
||||
LuaStack* stack = engine->getLuaStack();
|
||||
register_runtime_override_function(stack->getLuaState());
|
||||
|
||||
luaopen_debugger(engine->getLuaStack()->getLuaState());
|
||||
|
||||
static ConsoleCustomCommand *g_customCommand;
|
||||
g_customCommand = new ConsoleCustomCommand();
|
||||
g_customCommand->init();
|
||||
|
||||
auto scene = Scene::create();
|
||||
auto connectLayer = new ConnectWaitLayer();
|
||||
connectLayer->autorelease();
|
||||
|
|
|
@ -31,7 +31,7 @@ using namespace std;
|
|||
bool initRuntime();
|
||||
bool startRuntime();
|
||||
|
||||
bool reloadScript(const string& modulefile);
|
||||
bool reloadScript(string modulefile);
|
||||
|
||||
#endif // _RUNTIME__H_
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@ LOCAL_SRC_FILES := \
|
|||
../../Classes/protobuf-lite/google/protobuf/generated_message_util.cc \
|
||||
../../Classes/protobuf-lite/google/protobuf/message_lite.cc \
|
||||
../../Classes/protobuf-lite/google/protobuf/stubs/once.cc \
|
||||
../../Classes/protobuf-lite/google/protobuf/stubs/atomicops_internals_x86_gcc.cc \
|
||||
../../Classes/protobuf-lite/google/protobuf/repeated_field.cc \
|
||||
../../Classes/protobuf-lite/google/protobuf/wire_format_lite.cc \
|
||||
../../Classes/protobuf-lite/google/protobuf/io/zero_copy_stream.cc \
|
||||
|
|
|
@ -30,6 +30,7 @@ import java.net.InetAddress;
|
|||
import java.net.NetworkInterface;
|
||||
import java.net.SocketException;
|
||||
import java.util.Enumeration;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.cocos2dx.lib.Cocos2dxActivity;
|
||||
|
||||
|
@ -48,6 +49,7 @@ import android.os.Environment;
|
|||
import android.provider.Settings;
|
||||
import android.text.format.Formatter;
|
||||
import android.util.Log;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.Toast;
|
||||
|
||||
// The name of .so is specified in AndroidMenifest.xml. NativityActivity will load it automatically for you.
|
||||
|
@ -72,7 +74,8 @@ public class AppActivity extends Cocos2dxActivity{
|
|||
// Check the wifi is opened when the native is debug.
|
||||
if(nativeIsDebug())
|
||||
{
|
||||
if(!isWifiConnected())
|
||||
getWindow().setFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON, WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||
if(!isNetworkConnected())
|
||||
{
|
||||
AlertDialog.Builder builder=new AlertDialog.Builder(this);
|
||||
builder.setTitle("Warning");
|
||||
|
@ -92,11 +95,20 @@ public class AppActivity extends Cocos2dxActivity{
|
|||
}
|
||||
hostIPAdress = getHostIpAddress();
|
||||
}
|
||||
private boolean isWifiConnected() {
|
||||
private boolean isNetworkConnected() {
|
||||
ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||
if (cm != null) {
|
||||
NetworkInfo networkInfo = cm.getActiveNetworkInfo();
|
||||
if (networkInfo != null && networkInfo.getType() == ConnectivityManager.TYPE_WIFI) {
|
||||
ArrayList networkTypes = new ArrayList();
|
||||
networkTypes.add(ConnectivityManager.TYPE_WIFI);
|
||||
try {
|
||||
networkTypes.add(ConnectivityManager.class.getDeclaredField("TYPE_ETHERNET").getInt(null));
|
||||
} catch (NoSuchFieldException nsfe) {
|
||||
}
|
||||
catch (IllegalAccessException iae) {
|
||||
throw new RuntimeException(iae);
|
||||
}
|
||||
if (networkInfo != null && networkTypes.contains(networkInfo.getType())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
3EB5156D1952865D006966AA /* stringprintf.cc in Sources */ = {isa = PBXBuildFile; fileRef = 3EB515511952865D006966AA /* stringprintf.cc */; };
|
||||
3EB5156E1952865D006966AA /* wire_format_lite.cc in Sources */ = {isa = PBXBuildFile; fileRef = 3EB515551952865D006966AA /* wire_format_lite.cc */; };
|
||||
3EB5156F1952865D006966AA /* wire_format_lite.cc in Sources */ = {isa = PBXBuildFile; fileRef = 3EB515551952865D006966AA /* wire_format_lite.cc */; };
|
||||
3EEEDB61197107C0006A9FF8 /* MediaPlayer.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3EEEDB60197107C0006A9FF8 /* MediaPlayer.framework */; };
|
||||
5023811817EBBCAC00990C9B /* AppController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5023810817EBBCAC00990C9B /* AppController.mm */; };
|
||||
5023811917EBBCAC00990C9B /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 5023810917EBBCAC00990C9B /* Default-568h@2x.png */; };
|
||||
5023811A17EBBCAC00990C9B /* Default.png in Resources */ = {isa = PBXBuildFile; fileRef = 5023810A17EBBCAC00990C9B /* Default.png */; };
|
||||
|
@ -161,9 +162,6 @@
|
|||
C08D5D6718E567C6009071A4 /* tp.lua in Resources */ = {isa = PBXBuildFile; fileRef = C08D5D5418E567C6009071A4 /* tp.lua */; };
|
||||
C08D5D6818E567C6009071A4 /* url.lua in Resources */ = {isa = PBXBuildFile; fileRef = C08D5D5518E567C6009071A4 /* url.lua */; };
|
||||
C08D5D6918E567C6009071A4 /* url.lua in Resources */ = {isa = PBXBuildFile; fileRef = C08D5D5518E567C6009071A4 /* url.lua */; };
|
||||
C09BA7E718BC929700A85A3E /* WorkSpaceDialog.xib in Resources */ = {isa = PBXBuildFile; fileRef = C09BA7E418BC929700A85A3E /* WorkSpaceDialog.xib */; };
|
||||
C09BA7E818BC929700A85A3E /* WorkSpaceDialogController.mm in Sources */ = {isa = PBXBuildFile; fileRef = C09BA7E618BC929700A85A3E /* WorkSpaceDialogController.mm */; };
|
||||
C09BA7EE18BCA49600A85A3E /* NSAppSheetAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = C09BA7ED18BCA49600A85A3E /* NSAppSheetAdditions.m */; };
|
||||
D6B061351803AC000077942B /* CoreMotion.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D6B061341803AC000077942B /* CoreMotion.framework */; };
|
||||
F293B3CD15EB7BE500256477 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F293B3CC15EB7BE500256477 /* QuartzCore.framework */; };
|
||||
F293B3D115EB7BE500256477 /* OpenAL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F293B3D015EB7BE500256477 /* OpenAL.framework */; };
|
||||
|
@ -390,6 +388,7 @@
|
|||
3EB515551952865D006966AA /* wire_format_lite.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = wire_format_lite.cc; sourceTree = "<group>"; };
|
||||
3EB515561952865D006966AA /* wire_format_lite.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wire_format_lite.h; sourceTree = "<group>"; };
|
||||
3EB515571952865D006966AA /* wire_format_lite_inl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wire_format_lite_inl.h; sourceTree = "<group>"; };
|
||||
3EEEDB60197107C0006A9FF8 /* MediaPlayer.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MediaPlayer.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk/System/Library/Frameworks/MediaPlayer.framework; sourceTree = DEVELOPER_DIR; };
|
||||
5023810717EBBCAC00990C9B /* AppController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppController.h; sourceTree = "<group>"; };
|
||||
5023810817EBBCAC00990C9B /* AppController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AppController.mm; sourceTree = "<group>"; };
|
||||
5023810917EBBCAC00990C9B /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = "<group>"; };
|
||||
|
@ -471,11 +470,6 @@
|
|||
C08D5D5318E567C6009071A4 /* socket.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = socket.lua; path = "../../cocos2d-x/external/lua/luasocket/socket.lua"; sourceTree = "<group>"; };
|
||||
C08D5D5418E567C6009071A4 /* tp.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = tp.lua; path = "../../cocos2d-x/external/lua/luasocket/tp.lua"; sourceTree = "<group>"; };
|
||||
C08D5D5518E567C6009071A4 /* url.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = url.lua; path = "../../cocos2d-x/external/lua/luasocket/url.lua"; sourceTree = "<group>"; };
|
||||
C09BA7E418BC929700A85A3E /* WorkSpaceDialog.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = WorkSpaceDialog.xib; sourceTree = "<group>"; };
|
||||
C09BA7E518BC929700A85A3E /* WorkSpaceDialogController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WorkSpaceDialogController.h; sourceTree = "<group>"; };
|
||||
C09BA7E618BC929700A85A3E /* WorkSpaceDialogController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WorkSpaceDialogController.mm; sourceTree = "<group>"; };
|
||||
C09BA7EC18BCA49600A85A3E /* NSAppSheetAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSAppSheetAdditions.h; sourceTree = "<group>"; };
|
||||
C09BA7ED18BCA49600A85A3E /* NSAppSheetAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NSAppSheetAdditions.m; sourceTree = "<group>"; };
|
||||
D6B061341803AC000077942B /* CoreMotion.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreMotion.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/System/Library/Frameworks/CoreMotion.framework; sourceTree = DEVELOPER_DIR; };
|
||||
F293B3C815EB7BE500256477 /* HelloLua iOS.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "HelloLua iOS.app"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
F293B3CC15EB7BE500256477 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; };
|
||||
|
@ -518,6 +512,7 @@
|
|||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
3EEEDB61197107C0006A9FF8 /* MediaPlayer.framework in Frameworks */,
|
||||
C03781F618BF65B100FE4F13 /* libluabindings iOS.a in Frameworks */,
|
||||
15A8A4441834C43700142BE0 /* libchipmunk iOS.a in Frameworks */,
|
||||
15A8A4451834C43700142BE0 /* libcocos2dx iOS.a in Frameworks */,
|
||||
|
@ -689,11 +684,6 @@
|
|||
5023817117EBBE3400990C9B /* mac */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
C09BA7EC18BCA49600A85A3E /* NSAppSheetAdditions.h */,
|
||||
C09BA7ED18BCA49600A85A3E /* NSAppSheetAdditions.m */,
|
||||
C09BA7E418BC929700A85A3E /* WorkSpaceDialog.xib */,
|
||||
C09BA7E518BC929700A85A3E /* WorkSpaceDialogController.h */,
|
||||
C09BA7E618BC929700A85A3E /* WorkSpaceDialogController.mm */,
|
||||
5023817217EBBE3400990C9B /* Icon.icns */,
|
||||
C07828F418B4D72E00BD2287 /* main.m */,
|
||||
C07828F518B4D72E00BD2287 /* MainMenu.xib */,
|
||||
|
@ -780,6 +770,7 @@
|
|||
F293B3CB15EB7BE500256477 /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
3EEEDB60197107C0006A9FF8 /* MediaPlayer.framework */,
|
||||
3EB51526195187AF006966AA /* CFNetwork.framework */,
|
||||
15A8A4871834C90E00142BE0 /* libcurl.dylib */,
|
||||
D6B061341803AC000077942B /* CoreMotion.framework */,
|
||||
|
@ -1019,7 +1010,6 @@
|
|||
C08D5D6118E567C6009071A4 /* mime.lua in Resources */,
|
||||
C03781D418BF656A00FE4F13 /* Cocos2d.lua in Resources */,
|
||||
C03781BA18BF655400FE4F13 /* res in Resources */,
|
||||
C09BA7E718BC929700A85A3E /* WorkSpaceDialog.xib in Resources */,
|
||||
C03781BC18BF655400FE4F13 /* src in Resources */,
|
||||
C08D5D6918E567C6009071A4 /* url.lua in Resources */,
|
||||
C03781E218BF656A00FE4F13 /* DrawPrimitives.lua in Resources */,
|
||||
|
@ -1148,12 +1138,10 @@
|
|||
3EB515691952865D006966AA /* common.cc in Sources */,
|
||||
3EB515651952865D006966AA /* repeated_field.cc in Sources */,
|
||||
3EB5156B1952865D006966AA /* once.cc in Sources */,
|
||||
C09BA7EE18BCA49600A85A3E /* NSAppSheetAdditions.m in Sources */,
|
||||
3EB5155D1952865D006966AA /* coded_stream.cc in Sources */,
|
||||
C00FD4991938512100C6382D /* Portrait_png.cpp in Sources */,
|
||||
C06C3797191A1D1E00617BED /* ConfigParser.cpp in Sources */,
|
||||
3EB5156D1952865D006966AA /* stringprintf.cc in Sources */,
|
||||
C09BA7E818BC929700A85A3E /* WorkSpaceDialogController.mm in Sources */,
|
||||
C07828F818B4D72E00BD2287 /* main.m in Sources */,
|
||||
3EB515611952865D006966AA /* zero_copy_stream_impl_lite.cc in Sources */,
|
||||
3EB5156F1952865D006966AA /* wire_format_lite.cc in Sources */,
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="8.00">
|
||||
<data>
|
||||
<int key="IBDocument.SystemTarget">1060</int>
|
||||
<string key="IBDocument.SystemVersion">13C64</string>
|
||||
<string key="IBDocument.SystemVersion">13D65</string>
|
||||
<string key="IBDocument.InterfaceBuilderVersion">5056</string>
|
||||
<string key="IBDocument.AppKitVersion">1265.19</string>
|
||||
<string key="IBDocument.HIToolboxVersion">697.40</string>
|
||||
<string key="IBDocument.AppKitVersion">1265.20</string>
|
||||
<string key="IBDocument.HIToolboxVersion">698.00</string>
|
||||
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
|
||||
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string key="NS.object.0">5056</string>
|
||||
|
@ -164,14 +164,6 @@
|
|||
<object class="NSMenu" key="NSSubmenu" id="775420212">
|
||||
<string key="NSTitle">File</string>
|
||||
<array class="NSMutableArray" key="NSMenuItems">
|
||||
<object class="NSMenuItem" id="536376121">
|
||||
<reference key="NSMenu" ref="775420212"/>
|
||||
<string key="NSTitle">ChangeProject</string>
|
||||
<string key="NSKeyEquiv"/>
|
||||
<int key="NSMnemonicLoc">2147483647</int>
|
||||
<reference key="NSOnImage" ref="415077826"/>
|
||||
<reference key="NSMixedImage" ref="266121528"/>
|
||||
</object>
|
||||
<object class="NSMenuItem" id="908501198">
|
||||
<reference key="NSMenu" ref="775420212"/>
|
||||
<string key="NSTitle">Close</string>
|
||||
|
@ -299,6 +291,14 @@
|
|||
<reference key="NSOnImage" ref="415077826"/>
|
||||
<reference key="NSMixedImage" ref="266121528"/>
|
||||
</object>
|
||||
<object class="NSMenuItem" id="834755239">
|
||||
<reference key="NSMenu" ref="201383158"/>
|
||||
<string key="NSTitle">Keep Window Top</string>
|
||||
<string key="NSKeyEquiv"/>
|
||||
<int key="NSMnemonicLoc">2147483647</int>
|
||||
<reference key="NSOnImage" ref="415077826"/>
|
||||
<reference key="NSMixedImage" ref="266121528"/>
|
||||
</object>
|
||||
</array>
|
||||
</object>
|
||||
</object>
|
||||
|
@ -386,14 +386,6 @@
|
|||
</object>
|
||||
<string key="id">tSA-7z-LPk</string>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBActionConnection" key="connection">
|
||||
<string key="label">onChangeProject:</string>
|
||||
<reference key="source" ref="37508903"/>
|
||||
<reference key="destination" ref="536376121"/>
|
||||
</object>
|
||||
<string key="id">KV1-nK-nLn</string>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBActionConnection" key="connection">
|
||||
<string key="label">onFileClose:</string>
|
||||
|
@ -458,6 +450,14 @@
|
|||
</object>
|
||||
<string key="id">XXg-eJ-YSn</string>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBActionConnection" key="connection">
|
||||
<string key="label">onSetTop:</string>
|
||||
<reference key="source" ref="37508903"/>
|
||||
<reference key="destination" ref="834755239"/>
|
||||
</object>
|
||||
<string key="id">jvv-x1-KeN</string>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBOutletConnection" key="connection">
|
||||
<string key="label">menu</string>
|
||||
|
@ -594,16 +594,10 @@
|
|||
<string key="id">81</string>
|
||||
<reference key="object" ref="775420212"/>
|
||||
<array class="NSMutableArray" key="children">
|
||||
<reference ref="536376121"/>
|
||||
<reference ref="908501198"/>
|
||||
</array>
|
||||
<reference key="parent" ref="131023520"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<string key="id">UUd-nT-0Tr</string>
|
||||
<reference key="object" ref="536376121"/>
|
||||
<reference key="parent" ref="775420212"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<string key="id">611</string>
|
||||
<reference key="object" ref="908501198"/>
|
||||
|
@ -687,6 +681,7 @@
|
|||
<reference key="object" ref="201383158"/>
|
||||
<array class="NSMutableArray" key="children">
|
||||
<reference ref="675525235"/>
|
||||
<reference ref="834755239"/>
|
||||
</array>
|
||||
<reference key="parent" ref="638304486"/>
|
||||
</object>
|
||||
|
@ -718,6 +713,11 @@
|
|||
<reference key="object" ref="234942004"/>
|
||||
<reference key="parent" ref="0"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<string key="id">CXy-V7-NaY</string>
|
||||
<reference key="object" ref="834755239"/>
|
||||
<reference key="parent" ref="201383158"/>
|
||||
</object>
|
||||
</array>
|
||||
</object>
|
||||
<dictionary class="NSMutableDictionary" key="flattenedProperties">
|
||||
|
@ -761,6 +761,7 @@
|
|||
<boolean value="NO" key="81.showNotes"/>
|
||||
<string key="83.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<boolean value="NO" key="83.showNotes"/>
|
||||
<string key="CXy-V7-NaY.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string key="GS6-Lb-ftA.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<boolean value="NO" key="GS6-Lb-ftA.showNotes"/>
|
||||
<string key="GU5-eI-OTq.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
|
@ -777,8 +778,6 @@
|
|||
<boolean value="NO" key="QB8-6D-hAr.showNotes"/>
|
||||
<string key="TOj-vg-cDm.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<boolean value="NO" key="TOj-vg-cDm.showNotes"/>
|
||||
<string key="UUd-nT-0Tr.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<boolean value="NO" key="UUd-nT-0Tr.showNotes"/>
|
||||
<string key="XG8-CE-veT.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<boolean value="NO" key="XG8-CE-veT.showNotes"/>
|
||||
<string key="YN2-V8-ty0.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
|
@ -801,7 +800,68 @@
|
|||
<dictionary class="NSMutableDictionary" key="localizations"/>
|
||||
<nil key="sourceID"/>
|
||||
</object>
|
||||
<object class="IBClassDescriber" key="IBDocument.Classes"/>
|
||||
<object class="IBClassDescriber" key="IBDocument.Classes">
|
||||
<array class="NSMutableArray" key="referencedPartialClassDescriptions">
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">AppController</string>
|
||||
<string key="superclassName">NSObject</string>
|
||||
<dictionary class="NSMutableDictionary" key="actions">
|
||||
<string key="onFileClose:">id</string>
|
||||
<string key="onRelaunch:">id</string>
|
||||
<string key="onScreenLandscape:">id</string>
|
||||
<string key="onScreenPortait:">id</string>
|
||||
<string key="onScreenZoomOut:">id</string>
|
||||
<string key="onSetTop:">id</string>
|
||||
<string key="onViewChangeFrameSize:">id</string>
|
||||
</dictionary>
|
||||
<dictionary class="NSMutableDictionary" key="actionInfosByName">
|
||||
<object class="IBActionInfo" key="onFileClose:">
|
||||
<string key="name">onFileClose:</string>
|
||||
<string key="candidateClassName">id</string>
|
||||
</object>
|
||||
<object class="IBActionInfo" key="onRelaunch:">
|
||||
<string key="name">onRelaunch:</string>
|
||||
<string key="candidateClassName">id</string>
|
||||
</object>
|
||||
<object class="IBActionInfo" key="onScreenLandscape:">
|
||||
<string key="name">onScreenLandscape:</string>
|
||||
<string key="candidateClassName">id</string>
|
||||
</object>
|
||||
<object class="IBActionInfo" key="onScreenPortait:">
|
||||
<string key="name">onScreenPortait:</string>
|
||||
<string key="candidateClassName">id</string>
|
||||
</object>
|
||||
<object class="IBActionInfo" key="onScreenZoomOut:">
|
||||
<string key="name">onScreenZoomOut:</string>
|
||||
<string key="candidateClassName">id</string>
|
||||
</object>
|
||||
<object class="IBActionInfo" key="onSetTop:">
|
||||
<string key="name">onSetTop:</string>
|
||||
<string key="candidateClassName">id</string>
|
||||
</object>
|
||||
<object class="IBActionInfo" key="onViewChangeFrameSize:">
|
||||
<string key="name">onViewChangeFrameSize:</string>
|
||||
<string key="candidateClassName">id</string>
|
||||
</object>
|
||||
</dictionary>
|
||||
<object class="NSMutableDictionary" key="outlets">
|
||||
<string key="NS.key.0">menu</string>
|
||||
<string key="NS.object.0">NSMenu</string>
|
||||
</object>
|
||||
<object class="NSMutableDictionary" key="toOneOutletInfosByName">
|
||||
<string key="NS.key.0">menu</string>
|
||||
<object class="IBToOneOutletInfo" key="NS.object.0">
|
||||
<string key="name">menu</string>
|
||||
<string key="candidateClassName">NSMenu</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBProjectSource</string>
|
||||
<string key="minorKey">./Classes/AppController.h</string>
|
||||
</object>
|
||||
</object>
|
||||
</array>
|
||||
</object>
|
||||
<int key="IBDocument.localizationMode">0</int>
|
||||
<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaFramework</string>
|
||||
<bool key="IBDocument.previouslyAttemptedUpgradeToXcode5">YES</bool>
|
||||
|
@ -811,7 +871,7 @@
|
|||
</object>
|
||||
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencyDefaults">
|
||||
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.macosx</string>
|
||||
<real value="1070" key="NS.object.0"/>
|
||||
<real value="1080" key="NS.object.0"/>
|
||||
</object>
|
||||
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies">
|
||||
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3</string>
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
@interface NSApplication (SheetAdditions)
|
||||
|
||||
- (void)beginSheet:(NSWindow *)sheet modalForWindow:(NSWindow *)docWindow didEndBlock:(void (^)(NSInteger returnCode))block;
|
||||
|
||||
@end
|
|
@ -1,22 +0,0 @@
|
|||
|
||||
#import "NSAppSheetAdditions.h"
|
||||
|
||||
@implementation NSApplication (SheetAdditions)
|
||||
|
||||
- (void)beginSheet:(NSWindow *)sheet modalForWindow:(NSWindow *)docWindow didEndBlock:(void (^)(NSInteger returnCode))block
|
||||
{
|
||||
[self beginSheet:sheet
|
||||
modalForWindow:docWindow
|
||||
modalDelegate:self
|
||||
didEndSelector:@selector(my_blockSheetDidEnd:returnCode:contextInfo:)
|
||||
contextInfo:Block_copy(block)];
|
||||
}
|
||||
|
||||
- (void)my_blockSheetDidEnd:(NSWindow *)sheet returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo
|
||||
{
|
||||
void (^block)(NSInteger returnCode) = contextInfo;
|
||||
block(returnCode);
|
||||
Block_release(block);
|
||||
}
|
||||
|
||||
@end
|
|
@ -41,7 +41,7 @@ void createSimulator(const char* viewName, float width, float height,bool isLand
|
|||
@property (nonatomic, assign) IBOutlet NSMenu* menu;
|
||||
|
||||
|
||||
- (IBAction) onChangeProject:(id)sender;
|
||||
- (IBAction) onSetTop:(id)sender;
|
||||
- (IBAction) onFileClose:(id)sender;
|
||||
- (IBAction) onScreenPortait:(id)sender;
|
||||
- (IBAction) onScreenLandscape:(id)sender;
|
||||
|
|
|
@ -22,16 +22,13 @@
|
|||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
#import "SimulatorApp.h"
|
||||
#import "WorkSpaceDialogController.h"
|
||||
#import "NSAppSheetAdditions.h"
|
||||
|
||||
#include <sys/stat.h>
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#import "SimulatorApp.h"
|
||||
#include "AppDelegate.h"
|
||||
#include "glfw3.h"
|
||||
#include "glfw3native.h"
|
||||
|
@ -43,6 +40,7 @@
|
|||
using namespace cocos2d;
|
||||
|
||||
bool g_landscape = false;
|
||||
bool g_windTop = true;
|
||||
cocos2d::Size g_screenSize;
|
||||
GLView* g_eglView = nullptr;
|
||||
|
||||
|
@ -104,7 +102,7 @@ std::string getCurAppPath(void)
|
|||
width = height;
|
||||
height = tmpvalue;
|
||||
}
|
||||
|
||||
g_windTop = true;
|
||||
g_eglView = GLView::createWithRect([viewName cStringUsingEncoding:NSUTF8StringEncoding],cocos2d::Rect(0.0f,0.0f,width,height),frameZoomFactor);
|
||||
auto director = Director::getInstance();
|
||||
director->setOpenGLView(g_eglView);
|
||||
|
@ -115,7 +113,7 @@ std::string getCurAppPath(void)
|
|||
[self createViewMenu];
|
||||
[self updateMenu];
|
||||
[window center];
|
||||
|
||||
|
||||
[window becomeFirstResponder];
|
||||
[window makeKeyAndOrderFront:self];
|
||||
}
|
||||
|
@ -172,6 +170,18 @@ void createSimulator(const char* viewName, float width, float height,bool isLand
|
|||
[itemPortait setState:NSOnState];
|
||||
[itemLandscape setState:NSOffState];
|
||||
}
|
||||
|
||||
NSMenu *menuControl = [[[window menu] itemWithTitle:@"Control"] submenu];
|
||||
NSMenuItem *itemTop = [menuControl itemWithTitle:@"Keep Window Top"];
|
||||
if (g_windTop) {
|
||||
[window setLevel:NSFloatingWindowLevel];
|
||||
[itemTop setState:NSOnState];
|
||||
}
|
||||
else
|
||||
{
|
||||
[window setLevel:NSNormalWindowLevel];
|
||||
[itemTop setState:NSOffState];
|
||||
}
|
||||
|
||||
int scale = g_eglView->getFrameZoomFactor()*100;
|
||||
|
||||
|
@ -223,7 +233,6 @@ void createSimulator(const char* viewName, float width, float height,bool isLand
|
|||
}
|
||||
|
||||
|
||||
//[window setTitle:[NSString stringWithFormat:@"quick-x-player (%0.0f%%)", projectConfig.getFrameScale() * 100]];
|
||||
}
|
||||
|
||||
|
||||
|
@ -261,17 +270,10 @@ void createSimulator(const char* viewName, float width, float height,bool isLand
|
|||
[[NSRunningApplication currentApplication] terminate];
|
||||
}
|
||||
|
||||
- (IBAction) onChangeProject:(id)sender
|
||||
- (IBAction) onSetTop:(id)sender
|
||||
{
|
||||
|
||||
WorkSpaceDialogController *controller = [[WorkSpaceDialogController alloc] initWithWindowNibName:@"WorkSpaceDialog"];
|
||||
[NSApp beginSheet:controller.window modalForWindow:window didEndBlock:^(NSInteger returnCode) {
|
||||
if (returnCode == NSRunStoppedResponse)
|
||||
{
|
||||
CCLOG("1111");
|
||||
}
|
||||
[controller release];
|
||||
}];
|
||||
g_windTop = !g_windTop;
|
||||
[self updateMenu];
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,846 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="8.00">
|
||||
<data>
|
||||
<int key="IBDocument.SystemTarget">1070</int>
|
||||
<string key="IBDocument.SystemVersion">13C64</string>
|
||||
<string key="IBDocument.InterfaceBuilderVersion">5056</string>
|
||||
<string key="IBDocument.AppKitVersion">1265.19</string>
|
||||
<string key="IBDocument.HIToolboxVersion">697.40</string>
|
||||
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
|
||||
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string key="NS.object.0">5056</string>
|
||||
</object>
|
||||
<array key="IBDocument.IntegratedClassDependencies">
|
||||
<string>IBNSLayoutConstraint</string>
|
||||
<string>NSButton</string>
|
||||
<string>NSButtonCell</string>
|
||||
<string>NSCustomObject</string>
|
||||
<string>NSTextField</string>
|
||||
<string>NSTextFieldCell</string>
|
||||
<string>NSView</string>
|
||||
<string>NSWindowTemplate</string>
|
||||
</array>
|
||||
<array key="IBDocument.PluginDependencies">
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
</array>
|
||||
<object class="NSMutableDictionary" key="IBDocument.Metadata">
|
||||
<string key="NS.key.0">PluginDependencyRecalculationVersion</string>
|
||||
<integer value="1" key="NS.object.0"/>
|
||||
</object>
|
||||
<array class="NSMutableArray" key="IBDocument.RootObjects" id="172117012">
|
||||
<object class="NSCustomObject" id="544304869">
|
||||
<string key="NSClassName">WorkSpaceDialogController</string>
|
||||
</object>
|
||||
<object class="NSCustomObject" id="678778463">
|
||||
<string key="NSClassName">FirstResponder</string>
|
||||
</object>
|
||||
<object class="NSCustomObject" id="805545953">
|
||||
<string key="NSClassName">NSApplication</string>
|
||||
</object>
|
||||
<object class="NSWindowTemplate" id="417919685">
|
||||
<int key="NSWindowStyleMask">3</int>
|
||||
<int key="NSWindowBacking">2</int>
|
||||
<string key="NSWindowRect">{{196, 240}, {650, 150}}</string>
|
||||
<int key="NSWTFlags">544736256</int>
|
||||
<string key="NSWindowTitle">Change Project</string>
|
||||
<string key="NSWindowClass">NSWindow</string>
|
||||
<nil key="NSViewClass"/>
|
||||
<nil key="NSUserInterfaceItemIdentifier"/>
|
||||
<object class="NSView" key="NSWindowView" id="773221745">
|
||||
<reference key="NSNextResponder"/>
|
||||
<int key="NSvFlags">256</int>
|
||||
<array class="NSMutableArray" key="NSSubviews">
|
||||
<object class="NSTextField" id="626749776">
|
||||
<reference key="NSNextResponder" ref="773221745"/>
|
||||
<int key="NSvFlags">268</int>
|
||||
<string key="NSFrame">{{17, 113}, {626, 17}}</string>
|
||||
<reference key="NSSuperview" ref="773221745"/>
|
||||
<reference key="NSWindow"/>
|
||||
<bool key="NSEnabled">YES</bool>
|
||||
<object class="NSTextFieldCell" key="NSCell" id="419795268">
|
||||
<int key="NSCellFlags">68157504</int>
|
||||
<int key="NSCellFlags2">272630784</int>
|
||||
<string key="NSContents">Choose Project Directory:</string>
|
||||
<object class="NSFont" key="NSSupport" id="957026095">
|
||||
<string key="NSName">.LucidaGrandeUI</string>
|
||||
<double key="NSSize">13</double>
|
||||
<int key="NSfFlags">1044</int>
|
||||
</object>
|
||||
<reference key="NSControlView" ref="626749776"/>
|
||||
<object class="NSColor" key="NSBackgroundColor">
|
||||
<int key="NSColorSpace">6</int>
|
||||
<string key="NSCatalogName">System</string>
|
||||
<string key="NSColorName">controlColor</string>
|
||||
<object class="NSColor" key="NSColor">
|
||||
<int key="NSColorSpace">3</int>
|
||||
<bytes key="NSWhite">MC42NjY2NjY2NjY3AA</bytes>
|
||||
</object>
|
||||
</object>
|
||||
<object class="NSColor" key="NSTextColor">
|
||||
<int key="NSColorSpace">6</int>
|
||||
<string key="NSCatalogName">System</string>
|
||||
<string key="NSColorName">controlTextColor</string>
|
||||
<object class="NSColor" key="NSColor" id="349380676">
|
||||
<int key="NSColorSpace">3</int>
|
||||
<bytes key="NSWhite">MAA</bytes>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<bool key="NSAllowsLogicalLayoutDirection">NO</bool>
|
||||
<int key="NSTextFieldAlignmentRectInsetsVersion">1</int>
|
||||
</object>
|
||||
<object class="NSTextField" id="664907665">
|
||||
<reference key="NSNextResponder" ref="773221745"/>
|
||||
<int key="NSvFlags">268</int>
|
||||
<string key="NSFrame">{{20, 83}, {516, 22}}</string>
|
||||
<reference key="NSSuperview" ref="773221745"/>
|
||||
<reference key="NSWindow"/>
|
||||
<bool key="NSEnabled">YES</bool>
|
||||
<object class="NSTextFieldCell" key="NSCell" id="582949244">
|
||||
<int key="NSCellFlags">-1804599231</int>
|
||||
<int key="NSCellFlags2">272630848</int>
|
||||
<string key="NSContents"/>
|
||||
<reference key="NSSupport" ref="957026095"/>
|
||||
<reference key="NSControlView" ref="664907665"/>
|
||||
<bool key="NSDrawsBackground">YES</bool>
|
||||
<object class="NSColor" key="NSBackgroundColor">
|
||||
<int key="NSColorSpace">6</int>
|
||||
<string key="NSCatalogName">System</string>
|
||||
<string key="NSColorName">textBackgroundColor</string>
|
||||
<object class="NSColor" key="NSColor">
|
||||
<int key="NSColorSpace">3</int>
|
||||
<bytes key="NSWhite">MQA</bytes>
|
||||
</object>
|
||||
</object>
|
||||
<object class="NSColor" key="NSTextColor">
|
||||
<int key="NSColorSpace">6</int>
|
||||
<string key="NSCatalogName">System</string>
|
||||
<string key="NSColorName">textColor</string>
|
||||
<reference key="NSColor" ref="349380676"/>
|
||||
</object>
|
||||
</object>
|
||||
<bool key="NSAllowsLogicalLayoutDirection">NO</bool>
|
||||
<int key="NSTextFieldAlignmentRectInsetsVersion">1</int>
|
||||
</object>
|
||||
<object class="NSButton" id="139131928">
|
||||
<reference key="NSNextResponder" ref="773221745"/>
|
||||
<int key="NSvFlags">268</int>
|
||||
<string key="NSFrame">{{538, 77}, {108, 32}}</string>
|
||||
<reference key="NSSuperview" ref="773221745"/>
|
||||
<reference key="NSWindow"/>
|
||||
<string key="NSHuggingPriority">{250, 750}</string>
|
||||
<bool key="NSEnabled">YES</bool>
|
||||
<object class="NSButtonCell" key="NSCell" id="570067231">
|
||||
<int key="NSCellFlags">67108864</int>
|
||||
<int key="NSCellFlags2">134217728</int>
|
||||
<string key="NSContents">Select...</string>
|
||||
<reference key="NSSupport" ref="957026095"/>
|
||||
<reference key="NSControlView" ref="139131928"/>
|
||||
<int key="NSButtonFlags">-2038284288</int>
|
||||
<int key="NSButtonFlags2">129</int>
|
||||
<object class="NSFont" key="NSAlternateImage" id="360343385">
|
||||
<string key="NSName">.LucidaGrandeUI</string>
|
||||
<double key="NSSize">13</double>
|
||||
<int key="NSfFlags">16</int>
|
||||
</object>
|
||||
<string key="NSAlternateContents"/>
|
||||
<string key="NSKeyEquivalent"/>
|
||||
<int key="NSPeriodicDelay">400</int>
|
||||
<int key="NSPeriodicInterval">75</int>
|
||||
</object>
|
||||
<bool key="NSAllowsLogicalLayoutDirection">NO</bool>
|
||||
</object>
|
||||
<object class="NSButton" id="610415164">
|
||||
<reference key="NSNextResponder" ref="773221745"/>
|
||||
<int key="NSvFlags">268</int>
|
||||
<string key="NSFrame">{{538, 22}, {109, 32}}</string>
|
||||
<reference key="NSSuperview" ref="773221745"/>
|
||||
<reference key="NSWindow"/>
|
||||
<string key="NSHuggingPriority">{250, 750}</string>
|
||||
<bool key="NSEnabled">YES</bool>
|
||||
<object class="NSButtonCell" key="NSCell" id="266810869">
|
||||
<int key="NSCellFlags">67108864</int>
|
||||
<int key="NSCellFlags2">134217728</int>
|
||||
<string key="NSContents">Open Project</string>
|
||||
<reference key="NSSupport" ref="957026095"/>
|
||||
<reference key="NSControlView" ref="610415164"/>
|
||||
<int key="NSButtonFlags">-2038284288</int>
|
||||
<int key="NSButtonFlags2">129</int>
|
||||
<reference key="NSAlternateImage" ref="360343385"/>
|
||||
<string key="NSAlternateContents"/>
|
||||
<string key="NSKeyEquivalent"/>
|
||||
<int key="NSPeriodicDelay">400</int>
|
||||
<int key="NSPeriodicInterval">75</int>
|
||||
</object>
|
||||
<bool key="NSAllowsLogicalLayoutDirection">NO</bool>
|
||||
</object>
|
||||
<object class="NSButton" id="183844150">
|
||||
<reference key="NSNextResponder" ref="773221745"/>
|
||||
<int key="NSvFlags">268</int>
|
||||
<string key="NSFrame">{{13, 32}, {82, 32}}</string>
|
||||
<reference key="NSSuperview" ref="773221745"/>
|
||||
<reference key="NSWindow"/>
|
||||
<string key="NSHuggingPriority">{250, 750}</string>
|
||||
<bool key="NSEnabled">YES</bool>
|
||||
<object class="NSButtonCell" key="NSCell" id="721886683">
|
||||
<int key="NSCellFlags">67108864</int>
|
||||
<int key="NSCellFlags2">134217728</int>
|
||||
<string key="NSContents">Cancel</string>
|
||||
<reference key="NSSupport" ref="957026095"/>
|
||||
<reference key="NSControlView" ref="183844150"/>
|
||||
<int key="NSButtonFlags">-2038284288</int>
|
||||
<int key="NSButtonFlags2">129</int>
|
||||
<reference key="NSAlternateImage" ref="360343385"/>
|
||||
<string key="NSAlternateContents"/>
|
||||
<string type="base64-UTF8" key="NSKeyEquivalent">Gw</string>
|
||||
<int key="NSPeriodicDelay">400</int>
|
||||
<int key="NSPeriodicInterval">75</int>
|
||||
</object>
|
||||
<bool key="NSAllowsLogicalLayoutDirection">NO</bool>
|
||||
</object>
|
||||
</array>
|
||||
<string key="NSFrameSize">{650, 150}</string>
|
||||
<reference key="NSSuperview"/>
|
||||
<reference key="NSWindow"/>
|
||||
</object>
|
||||
<string key="NSScreenRect">{{0, 0}, {1920, 1058}}</string>
|
||||
<string key="NSMaxSize">{10000000000000, 10000000000000}</string>
|
||||
<bool key="NSWindowIsRestorable">NO</bool>
|
||||
</object>
|
||||
</array>
|
||||
<object class="IBObjectContainer" key="IBDocument.Objects">
|
||||
<bool key="usesAutoincrementingIDs">NO</bool>
|
||||
<array class="NSMutableArray" key="connectionRecords">
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBOutletConnection" key="connection">
|
||||
<string key="label">textFieldProjectDirectory</string>
|
||||
<reference key="source" ref="544304869"/>
|
||||
<reference key="destination" ref="664907665"/>
|
||||
</object>
|
||||
<string key="id">307</string>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBOutletConnection" key="connection">
|
||||
<string key="label">window</string>
|
||||
<reference key="source" ref="544304869"/>
|
||||
<reference key="destination" ref="417919685"/>
|
||||
</object>
|
||||
<string key="id">308</string>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBActionConnection" key="connection">
|
||||
<string key="label">browseProjectDirectory:</string>
|
||||
<reference key="source" ref="544304869"/>
|
||||
<reference key="destination" ref="139131928"/>
|
||||
</object>
|
||||
<string key="id">315</string>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBActionConnection" key="connection">
|
||||
<string key="label">onOpenProject:</string>
|
||||
<reference key="source" ref="544304869"/>
|
||||
<reference key="destination" ref="610415164"/>
|
||||
</object>
|
||||
<string key="id">OsS-1W-RIl</string>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBActionConnection" key="connection">
|
||||
<string key="label">onCancel:</string>
|
||||
<reference key="source" ref="544304869"/>
|
||||
<reference key="destination" ref="183844150"/>
|
||||
</object>
|
||||
<string key="id">NeH-n8-xBM</string>
|
||||
</object>
|
||||
</array>
|
||||
<object class="IBMutableOrderedSet" key="objectRecords">
|
||||
<array key="orderedObjects">
|
||||
<object class="IBObjectRecord">
|
||||
<string key="id">0</string>
|
||||
<array key="object" id="0"/>
|
||||
<reference key="children" ref="172117012"/>
|
||||
<nil key="parent"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<string key="id">-2</string>
|
||||
<reference key="object" ref="544304869"/>
|
||||
<reference key="parent" ref="0"/>
|
||||
<string key="objectName">File's Owner</string>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<string key="id">-1</string>
|
||||
<reference key="object" ref="678778463"/>
|
||||
<reference key="parent" ref="0"/>
|
||||
<string key="objectName">First Responder</string>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<string key="id">-3</string>
|
||||
<reference key="object" ref="805545953"/>
|
||||
<reference key="parent" ref="0"/>
|
||||
<string key="objectName">Application</string>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<string key="id">1</string>
|
||||
<reference key="object" ref="417919685"/>
|
||||
<array class="NSMutableArray" key="children">
|
||||
<reference ref="773221745"/>
|
||||
</array>
|
||||
<reference key="parent" ref="0"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<string key="id">2</string>
|
||||
<reference key="object" ref="773221745"/>
|
||||
<array class="NSMutableArray" key="children">
|
||||
<reference ref="626749776"/>
|
||||
<reference ref="664907665"/>
|
||||
<reference ref="139131928"/>
|
||||
<reference ref="610415164"/>
|
||||
<reference ref="183844150"/>
|
||||
<object class="IBNSLayoutConstraint" id="512692197">
|
||||
<reference key="firstItem" ref="610415164"/>
|
||||
<int key="firstAttribute">9</int>
|
||||
<int key="relation">0</int>
|
||||
<reference key="secondItem" ref="139131928"/>
|
||||
<int key="secondAttribute">9</int>
|
||||
<float key="multiplier">1</float>
|
||||
<string key="multiplierString">1</string>
|
||||
<object class="IBLayoutConstant" key="constant">
|
||||
<double key="value">0.0</double>
|
||||
</object>
|
||||
<float key="priority">1000</float>
|
||||
<reference key="containingView" ref="773221745"/>
|
||||
<int key="scoringType">6</int>
|
||||
<float key="scoringTypeFloat">24</float>
|
||||
<int key="contentType">2</int>
|
||||
<bool key="placeholder">NO</bool>
|
||||
</object>
|
||||
<object class="IBNSLayoutConstraint" id="243708327">
|
||||
<reference key="firstItem" ref="773221745"/>
|
||||
<int key="firstAttribute">4</int>
|
||||
<int key="relation">0</int>
|
||||
<reference key="secondItem" ref="610415164"/>
|
||||
<int key="secondAttribute">4</int>
|
||||
<float key="multiplier">1</float>
|
||||
<string key="multiplierString">1</string>
|
||||
<object class="IBLayoutConstant" key="constant">
|
||||
<double key="value">29</double>
|
||||
</object>
|
||||
<float key="priority">1000</float>
|
||||
<reference key="containingView" ref="773221745"/>
|
||||
<int key="scoringType">3</int>
|
||||
<float key="scoringTypeFloat">9</float>
|
||||
<int key="contentType">3</int>
|
||||
<bool key="placeholder">NO</bool>
|
||||
</object>
|
||||
<object class="IBNSLayoutConstraint" id="412902897">
|
||||
<reference key="firstItem" ref="610415164"/>
|
||||
<int key="firstAttribute">6</int>
|
||||
<int key="relation">0</int>
|
||||
<reference key="secondItem" ref="626749776"/>
|
||||
<int key="secondAttribute">6</int>
|
||||
<float key="multiplier">1</float>
|
||||
<string key="multiplierString">1</string>
|
||||
<object class="IBLayoutConstant" key="constant">
|
||||
<double key="value">0.0</double>
|
||||
</object>
|
||||
<float key="priority">1000</float>
|
||||
<reference key="containingView" ref="773221745"/>
|
||||
<int key="scoringType">6</int>
|
||||
<float key="scoringTypeFloat">24</float>
|
||||
<int key="contentType">2</int>
|
||||
<bool key="placeholder">NO</bool>
|
||||
</object>
|
||||
<object class="IBNSLayoutConstraint" id="822012404">
|
||||
<reference key="firstItem" ref="139131928"/>
|
||||
<int key="firstAttribute">3</int>
|
||||
<int key="relation">0</int>
|
||||
<reference key="secondItem" ref="626749776"/>
|
||||
<int key="secondAttribute">4</int>
|
||||
<float key="multiplier">1</float>
|
||||
<string key="multiplierString">1</string>
|
||||
<object class="IBNSLayoutSymbolicConstant" key="constant">
|
||||
<double key="value">8</double>
|
||||
</object>
|
||||
<float key="priority">1000</float>
|
||||
<reference key="containingView" ref="773221745"/>
|
||||
<int key="scoringType">6</int>
|
||||
<float key="scoringTypeFloat">24</float>
|
||||
<int key="contentType">3</int>
|
||||
<bool key="placeholder">NO</bool>
|
||||
</object>
|
||||
<object class="IBNSLayoutConstraint" id="962361603">
|
||||
<reference key="firstItem" ref="139131928"/>
|
||||
<int key="firstAttribute">5</int>
|
||||
<int key="relation">0</int>
|
||||
<reference key="secondItem" ref="610415164"/>
|
||||
<int key="secondAttribute">5</int>
|
||||
<float key="multiplier">1</float>
|
||||
<string key="multiplierString">1</string>
|
||||
<object class="IBLayoutConstant" key="constant">
|
||||
<double key="value">0.0</double>
|
||||
</object>
|
||||
<float key="priority">1000</float>
|
||||
<reference key="containingView" ref="773221745"/>
|
||||
<int key="scoringType">6</int>
|
||||
<float key="scoringTypeFloat">24</float>
|
||||
<int key="contentType">2</int>
|
||||
<bool key="placeholder">NO</bool>
|
||||
</object>
|
||||
<object class="IBNSLayoutConstraint" id="955240815">
|
||||
<reference key="firstItem" ref="139131928"/>
|
||||
<int key="firstAttribute">5</int>
|
||||
<int key="relation">0</int>
|
||||
<reference key="secondItem" ref="664907665"/>
|
||||
<int key="secondAttribute">6</int>
|
||||
<float key="multiplier">1</float>
|
||||
<string key="multiplierString">1</string>
|
||||
<object class="IBNSLayoutSymbolicConstant" key="constant">
|
||||
<double key="value">8</double>
|
||||
</object>
|
||||
<float key="priority">1000</float>
|
||||
<reference key="containingView" ref="773221745"/>
|
||||
<int key="scoringType">6</int>
|
||||
<float key="scoringTypeFloat">24</float>
|
||||
<int key="contentType">3</int>
|
||||
<bool key="placeholder">NO</bool>
|
||||
</object>
|
||||
<object class="IBNSLayoutConstraint" id="898762975">
|
||||
<reference key="firstItem" ref="773221745"/>
|
||||
<int key="firstAttribute">4</int>
|
||||
<int key="relation">0</int>
|
||||
<reference key="secondItem" ref="183844150"/>
|
||||
<int key="secondAttribute">4</int>
|
||||
<float key="multiplier">1</float>
|
||||
<string key="multiplierString">1</string>
|
||||
<object class="IBLayoutConstant" key="constant">
|
||||
<double key="value">39</double>
|
||||
</object>
|
||||
<float key="priority">1000</float>
|
||||
<reference key="containingView" ref="773221745"/>
|
||||
<int key="scoringType">3</int>
|
||||
<float key="scoringTypeFloat">9</float>
|
||||
<int key="contentType">3</int>
|
||||
<bool key="placeholder">NO</bool>
|
||||
</object>
|
||||
<object class="IBNSLayoutConstraint" id="870995293">
|
||||
<reference key="firstItem" ref="664907665"/>
|
||||
<int key="firstAttribute">5</int>
|
||||
<int key="relation">0</int>
|
||||
<reference key="secondItem" ref="773221745"/>
|
||||
<int key="secondAttribute">5</int>
|
||||
<float key="multiplier">1</float>
|
||||
<string key="multiplierString">1</string>
|
||||
<object class="IBNSLayoutSymbolicConstant" key="constant">
|
||||
<double key="value">20</double>
|
||||
</object>
|
||||
<float key="priority">1000</float>
|
||||
<reference key="containingView" ref="773221745"/>
|
||||
<int key="scoringType">8</int>
|
||||
<float key="scoringTypeFloat">23</float>
|
||||
<int key="contentType">3</int>
|
||||
<bool key="placeholder">NO</bool>
|
||||
</object>
|
||||
<object class="IBNSLayoutConstraint" id="529242108">
|
||||
<reference key="firstItem" ref="664907665"/>
|
||||
<int key="firstAttribute">3</int>
|
||||
<int key="relation">0</int>
|
||||
<reference key="secondItem" ref="626749776"/>
|
||||
<int key="secondAttribute">4</int>
|
||||
<float key="multiplier">1</float>
|
||||
<string key="multiplierString">1</string>
|
||||
<object class="IBNSLayoutSymbolicConstant" key="constant">
|
||||
<double key="value">8</double>
|
||||
</object>
|
||||
<float key="priority">1000</float>
|
||||
<reference key="containingView" ref="773221745"/>
|
||||
<int key="scoringType">6</int>
|
||||
<float key="scoringTypeFloat">24</float>
|
||||
<int key="contentType">3</int>
|
||||
<bool key="placeholder">NO</bool>
|
||||
</object>
|
||||
<object class="IBNSLayoutConstraint" id="780789773">
|
||||
<reference key="firstItem" ref="626749776"/>
|
||||
<int key="firstAttribute">5</int>
|
||||
<int key="relation">0</int>
|
||||
<reference key="secondItem" ref="183844150"/>
|
||||
<int key="secondAttribute">5</int>
|
||||
<float key="multiplier">1</float>
|
||||
<string key="multiplierString">1</string>
|
||||
<object class="IBLayoutConstant" key="constant">
|
||||
<double key="value">0.0</double>
|
||||
</object>
|
||||
<float key="priority">1000</float>
|
||||
<reference key="containingView" ref="773221745"/>
|
||||
<int key="scoringType">6</int>
|
||||
<float key="scoringTypeFloat">24</float>
|
||||
<int key="contentType">2</int>
|
||||
<bool key="placeholder">NO</bool>
|
||||
</object>
|
||||
<object class="IBNSLayoutConstraint" id="544230405">
|
||||
<reference key="firstItem" ref="626749776"/>
|
||||
<int key="firstAttribute">3</int>
|
||||
<int key="relation">0</int>
|
||||
<reference key="secondItem" ref="773221745"/>
|
||||
<int key="secondAttribute">3</int>
|
||||
<float key="multiplier">1</float>
|
||||
<string key="multiplierString">1</string>
|
||||
<object class="IBNSLayoutSymbolicConstant" key="constant">
|
||||
<double key="value">20</double>
|
||||
</object>
|
||||
<float key="priority">1000</float>
|
||||
<reference key="containingView" ref="773221745"/>
|
||||
<int key="scoringType">8</int>
|
||||
<float key="scoringTypeFloat">23</float>
|
||||
<int key="contentType">3</int>
|
||||
<bool key="placeholder">NO</bool>
|
||||
</object>
|
||||
</array>
|
||||
<reference key="parent" ref="417919685"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<string key="id">3</string>
|
||||
<reference key="object" ref="626749776"/>
|
||||
<array class="NSMutableArray" key="children">
|
||||
<reference ref="419795268"/>
|
||||
<object class="IBNSLayoutConstraint" id="301435117">
|
||||
<reference key="firstItem" ref="626749776"/>
|
||||
<int key="firstAttribute">7</int>
|
||||
<int key="relation">0</int>
|
||||
<nil key="secondItem"/>
|
||||
<int key="secondAttribute">0</int>
|
||||
<float key="multiplier">1</float>
|
||||
<string key="multiplierString">1</string>
|
||||
<object class="IBLayoutConstant" key="constant">
|
||||
<double key="value">622</double>
|
||||
</object>
|
||||
<float key="priority">1000</float>
|
||||
<reference key="containingView" ref="626749776"/>
|
||||
<int key="scoringType">3</int>
|
||||
<float key="scoringTypeFloat">9</float>
|
||||
<int key="contentType">1</int>
|
||||
<bool key="placeholder">NO</bool>
|
||||
</object>
|
||||
</array>
|
||||
<reference key="parent" ref="773221745"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<string key="id">4</string>
|
||||
<reference key="object" ref="419795268"/>
|
||||
<reference key="parent" ref="626749776"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<string key="id">9</string>
|
||||
<reference key="object" ref="664907665"/>
|
||||
<array class="NSMutableArray" key="children">
|
||||
<reference ref="582949244"/>
|
||||
<object class="IBNSLayoutConstraint" id="134641759">
|
||||
<reference key="firstItem" ref="664907665"/>
|
||||
<int key="firstAttribute">7</int>
|
||||
<int key="relation">0</int>
|
||||
<nil key="secondItem"/>
|
||||
<int key="secondAttribute">0</int>
|
||||
<float key="multiplier">1</float>
|
||||
<string key="multiplierString">1</string>
|
||||
<object class="IBLayoutConstant" key="constant">
|
||||
<double key="value">516</double>
|
||||
</object>
|
||||
<float key="priority">1000</float>
|
||||
<reference key="containingView" ref="664907665"/>
|
||||
<int key="scoringType">3</int>
|
||||
<float key="scoringTypeFloat">9</float>
|
||||
<int key="contentType">1</int>
|
||||
<bool key="placeholder">NO</bool>
|
||||
</object>
|
||||
</array>
|
||||
<reference key="parent" ref="773221745"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<string key="id">10</string>
|
||||
<reference key="object" ref="582949244"/>
|
||||
<reference key="parent" ref="664907665"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<string key="id">15</string>
|
||||
<reference key="object" ref="139131928"/>
|
||||
<array class="NSMutableArray" key="children">
|
||||
<reference ref="570067231"/>
|
||||
<object class="IBNSLayoutConstraint" id="65698150">
|
||||
<reference key="firstItem" ref="139131928"/>
|
||||
<int key="firstAttribute">7</int>
|
||||
<int key="relation">0</int>
|
||||
<nil key="secondItem"/>
|
||||
<int key="secondAttribute">0</int>
|
||||
<float key="multiplier">1</float>
|
||||
<string key="multiplierString">1</string>
|
||||
<object class="IBLayoutConstant" key="constant">
|
||||
<double key="value">96</double>
|
||||
</object>
|
||||
<float key="priority">1000</float>
|
||||
<reference key="containingView" ref="139131928"/>
|
||||
<int key="scoringType">3</int>
|
||||
<float key="scoringTypeFloat">9</float>
|
||||
<int key="contentType">1</int>
|
||||
<bool key="placeholder">NO</bool>
|
||||
</object>
|
||||
</array>
|
||||
<reference key="parent" ref="773221745"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<string key="id">16</string>
|
||||
<reference key="object" ref="570067231"/>
|
||||
<reference key="parent" ref="139131928"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<string key="id">290</string>
|
||||
<reference key="object" ref="610415164"/>
|
||||
<array class="NSMutableArray" key="children">
|
||||
<reference ref="266810869"/>
|
||||
</array>
|
||||
<reference key="parent" ref="773221745"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<string key="id">291</string>
|
||||
<reference key="object" ref="266810869"/>
|
||||
<reference key="parent" ref="610415164"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<string key="id">h9P-cE-Nn4</string>
|
||||
<reference key="object" ref="183844150"/>
|
||||
<array class="NSMutableArray" key="children">
|
||||
<reference ref="721886683"/>
|
||||
</array>
|
||||
<reference key="parent" ref="773221745"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<string key="id">IHP-6G-mVo</string>
|
||||
<reference key="object" ref="721886683"/>
|
||||
<reference key="parent" ref="183844150"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<string key="id">iMi-xo-eWy</string>
|
||||
<reference key="object" ref="134641759"/>
|
||||
<reference key="parent" ref="664907665"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<string key="id">YJ1-Hw-Y6d</string>
|
||||
<reference key="object" ref="301435117"/>
|
||||
<reference key="parent" ref="626749776"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<string key="id">PG0-hY-geV</string>
|
||||
<reference key="object" ref="870995293"/>
|
||||
<reference key="parent" ref="773221745"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<string key="id">i6K-RE-2fe</string>
|
||||
<reference key="object" ref="898762975"/>
|
||||
<reference key="parent" ref="773221745"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<string key="id">gk1-TV-YZn</string>
|
||||
<reference key="object" ref="780789773"/>
|
||||
<reference key="parent" ref="773221745"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<string key="id">pS2-KY-JwZ</string>
|
||||
<reference key="object" ref="962361603"/>
|
||||
<reference key="parent" ref="773221745"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<string key="id">H3W-Ag-EM4</string>
|
||||
<reference key="object" ref="412902897"/>
|
||||
<reference key="parent" ref="773221745"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<string key="id">uNq-ax-eLX</string>
|
||||
<reference key="object" ref="822012404"/>
|
||||
<reference key="parent" ref="773221745"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<string key="id">G4a-SP-Ne5</string>
|
||||
<reference key="object" ref="544230405"/>
|
||||
<reference key="parent" ref="773221745"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<string key="id">V9F-80-0WS</string>
|
||||
<reference key="object" ref="955240815"/>
|
||||
<reference key="parent" ref="773221745"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<string key="id">jJo-kq-191</string>
|
||||
<reference key="object" ref="512692197"/>
|
||||
<reference key="parent" ref="773221745"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<string key="id">LdE-9Z-oWz</string>
|
||||
<reference key="object" ref="243708327"/>
|
||||
<reference key="parent" ref="773221745"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<string key="id">88D-6W-iEt</string>
|
||||
<reference key="object" ref="529242108"/>
|
||||
<reference key="parent" ref="773221745"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<string key="id">DKd-WY-ZYy</string>
|
||||
<reference key="object" ref="65698150"/>
|
||||
<reference key="parent" ref="139131928"/>
|
||||
</object>
|
||||
</array>
|
||||
</object>
|
||||
<dictionary class="NSMutableDictionary" key="flattenedProperties">
|
||||
<string key="-1.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<boolean value="NO" key="-1.showNotes"/>
|
||||
<string key="-2.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<boolean value="NO" key="-2.showNotes"/>
|
||||
<string key="-3.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<boolean value="NO" key="-3.showNotes"/>
|
||||
<boolean value="NO" key="1.IBNSWindowAutoPositionCentersHorizontal"/>
|
||||
<boolean value="NO" key="1.IBNSWindowAutoPositionCentersVertical"/>
|
||||
<string key="1.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<boolean value="NO" key="1.showNotes"/>
|
||||
<string key="10.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<boolean value="NO" key="10.showNotes"/>
|
||||
<boolean value="NO" key="15.IBNSControlSetsMaxLayoutWidthAtFirstLayoutMetadataKey"/>
|
||||
<array key="15.IBNSViewMetadataConstraints">
|
||||
<reference ref="65698150"/>
|
||||
</array>
|
||||
<boolean value="NO" key="15.IBNSViewMetadataTranslatesAutoresizingMaskIntoConstraints"/>
|
||||
<string key="15.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<reference key="15.IBUserGuides" ref="0"/>
|
||||
<boolean value="NO" key="15.showNotes"/>
|
||||
<string key="16.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<boolean value="NO" key="16.showNotes"/>
|
||||
<array key="2.IBNSViewMetadataConstraints">
|
||||
<reference ref="544230405"/>
|
||||
<reference ref="780789773"/>
|
||||
<reference ref="529242108"/>
|
||||
<reference ref="870995293"/>
|
||||
<reference ref="898762975"/>
|
||||
<reference ref="955240815"/>
|
||||
<reference ref="962361603"/>
|
||||
<reference ref="822012404"/>
|
||||
<reference ref="412902897"/>
|
||||
<reference ref="243708327"/>
|
||||
<reference ref="512692197"/>
|
||||
</array>
|
||||
<string key="2.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<reference key="2.IBUserGuides" ref="0"/>
|
||||
<boolean value="NO" key="2.showNotes"/>
|
||||
<boolean value="NO" key="290.IBNSControlSetsMaxLayoutWidthAtFirstLayoutMetadataKey"/>
|
||||
<boolean value="NO" key="290.IBNSViewMetadataTranslatesAutoresizingMaskIntoConstraints"/>
|
||||
<string key="290.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<reference key="290.IBUserGuides" ref="0"/>
|
||||
<boolean value="NO" key="290.showNotes"/>
|
||||
<string key="291.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<boolean value="NO" key="291.showNotes"/>
|
||||
<boolean value="NO" key="3.IBNSControlSetsMaxLayoutWidthAtFirstLayoutMetadataKey"/>
|
||||
<array key="3.IBNSViewMetadataConstraints">
|
||||
<reference ref="301435117"/>
|
||||
</array>
|
||||
<boolean value="NO" key="3.IBNSViewMetadataTranslatesAutoresizingMaskIntoConstraints"/>
|
||||
<string key="3.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<reference key="3.IBUserGuides" ref="0"/>
|
||||
<boolean value="NO" key="3.showNotes"/>
|
||||
<string key="4.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<boolean value="NO" key="4.showNotes"/>
|
||||
<string key="88D-6W-iEt.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<boolean value="NO" key="9.IBNSControlSetsMaxLayoutWidthAtFirstLayoutMetadataKey"/>
|
||||
<array key="9.IBNSViewMetadataConstraints">
|
||||
<reference ref="134641759"/>
|
||||
</array>
|
||||
<boolean value="NO" key="9.IBNSViewMetadataTranslatesAutoresizingMaskIntoConstraints"/>
|
||||
<string key="9.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<reference key="9.IBUserGuides" ref="0"/>
|
||||
<boolean value="NO" key="9.showNotes"/>
|
||||
<string key="DKd-WY-ZYy.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string key="G4a-SP-Ne5.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string key="H3W-Ag-EM4.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string key="IHP-6G-mVo.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<boolean value="NO" key="IHP-6G-mVo.showNotes"/>
|
||||
<string key="LdE-9Z-oWz.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string key="PG0-hY-geV.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string key="V9F-80-0WS.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string key="YJ1-Hw-Y6d.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string key="gk1-TV-YZn.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<boolean value="NO" key="h9P-cE-Nn4.IBNSControlSetsMaxLayoutWidthAtFirstLayoutMetadataKey"/>
|
||||
<boolean value="NO" key="h9P-cE-Nn4.IBNSViewMetadataTranslatesAutoresizingMaskIntoConstraints"/>
|
||||
<string key="h9P-cE-Nn4.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<reference key="h9P-cE-Nn4.IBUserGuides" ref="0"/>
|
||||
<boolean value="NO" key="h9P-cE-Nn4.showNotes"/>
|
||||
<string key="i6K-RE-2fe.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string key="iMi-xo-eWy.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string key="jJo-kq-191.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string key="pS2-KY-JwZ.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string key="uNq-ax-eLX.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
</dictionary>
|
||||
<dictionary class="NSMutableDictionary" key="unlocalizedProperties"/>
|
||||
<nil key="activeLocalization"/>
|
||||
<dictionary class="NSMutableDictionary" key="localizations"/>
|
||||
<nil key="sourceID"/>
|
||||
</object>
|
||||
<object class="IBClassDescriber" key="IBDocument.Classes">
|
||||
<array class="NSMutableArray" key="referencedPartialClassDescriptions">
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">WorkSpaceDialogController</string>
|
||||
<string key="superclassName">NSWindowController</string>
|
||||
<dictionary class="NSMutableDictionary" key="actions">
|
||||
<string key="browseProjectDirectory:">id</string>
|
||||
<string key="onCancel:">id</string>
|
||||
<string key="onOpenProject:">id</string>
|
||||
</dictionary>
|
||||
<dictionary class="NSMutableDictionary" key="actionInfosByName">
|
||||
<object class="IBActionInfo" key="browseProjectDirectory:">
|
||||
<string key="name">browseProjectDirectory:</string>
|
||||
<string key="candidateClassName">id</string>
|
||||
</object>
|
||||
<object class="IBActionInfo" key="onCancel:">
|
||||
<string key="name">onCancel:</string>
|
||||
<string key="candidateClassName">id</string>
|
||||
</object>
|
||||
<object class="IBActionInfo" key="onOpenProject:">
|
||||
<string key="name">onOpenProject:</string>
|
||||
<string key="candidateClassName">id</string>
|
||||
</object>
|
||||
</dictionary>
|
||||
<dictionary class="NSMutableDictionary" key="outlets">
|
||||
<string key="buttonOpenProject">NSButton</string>
|
||||
<string key="textFieldProjectDirectory">NSTextField</string>
|
||||
<string key="textFieldScriptFile">NSTextField</string>
|
||||
</dictionary>
|
||||
<dictionary class="NSMutableDictionary" key="toOneOutletInfosByName">
|
||||
<object class="IBToOneOutletInfo" key="buttonOpenProject">
|
||||
<string key="name">buttonOpenProject</string>
|
||||
<string key="candidateClassName">NSButton</string>
|
||||
</object>
|
||||
<object class="IBToOneOutletInfo" key="textFieldProjectDirectory">
|
||||
<string key="name">textFieldProjectDirectory</string>
|
||||
<string key="candidateClassName">NSTextField</string>
|
||||
</object>
|
||||
<object class="IBToOneOutletInfo" key="textFieldScriptFile">
|
||||
<string key="name">textFieldScriptFile</string>
|
||||
<string key="candidateClassName">NSTextField</string>
|
||||
</object>
|
||||
</dictionary>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBProjectSource</string>
|
||||
<string key="minorKey">./Classes/WorkSpaceDialogController.h</string>
|
||||
</object>
|
||||
</object>
|
||||
</array>
|
||||
</object>
|
||||
<int key="IBDocument.localizationMode">0</int>
|
||||
<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaFramework</string>
|
||||
<bool key="IBDocument.previouslyAttemptedUpgradeToXcode5">YES</bool>
|
||||
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencyDefaults">
|
||||
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.macosx</string>
|
||||
<real value="1070" key="NS.object.0"/>
|
||||
</object>
|
||||
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies">
|
||||
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3</string>
|
||||
<integer value="4600" key="NS.object.0"/>
|
||||
</object>
|
||||
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
|
||||
<int key="IBDocument.defaultPropertyAccessControl">3</int>
|
||||
<bool key="IBDocument.UseAutolayout">YES</bool>
|
||||
</data>
|
||||
</archive>
|
|
@ -1,22 +0,0 @@
|
|||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
@interface WorkSpaceDialogController : NSWindowController
|
||||
{
|
||||
|
||||
NSTextField *textFieldProjectDirectory;
|
||||
NSTextField *textFieldScriptFile;
|
||||
NSButton *buttonOpenProject;
|
||||
}
|
||||
|
||||
@property (nonatomic, assign) IBOutlet NSTextField *textFieldProjectDirectory;
|
||||
@property (nonatomic, assign) IBOutlet NSTextField *textFieldScriptFile;
|
||||
|
||||
@property (nonatomic, assign) IBOutlet NSButton *buttonOpenProject;
|
||||
|
||||
- (IBAction) browseProjectDirectory:(id)sender;
|
||||
|
||||
- (IBAction) onCancel:(id)sender;
|
||||
- (IBAction) onOpenProject:(id)sender;
|
||||
|
||||
@end
|
|
@ -1,97 +0,0 @@
|
|||
|
||||
#import "WorkSpaceDialogController.h"
|
||||
|
||||
#pragma mark -
|
||||
|
||||
@implementation WorkSpaceDialogController
|
||||
|
||||
@synthesize textFieldProjectDirectory;
|
||||
@synthesize textFieldScriptFile;
|
||||
@synthesize buttonOpenProject;
|
||||
|
||||
NSString* projectPath=nil;
|
||||
- (id)initWithWindow:(NSWindow *)window
|
||||
{
|
||||
self = [super initWithWindow:window];
|
||||
if (self) {
|
||||
// Initialization code here.
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
[super dealloc];
|
||||
NSLog(@"[WorkSpaceDialogController dealloc]");
|
||||
}
|
||||
|
||||
- (void)windowDidLoad
|
||||
{
|
||||
[super windowDidLoad];
|
||||
|
||||
// Implement this method to handle any initialization after your window controller's window has been loaded from its nib file.
|
||||
[self.window makeFirstResponder:textFieldProjectDirectory];
|
||||
if (nil != projectPath && 0 != projectPath.length)
|
||||
{
|
||||
[textFieldProjectDirectory setStringValue:projectPath];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark functions
|
||||
|
||||
- (NSString*) browseFolder:(NSString*)title
|
||||
{
|
||||
NSOpenPanel* openDlg = [NSOpenPanel openPanel];
|
||||
[openDlg setTitle:title];
|
||||
[openDlg setCanChooseDirectories:YES];
|
||||
[openDlg setCanChooseFiles:NO];
|
||||
[openDlg setCanHide:YES];
|
||||
[openDlg setCanCreateDirectories:NO];
|
||||
[openDlg setCanSelectHiddenExtension:NO];
|
||||
[openDlg setAllowsMultipleSelection:NO];
|
||||
|
||||
if ([openDlg runModal] == NSFileHandlingPanelOKButton)
|
||||
{
|
||||
NSURL *url = [openDlg.URLs objectAtIndex:0];
|
||||
return [url path];
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark outlet
|
||||
|
||||
- (IBAction) browseProjectDirectory:(id)sender
|
||||
{
|
||||
NSString *path = [self browseFolder:@"Choose Project Directory"];
|
||||
if (path)
|
||||
{
|
||||
[textFieldProjectDirectory setStringValue:path];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
- (IBAction) onCancel:(id)sender
|
||||
{
|
||||
[self close];
|
||||
[NSApp endSheet:self.window returnCode:NSRunAbortedResponse];
|
||||
}
|
||||
|
||||
- (IBAction) onOpenProject:(id)sender
|
||||
{
|
||||
if([[textFieldProjectDirectory stringValue] isEqualToString:@""])
|
||||
{
|
||||
NSRunAlertPanel(@"Waring",
|
||||
@"Project path empty!",
|
||||
@"OK", NULL, NULL);
|
||||
return;
|
||||
}
|
||||
projectPath = [textFieldProjectDirectory stringValue];
|
||||
[self close];
|
||||
[NSApp endSheet:self.window returnCode:NSRunAbortedResponse];
|
||||
}
|
||||
|
||||
|
||||
@end
|
|
@ -38,6 +38,7 @@ using namespace cocos2d;
|
|||
|
||||
WNDPROC g_oldProc=NULL;
|
||||
bool g_landscape=false;
|
||||
bool g_windTop = true;
|
||||
CCSize g_screenSize;
|
||||
GLView* g_eglView=NULL;
|
||||
INT_PTR CALLBACK AboutDialogCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
|
||||
|
@ -70,6 +71,7 @@ void updateMenu()
|
|||
{
|
||||
HMENU hSysMenu = GetSystemMenu(glfwGetWin32Window(g_eglView->getWindow()), FALSE);
|
||||
HMENU viewMenu = GetSubMenu(hSysMenu, 8);
|
||||
HMENU viewControl = GetSubMenu(hSysMenu, 9);
|
||||
|
||||
if (g_landscape)
|
||||
{
|
||||
|
@ -82,6 +84,16 @@ void updateMenu()
|
|||
CheckMenuItem(viewMenu, ID_VIEW_LANDSCAPE, MF_BYCOMMAND | MF_UNCHECKED);
|
||||
}
|
||||
|
||||
if (g_windTop)
|
||||
{
|
||||
::SetWindowPos(glfwGetWin32Window(g_eglView->getWindow()),HWND_TOPMOST,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE);
|
||||
CheckMenuItem(viewControl, ID_CONTROL_TOP, MF_BYCOMMAND | MF_CHECKED);
|
||||
|
||||
}else
|
||||
{
|
||||
::SetWindowPos(glfwGetWin32Window(g_eglView->getWindow()),HWND_NOTOPMOST,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE);
|
||||
CheckMenuItem(viewControl, ID_CONTROL_TOP, MF_BYCOMMAND | MF_UNCHECKED);
|
||||
}
|
||||
int width = g_screenSize.width;
|
||||
int height = g_screenSize.height;
|
||||
if (height > width)
|
||||
|
@ -244,6 +256,10 @@ LRESULT CALLBACK SNewWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPar
|
|||
|
||||
switch (wmId)
|
||||
{
|
||||
case ID_CONTROL_TOP:
|
||||
g_windTop = !g_windTop;
|
||||
updateView();
|
||||
break;
|
||||
case ID_FILE_EXIT:
|
||||
shutDownApp();
|
||||
break;
|
||||
|
@ -324,6 +340,7 @@ void createSimulator(const char* viewName, float width, float height, bool isLan
|
|||
width = height;
|
||||
height = tmpvalue;
|
||||
}
|
||||
g_windTop = true;
|
||||
|
||||
g_eglView = GLView::createWithRect(viewName,Rect(0,0,width,height),frameZoomFactor);
|
||||
auto director = Director::getInstance();
|
||||
|
|
|
@ -66,6 +66,7 @@ BEGIN
|
|||
POPUP "&Control"
|
||||
BEGIN
|
||||
MENUITEM "Restart(F5)", ID_CONTROL_RELOAD
|
||||
MENUITEM "Keep Window Top", ID_CONTROL_TOP
|
||||
END
|
||||
POPUP "&Help"
|
||||
BEGIN
|
||||
|
@ -88,19 +89,6 @@ BEGIN
|
|||
LTEXT "Cocos2d-x-Simulator",IDC_STATIC,29,17,169,25
|
||||
END
|
||||
|
||||
IDD_DIALOG_VIEWCUSTOM DIALOGEX 0, 0, 179, 98
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Custom"
|
||||
FONT 8, "MS Shell Dlg", 400, 0, 0x1
|
||||
BEGIN
|
||||
DEFPUSHBUTTON "OK",IDOK,47,77,50,14
|
||||
PUSHBUTTON "Cancel",IDCANCEL,104,77,50,14
|
||||
LTEXT "Width£º",IDC_STATIC,15,14,30,8
|
||||
LTEXT "Height£º",IDC_STATIC,15,36,36,12
|
||||
EDITTEXT IDC_EDIT_WIDTH,60,15,89,14,ES_AUTOHSCROLL
|
||||
EDITTEXT IDC_EDIT_HEIGHT,62,36,87,14,ES_AUTOHSCROLL
|
||||
END
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
@ -117,14 +105,6 @@ BEGIN
|
|||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 87
|
||||
END
|
||||
|
||||
IDD_DIALOG_VIEWCUSTOM, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 172
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 91
|
||||
END
|
||||
END
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
|
|
|
@ -7,10 +7,7 @@
|
|||
#define IDR_MENU_COCOS 201
|
||||
#define IDD_DIALOG1 202
|
||||
#define IDD_DIALOG_ABOUT 202
|
||||
#define IDD_DIALOG_VIEWCUSTOM 203
|
||||
#define IDC_EDIT_WIDTH 1000
|
||||
#define IDC_EDIT2 1001
|
||||
#define IDC_EDIT_HEIGHT 1001
|
||||
#define ID_VIEW_SIZE 30001
|
||||
#define ID_FILE_NEW_WINDOW 32771
|
||||
#define ID_VIEW_PORTRAIT 32775
|
||||
|
@ -27,13 +24,14 @@
|
|||
#define ID_VIEW_ZOOMOUT75 32786
|
||||
#define ID_VIEW_ZOOMOUT50 32787
|
||||
#define ID_VIEW_ZOOMOUT25 32788
|
||||
#define ID_CONTROL_TOP 32793
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 201
|
||||
#define _APS_NEXT_COMMAND_VALUE 32793
|
||||
#define _APS_NEXT_COMMAND_VALUE 32794
|
||||
#define _APS_NEXT_CONTROL_VALUE 1000
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#endif
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"version":"v3-lua-runtime-1.2",
|
||||
"zip_file_size":"24461574 ",
|
||||
"version":"v3-lua-runtime-1.3",
|
||||
"zip_file_size":"24663989",
|
||||
"repo_name":"cocos-runtime-bin",
|
||||
"repo_parent":"https://github.com/chukong/"
|
||||
}
|
||||
|
|
|
@ -0,0 +1,184 @@
|
|||
require "Cocos2d"
|
||||
require "Cocos2dConstants"
|
||||
|
||||
local GameScene = class("GameScene",function()
|
||||
return cc.Scene:create()
|
||||
end)
|
||||
|
||||
function GameScene.create()
|
||||
local scene = GameScene.new()
|
||||
scene:addChild(scene:createLayerFarm())
|
||||
scene:addChild(scene:createLayerMenu())
|
||||
return scene
|
||||
end
|
||||
|
||||
|
||||
function GameScene:ctor()
|
||||
self.visibleSize = cc.Director:getInstance():getVisibleSize()
|
||||
self.origin = cc.Director:getInstance():getVisibleOrigin()
|
||||
self.schedulerID = nil
|
||||
end
|
||||
|
||||
function GameScene:playBgMusic()
|
||||
local bgMusicPath = cc.FileUtils:getInstance():fullPathForFilename("background.mp3")
|
||||
cc.SimpleAudioEngine:getInstance():playMusic(bgMusicPath, true)
|
||||
local effectPath = cc.FileUtils:getInstance():fullPathForFilename("effect1.wav")
|
||||
cc.SimpleAudioEngine:getInstance():preloadEffect(effectPath)
|
||||
end
|
||||
|
||||
function GameScene:creatDog()
|
||||
local frameWidth = 105
|
||||
local frameHeight = 95
|
||||
|
||||
-- create dog animate
|
||||
local textureDog = cc.Director:getInstance():getTextureCache():addImage("dog.png")
|
||||
local rect = cc.rect(0, 0, frameWidth, frameHeight)
|
||||
local frame0 = cc.SpriteFrame:createWithTexture(textureDog, rect)
|
||||
rect = cc.rect(frameWidth, 0, frameWidth, frameHeight)
|
||||
local frame1 = cc.SpriteFrame:createWithTexture(textureDog, rect)
|
||||
|
||||
local spriteDog = cc.Sprite:createWithSpriteFrame(frame0)
|
||||
spriteDog:setPosition(self.origin.x, self.origin.y + self.visibleSize.height / 4 * 3)
|
||||
spriteDog.isPaused = false
|
||||
|
||||
local animation = cc.Animation:createWithSpriteFrames({frame0,frame1}, 0.5)
|
||||
local animate = cc.Animate:create(animation);
|
||||
spriteDog:runAction(cc.RepeatForever:create(animate))
|
||||
|
||||
-- moving dog at every frame
|
||||
local function tick()
|
||||
if spriteDog.isPaused then return end
|
||||
local x, y = spriteDog:getPosition()
|
||||
if x > self.origin.x + self.visibleSize.width then
|
||||
x = self.origin.x
|
||||
else
|
||||
x = x + 1
|
||||
end
|
||||
|
||||
spriteDog:setPositionX(x)
|
||||
end
|
||||
|
||||
self.schedulerID = cc.Director:getInstance():getScheduler():scheduleScriptFunc(tick, 0, false)
|
||||
|
||||
return spriteDog
|
||||
end
|
||||
|
||||
-- create farm
|
||||
function GameScene:createLayerFarm()
|
||||
local layerFarm = cc.Layer:create()
|
||||
-- add in farm background
|
||||
local bg = cc.Sprite:create("farm.jpg")
|
||||
bg:setPosition(self.origin.x + self.visibleSize.width / 2 + 80, self.origin.y + self.visibleSize.height / 2)
|
||||
layerFarm:addChild(bg)
|
||||
|
||||
-- add land sprite
|
||||
for i = 0, 3 do
|
||||
for j = 0, 1 do
|
||||
local spriteLand = cc.Sprite:create("land.png")
|
||||
spriteLand:setPosition(200 + j * 180 - i % 2 * 90, 10 + i * 95 / 2)
|
||||
layerFarm:addChild(spriteLand)
|
||||
end
|
||||
end
|
||||
|
||||
-- add crop
|
||||
local frameCrop = cc.SpriteFrame:create("crop.png", cc.rect(0, 0, 105, 95))
|
||||
for i = 0, 3 do
|
||||
for j = 0, 1 do
|
||||
local spriteCrop = cc.Sprite:createWithSpriteFrame(frameCrop);
|
||||
spriteCrop:setPosition(210 + j * 180 - i % 2 * 90, 40 + i * 95 / 2)
|
||||
layerFarm:addChild(spriteCrop)
|
||||
end
|
||||
end
|
||||
|
||||
-- add moving dog
|
||||
local spriteDog = self:creatDog()
|
||||
layerFarm:addChild(spriteDog)
|
||||
|
||||
-- handing touch events
|
||||
local touchBeginPoint = nil
|
||||
local function onTouchBegan(touch, event)
|
||||
local location = touch:getLocation()
|
||||
--cclog("onTouchBegan: %0.2f, %0.2f", location.x, location.y)
|
||||
touchBeginPoint = {x = location.x, y = location.y}
|
||||
spriteDog.isPaused = true
|
||||
-- CCTOUCHBEGAN event must return true
|
||||
return true
|
||||
end
|
||||
|
||||
local function onTouchMoved(touch, event)
|
||||
local location = touch:getLocation()
|
||||
--cclog("onTouchMoved: %0.2f, %0.2f", location.x, location.y)
|
||||
if touchBeginPoint then
|
||||
local cx, cy = layerFarm:getPosition()
|
||||
layerFarm:setPosition(cx + location.x - touchBeginPoint.x,
|
||||
cy + location.y - touchBeginPoint.y)
|
||||
touchBeginPoint = {x = location.x, y = location.y}
|
||||
end
|
||||
end
|
||||
|
||||
local function onTouchEnded(touch, event)
|
||||
local location = touch:getLocation()
|
||||
--cclog("onTouchEnded: %0.2f, %0.2f", location.x, location.y)
|
||||
touchBeginPoint = nil
|
||||
spriteDog.isPaused = false
|
||||
end
|
||||
|
||||
local listener = cc.EventListenerTouchOneByOne:create()
|
||||
listener:registerScriptHandler(onTouchBegan,cc.Handler.EVENT_TOUCH_BEGAN )
|
||||
listener:registerScriptHandler(onTouchMoved,cc.Handler.EVENT_TOUCH_MOVED )
|
||||
listener:registerScriptHandler(onTouchEnded,cc.Handler.EVENT_TOUCH_ENDED )
|
||||
local eventDispatcher = layerFarm:getEventDispatcher()
|
||||
eventDispatcher:addEventListenerWithSceneGraphPriority(listener, layerFarm)
|
||||
|
||||
local function onNodeEvent(event)
|
||||
if "exit" == event then
|
||||
cc.Director:getInstance():getScheduler():unscheduleScriptEntry(self.schedulerID)
|
||||
end
|
||||
end
|
||||
layerFarm:registerScriptHandler(onNodeEvent)
|
||||
|
||||
return layerFarm
|
||||
end
|
||||
|
||||
-- create menu
|
||||
function GameScene:createLayerMenu()
|
||||
|
||||
local layerMenu = cc.Layer:create()
|
||||
local menuPopup, menuTools, effectID
|
||||
|
||||
local function menuCallbackClosePopup()
|
||||
-- stop test sound effect
|
||||
cc.SimpleAudioEngine:getInstance():stopEffect(effectID)
|
||||
menuPopup:setVisible(false)
|
||||
end
|
||||
|
||||
local function menuCallbackOpenPopup()
|
||||
-- loop test sound effect
|
||||
local effectPath = cc.FileUtils:getInstance():fullPathForFilename("effect1.wav")
|
||||
effectID = cc.SimpleAudioEngine:getInstance():playEffect(effectPath)
|
||||
menuPopup:setVisible(true)
|
||||
end
|
||||
|
||||
-- add a popup menu
|
||||
local menuPopupItem = cc.MenuItemImage:create("menu2.png", "menu2.png")
|
||||
menuPopupItem:setPosition(0, 0)
|
||||
menuPopupItem:registerScriptTapHandler(menuCallbackClosePopup)
|
||||
menuPopup = cc.Menu:create(menuPopupItem)
|
||||
menuPopup:setPosition(self.origin.x + self.visibleSize.width / 2, self.origin.y + self.visibleSize.height / 2)
|
||||
menuPopup:setVisible(false)
|
||||
layerMenu:addChild(menuPopup)
|
||||
|
||||
-- add the left-bottom "tools" menu to invoke menuPopup
|
||||
local menuToolsItem = cc.MenuItemImage:create("menu1.png", "menu1.png")
|
||||
menuToolsItem:setPosition(0, 0)
|
||||
menuToolsItem:registerScriptTapHandler(menuCallbackOpenPopup)
|
||||
menuTools = cc.Menu:create(menuToolsItem)
|
||||
local itemWidth = menuToolsItem:getContentSize().width
|
||||
local itemHeight = menuToolsItem:getContentSize().height
|
||||
menuTools:setPosition(self.origin.x + itemWidth/2, self.origin.y + itemHeight/2)
|
||||
layerMenu:addChild(menuTools)
|
||||
|
||||
return layerMenu
|
||||
end
|
||||
|
||||
return GameScene
|
|
@ -1,3 +0,0 @@
|
|||
function myadd(x, y)
|
||||
return x + y
|
||||
end
|
|
@ -1,8 +1,8 @@
|
|||
|
||||
require "Cocos2d"
|
||||
require "Cocos2dConstants"
|
||||
|
||||
-- cclog
|
||||
cclog = function(...)
|
||||
local cclog = function(...)
|
||||
print(string.format(...))
|
||||
end
|
||||
|
||||
|
@ -20,209 +20,21 @@ local function main()
|
|||
-- avoid memory leak
|
||||
collectgarbage("setpause", 100)
|
||||
collectgarbage("setstepmul", 5000)
|
||||
|
||||
cc.FileUtils:getInstance():addSearchPath("src")
|
||||
cc.FileUtils:getInstance():addSearchPath("res")
|
||||
cc.Director:getInstance():getOpenGLView():setDesignResolutionSize(480, 320, 0)
|
||||
cc.FileUtils:getInstance():addSearchPath("src")
|
||||
cc.FileUtils:getInstance():addSearchPath("res")
|
||||
local schedulerID = 0
|
||||
--support debug
|
||||
local targetPlatform = cc.Application:getInstance():getTargetPlatform()
|
||||
if (cc.PLATFORM_OS_IPHONE == targetPlatform) or (cc.PLATFORM_OS_IPAD == targetPlatform) or
|
||||
(cc.PLATFORM_OS_ANDROID == targetPlatform) or (cc.PLATFORM_OS_WINDOWS == targetPlatform) or
|
||||
(cc.PLATFORM_OS_MAC == targetPlatform) then
|
||||
cclog("result is ")
|
||||
--require('debugger')()
|
||||
|
||||
|
||||
--create scene
|
||||
local scene = require("GameScene")
|
||||
local gameScene = scene.create()
|
||||
gameScene:playBgMusic()
|
||||
|
||||
if cc.Director:getInstance():getRunningScene() then
|
||||
cc.Director:getInstance():replaceScene(gameScene)
|
||||
else
|
||||
cc.Director:getInstance():runWithScene(gameScene)
|
||||
end
|
||||
require "hello2"
|
||||
cclog("result is " .. myadd(1, 1))
|
||||
|
||||
---------------
|
||||
|
||||
local visibleSize = cc.Director:getInstance():getVisibleSize()
|
||||
local origin = cc.Director:getInstance():getVisibleOrigin()
|
||||
|
||||
-- add the moving dog
|
||||
local function creatDog()
|
||||
local frameWidth = 105
|
||||
local frameHeight = 95
|
||||
|
||||
-- create dog animate
|
||||
local textureDog = cc.Director:getInstance():getTextureCache():addImage("dog.png")
|
||||
local rect = cc.rect(0, 0, frameWidth, frameHeight)
|
||||
local frame0 = cc.SpriteFrame:createWithTexture(textureDog, rect)
|
||||
rect = cc.rect(frameWidth, 0, frameWidth, frameHeight)
|
||||
local frame1 = cc.SpriteFrame:createWithTexture(textureDog, rect)
|
||||
|
||||
local spriteDog = cc.Sprite:createWithSpriteFrame(frame0)
|
||||
spriteDog.isPaused = false
|
||||
spriteDog:setPosition(origin.x, origin.y + visibleSize.height / 4 * 3)
|
||||
--[[
|
||||
local animFrames = CCArray:create()
|
||||
|
||||
animFrames:addObject(frame0)
|
||||
animFrames:addObject(frame1)
|
||||
]]--
|
||||
|
||||
local animation = cc.Animation:createWithSpriteFrames({frame0,frame1}, 0.5)
|
||||
local animate = cc.Animate:create(animation);
|
||||
spriteDog:runAction(cc.RepeatForever:create(animate))
|
||||
|
||||
-- moving dog at every frame
|
||||
local function tick()
|
||||
if spriteDog.isPaused then return end
|
||||
local x, y = spriteDog:getPosition()
|
||||
if x > origin.x + visibleSize.width then
|
||||
x = origin.x
|
||||
else
|
||||
x = x + 1
|
||||
end
|
||||
|
||||
spriteDog:setPositionX(x)
|
||||
end
|
||||
|
||||
schedulerID = cc.Director:getInstance():getScheduler():scheduleScriptFunc(tick, 0, false)
|
||||
|
||||
return spriteDog
|
||||
end
|
||||
|
||||
-- create farm
|
||||
local function createLayerFarm()
|
||||
local layerFarm = cc.Layer:create()
|
||||
|
||||
-- add in farm background
|
||||
local bg = cc.Sprite:create("farm.jpg")
|
||||
bg:setPosition(origin.x + visibleSize.width / 2 + 80, origin.y + visibleSize.height / 2)
|
||||
layerFarm:addChild(bg)
|
||||
|
||||
-- add land sprite
|
||||
for i = 0, 3 do
|
||||
for j = 0, 1 do
|
||||
local spriteLand = cc.Sprite:create("land.png")
|
||||
spriteLand:setPosition(200 + j * 180 - i % 2 * 90, 10 + i * 95 / 2)
|
||||
layerFarm:addChild(spriteLand)
|
||||
end
|
||||
end
|
||||
|
||||
-- add crop
|
||||
local frameCrop = cc.SpriteFrame:create("crop.png", cc.rect(0, 0, 105, 95))
|
||||
for i = 0, 3 do
|
||||
for j = 0, 1 do
|
||||
local spriteCrop = cc.Sprite:createWithSpriteFrame(frameCrop);
|
||||
spriteCrop:setPosition(10 + 200 + j * 180 - i % 2 * 90, 30 + 10 + i * 95 / 2)
|
||||
layerFarm:addChild(spriteCrop)
|
||||
end
|
||||
end
|
||||
|
||||
-- add moving dog
|
||||
local spriteDog = creatDog()
|
||||
layerFarm:addChild(spriteDog)
|
||||
|
||||
-- handing touch events
|
||||
local touchBeginPoint = nil
|
||||
local function onTouchBegan(touch, event)
|
||||
local location = touch:getLocation()
|
||||
--cclog("onTouchBegan: %0.2f, %0.2f", location.x, location.y)
|
||||
touchBeginPoint = {x = location.x, y = location.y}
|
||||
spriteDog.isPaused = true
|
||||
-- CCTOUCHBEGAN event must return true
|
||||
return true
|
||||
end
|
||||
|
||||
local function onTouchMoved(touch, event)
|
||||
local location = touch:getLocation()
|
||||
--cclog("onTouchMoved: %0.2f, %0.2f", location.x, location.y)
|
||||
if touchBeginPoint then
|
||||
local cx, cy = layerFarm:getPosition()
|
||||
layerFarm:setPosition(cx + location.x - touchBeginPoint.x,
|
||||
cy + location.y - touchBeginPoint.y)
|
||||
touchBeginPoint = {x = location.x, y = location.y}
|
||||
end
|
||||
end
|
||||
|
||||
local function onTouchEnded(touch, event)
|
||||
local location = touch:getLocation()
|
||||
--cclog("onTouchEnded: %0.2f, %0.2f", location.x, location.y)
|
||||
touchBeginPoint = nil
|
||||
spriteDog.isPaused = false
|
||||
end
|
||||
|
||||
local listener = cc.EventListenerTouchOneByOne:create()
|
||||
listener:registerScriptHandler(onTouchBegan,cc.Handler.EVENT_TOUCH_BEGAN )
|
||||
listener:registerScriptHandler(onTouchMoved,cc.Handler.EVENT_TOUCH_MOVED )
|
||||
listener:registerScriptHandler(onTouchEnded,cc.Handler.EVENT_TOUCH_ENDED )
|
||||
local eventDispatcher = layerFarm:getEventDispatcher()
|
||||
eventDispatcher:addEventListenerWithSceneGraphPriority(listener, layerFarm)
|
||||
|
||||
local function onNodeEvent(event)
|
||||
if "exit" == event then
|
||||
cc.Director:getInstance():getScheduler():unscheduleScriptEntry(schedulerID)
|
||||
end
|
||||
end
|
||||
layerFarm:registerScriptHandler(onNodeEvent)
|
||||
|
||||
return layerFarm
|
||||
end
|
||||
|
||||
|
||||
-- create menu
|
||||
local function createLayerMenu()
|
||||
local layerMenu = cc.Layer:create()
|
||||
|
||||
local menuPopup, menuTools, effectID
|
||||
|
||||
local function menuCallbackClosePopup()
|
||||
-- stop test sound effect
|
||||
cc.SimpleAudioEngine:getInstance():stopEffect(effectID)
|
||||
menuPopup:setVisible(false)
|
||||
end
|
||||
|
||||
local function menuCallbackOpenPopup()
|
||||
-- loop test sound effect
|
||||
local effectPath = cc.FileUtils:getInstance():fullPathForFilename("effect1.wav")
|
||||
effectID = cc.SimpleAudioEngine:getInstance():playEffect(effectPath)
|
||||
menuPopup:setVisible(true)
|
||||
end
|
||||
|
||||
-- add a popup menu
|
||||
local menuPopupItem = cc.MenuItemImage:create("menu2.png", "menu2.png")
|
||||
menuPopupItem:setPosition(0, 0)
|
||||
menuPopupItem:registerScriptTapHandler(menuCallbackClosePopup)
|
||||
menuPopup = cc.Menu:create(menuPopupItem)
|
||||
menuPopup:setPosition(origin.x + visibleSize.width / 2, origin.y + visibleSize.height / 2)
|
||||
menuPopup:setVisible(false)
|
||||
layerMenu:addChild(menuPopup)
|
||||
|
||||
-- add the left-bottom "tools" menu to invoke menuPopup
|
||||
local menuToolsItem = cc.MenuItemImage:create("menu1.png", "menu1.png")
|
||||
menuToolsItem:setPosition(0, 0)
|
||||
menuToolsItem:registerScriptTapHandler(menuCallbackOpenPopup)
|
||||
menuTools = cc.Menu:create(menuToolsItem)
|
||||
local itemWidth = menuToolsItem:getContentSize().width
|
||||
local itemHeight = menuToolsItem:getContentSize().height
|
||||
menuTools:setPosition(origin.x + itemWidth/2, origin.y + itemHeight/2)
|
||||
layerMenu:addChild(menuTools)
|
||||
|
||||
return layerMenu
|
||||
end
|
||||
|
||||
-- play background music, preload effect
|
||||
|
||||
-- uncomment below for the BlackBerry version
|
||||
local bgMusicPath = cc.FileUtils:getInstance():fullPathForFilename("background.mp3")
|
||||
cc.SimpleAudioEngine:getInstance():playMusic(bgMusicPath, true)
|
||||
local effectPath = cc.FileUtils:getInstance():fullPathForFilename("effect1.wav")
|
||||
cc.SimpleAudioEngine:getInstance():preloadEffect(effectPath)
|
||||
|
||||
-- run
|
||||
local sceneGame = cc.Scene:create()
|
||||
sceneGame:addChild(createLayerFarm())
|
||||
sceneGame:addChild(createLayerMenu())
|
||||
|
||||
if cc.Director:getInstance():getRunningScene() then
|
||||
cc.Director:getInstance():replaceScene(sceneGame)
|
||||
else
|
||||
cc.Director:getInstance():runWithScene(sceneGame)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
|
|
@ -277,6 +277,7 @@ cocos2d::Node* LoadSceneEdtiorFileTest::createGameScene()
|
|||
{
|
||||
_filePath = "scenetest/LoadSceneEdtiorFileTest/FishJoy2.json"; //default is json
|
||||
_rootNode = SceneReader::getInstance()->createNodeWithSceneFile(_filePath.c_str());
|
||||
ActionManagerEx::getInstance()->playActionByName("startMenu_1.json", "Animation1");
|
||||
if (_rootNode == nullptr)
|
||||
{
|
||||
return nullptr;
|
||||
|
|
|
@ -42,9 +42,9 @@ bool UIRichTextTest::init()
|
|||
_richText->ignoreContentAdaptWithSize(false);
|
||||
_richText->setContentSize(Size(100, 100));
|
||||
|
||||
RichElementText* re1 = RichElementText::create(1, Color3B::WHITE, 255, "This color is white. ", "Helvetica", 10);
|
||||
RichElementText* re1 = RichElementText::create(1, Color3B::WHITE, 255, "中国中国中国中国中国中国中国中国中国中国", "Marker Felt", 10);
|
||||
RichElementText* re2 = RichElementText::create(2, Color3B::YELLOW, 255, "And this is yellow. ", "Helvetica", 10);
|
||||
RichElementText* re3 = RichElementText::create(3, Color3B::BLUE, 255, "This one is blue. ", "Helvetica", 10);
|
||||
RichElementText* re3 = RichElementText::create(3, Color3B::BLUE, 255, "ご静聴ありがとうございました!!ご静聴ありがとうございました!!", "Helvetica", 10);
|
||||
RichElementText* re4 = RichElementText::create(4, Color3B::GREEN, 255, "And green. ", "Helvetica", 10);
|
||||
RichElementText* re5 = RichElementText::create(5, Color3B::RED, 255, "Last one is red ", "Helvetica", 10);
|
||||
|
||||
|
|
Loading…
Reference in New Issue