Merge branch 'develop' into develop_migrate_math_lib_merge

This commit is contained in:
Huabing.Xu 2014-04-21 17:47:34 +08:00
commit 7a38050e09
24 changed files with 182 additions and 127 deletions

View File

@ -712,6 +712,7 @@ Developers:
kicktheken (Kenneth Chan) kicktheken (Kenneth Chan)
Fixed a bug that the setBlendFunc method of some classes wasn't exposed to LUA. Fixed a bug that the setBlendFunc method of some classes wasn't exposed to LUA.
Fix lua project template crash on iOS5.1 device
andyque andyque
Fixed a bug that missing to check self assignment of Vector<T>, Map<K,V>, Value and String. Fixed a bug that missing to check self assignment of Vector<T>, Map<K,V>, Value and String.
@ -813,6 +814,7 @@ Developers:
Mazyod Mazyod
Fixed a bug that HTTPClient reports 2xx status codes as errors Fixed a bug that HTTPClient reports 2xx status codes as errors
Added missing Text Font and Placeholder feature of EditBox for Mac platform
iSevenDays iSevenDays
Fixed a bug that the result of 'malloc' is incompatible with type 'unsigned char *' in Image::saveImageToPNG Fixed a bug that the result of 'malloc' is incompatible with type 'unsigned char *' in Image::saveImageToPNG

View File

@ -1 +1 @@
62ee83b9b745b3f49184d3f440092788aa97c795 8b3507a9c91fab165e606013db661de54b2154d3

View File

@ -31,8 +31,8 @@ Example:
$ cd cocos2d-x $ cd cocos2d-x
$ ./setup.py $ ./setup.py
$ source FILE_TO_SAVE_SYSTEM_VARIABLE $ source FILE_TO_SAVE_SYSTEM_VARIABLE
$ cocos new MyGame -p com.your_company.mygame -l cpp -d /home $ cocos new MyGame -p com.your_company.mygame -l cpp -d NEW_PROJECTS_DIR
$ cd /home/MyGame $ cd NEW_PROJECTS_DIR/MyGame
### Build and run new project for android ### ### Build and run new project for android ###
@ -56,7 +56,7 @@ script in **cocos2d/build/install-deps-linux.sh**
Then Then
$ cd /home/MyGame $ cd NEW_PROJECTS_DIR/MyGame
$ cocos run -p linux $ cocos run -p linux
Run Run

View File

@ -1 +1 @@
e6cb148185cfef8c71e62f3e83178e3eede69200 5d8a34c4c77e112c1ec691319bce9afaae1a16f9

View File

@ -279,7 +279,7 @@ bool RenderTexture::initWithWidthAndHeight(int w, int h, Texture2D::PixelFormat
setSprite(Sprite::createWithTexture(_texture)); setSprite(Sprite::createWithTexture(_texture));
_texture->release(); _texture->release();
_sprite->setScaleY(-1); _sprite->setFlippedY(true);
_sprite->setBlendFunc( BlendFunc::ALPHA_PREMULTIPLIED ); _sprite->setBlendFunc( BlendFunc::ALPHA_PREMULTIPLIED );

View File

@ -31,7 +31,7 @@ NS_CC_BEGIN
const char* cocos2dVersion() const char* cocos2dVersion()
{ {
return "3.0-rc2"; return "cocos2d-x 3.0";
} }
NS_CC_END NS_CC_END

View File

@ -61,8 +61,7 @@ bool cocos2d::Image::saveToFile(const std::string& filename, bool isToRGB)
// The data has alpha channel, and want to save it with an RGB png file, // The data has alpha channel, and want to save it with an RGB png file,
// or want to save as jpg, remove the alpha channel. // or want to save as jpg, remove the alpha channel.
if ((saveToPNG && hasAlpha() && isToRGB) if (hasAlpha() && bitsPerPixel == 24)
|| (! saveToPNG))
{ {
pixels = new unsigned char[myDataLength]; pixels = new unsigned char[myDataLength];

View File

@ -18,42 +18,42 @@ public:
void Close(); void Close();
/** /**
@brief @brief Play sound file
@param pFileName @param pFileName Sound's file name,include the file path.
@param nTimes 1 @param nTimes Play mode£¬default value is 1,paly once
*/ */
void Open(const char* pFileName, UINT uId); void Open(const char* pFileName, UINT uId);
void Play(UINT uTimes = 1); void Play(UINT uTimes = 1);
/** /**
@brief @brief Pause play
*/ */
void Pause(); void Pause();
/** /**
@brief @brief Resume play
*/ */
void Resume(); void Resume();
/** /**
@brief @brief Stop play
*/ */
void Stop(); void Stop();
/** /**
@brief @brief Replay
*/ */
void Rewind(); void Rewind();
/** /**
@brief @brief Is Playing
*/ */
bool IsPlaying(); bool IsPlaying();
/** /**
@brief ID @brief Get playing sound's ID
@return ID @return Sound's ID
*/ */
UINT GetSoundID(); UINT GetSoundID();

View File

@ -1 +1 @@
877f92ef1788ddee60729373e99035e25a6cdb5c b3b8c850b5895cbdb53da07310323c031c8b66c0

View File

@ -1,29 +1,28 @@
--Encapsulate SimpleAudioEngine to AudioEngine,Play music and sound effects. --Encapsulate SimpleAudioEngine to AudioEngine,Play music and sound effects.
local M = {} local M = {}
local audioEngineInstance = cc.SimpleAudioEngine:getInstance()
function M.stopAllEffects() function M.stopAllEffects()
audioEngineInstance:stopAllEffects() cc.SimpleAudioEngine:getInstance():stopAllEffects()
end end
function M.getMusicVolume() function M.getMusicVolume()
return audioEngineInstance:getMusicVolume() return cc.SimpleAudioEngine:getInstance():getMusicVolume()
end end
function M.isMusicPlaying() function M.isMusicPlaying()
return audioEngineInstance:isMusicPlaying() return cc.SimpleAudioEngine:getInstance():isMusicPlaying()
end end
function M.getEffectsVolume() function M.getEffectsVolume()
return audioEngineInstance:getEffectsVolume() return cc.SimpleAudioEngine:getInstance():getEffectsVolume()
end end
function M.setMusicVolume(volume) function M.setMusicVolume(volume)
audioEngineInstance:setMusicVolume(volume) cc.SimpleAudioEngine:getInstance():setMusicVolume(volume)
end end
function M.stopEffect(handle) function M.stopEffect(handle)
audioEngineInstance:stopEffect(handle) cc.SimpleAudioEngine:getInstance():stopEffect(handle)
end end
function M.stopMusic(isReleaseData) function M.stopMusic(isReleaseData)
@ -31,7 +30,7 @@ function M.stopMusic(isReleaseData)
if nil ~= isReleaseData then if nil ~= isReleaseData then
releaseDataValue = isReleaseData releaseDataValue = isReleaseData
end end
audioEngineInstance:stopMusic(releaseDataValue) cc.SimpleAudioEngine:getInstance():stopMusic(releaseDataValue)
end end
function M.playMusic(filename, isLoop) function M.playMusic(filename, isLoop)
@ -39,19 +38,19 @@ function M.playMusic(filename, isLoop)
if nil ~= isLoop then if nil ~= isLoop then
loopValue = isLoop loopValue = isLoop
end end
audioEngineInstance:playMusic(filename, loopValue) cc.SimpleAudioEngine:getInstance():playMusic(filename, loopValue)
end end
function M.pauseAllEffects() function M.pauseAllEffects()
audioEngineInstance:pauseAllEffects() cc.SimpleAudioEngine:getInstance():pauseAllEffects()
end end
function M.preloadMusic(filename) function M.preloadMusic(filename)
audioEngineInstance:preloadMusic(filename) cc.SimpleAudioEngine:getInstance():preloadMusic(filename)
end end
function M.resumeMusic() function M.resumeMusic()
audioEngineInstance:resumeMusic() cc.SimpleAudioEngine:getInstance():resumeMusic()
end end
function M.playEffect(filename, isLoop) function M.playEffect(filename, isLoop)
@ -59,43 +58,51 @@ function M.playEffect(filename, isLoop)
if nil ~= isLoop then if nil ~= isLoop then
loopValue = isLoop loopValue = isLoop
end end
return audioEngineInstance:playEffect(filename, loopValue) return cc.SimpleAudioEngine:getInstance():playEffect(filename, loopValue)
end end
function M.rewindMusic() function M.rewindMusic()
audioEngineInstance:rewindMusic() cc.SimpleAudioEngine:getInstance():rewindMusic()
end end
function M.willPlayMusic() function M.willPlayMusic()
return audioEngineInstance:willPlayMusic() return cc.SimpleAudioEngine:getInstance():willPlayMusic()
end end
function M.unloadEffect(filename) function M.unloadEffect(filename)
audioEngineInstance:unloadEffect(filename) cc.SimpleAudioEngine:getInstance():unloadEffect(filename)
end end
function M.preloadEffect(filename) function M.preloadEffect(filename)
audioEngineInstance:preloadEffect(filename) cc.SimpleAudioEngine:getInstance():preloadEffect(filename)
end end
function M.setEffectsVolume(volume) function M.setEffectsVolume(volume)
audioEngineInstance:setEffectsVolume(volume) cc.SimpleAudioEngine:getInstance():setEffectsVolume(volume)
end end
function M.pauseEffect(handle) function M.pauseEffect(handle)
audioEngineInstance:pauseEffect(handle) cc.SimpleAudioEngine:getInstance():pauseEffect(handle)
end end
function M.resumeAllEffects(handle) function M.resumeAllEffects(handle)
audioEngineInstance:resumeAllEffects() cc.SimpleAudioEngine:getInstance():resumeAllEffects()
end end
function M.pauseMusic() function M.pauseMusic()
audioEngineInstance:pauseMusic() cc.SimpleAudioEngine:getInstance():pauseMusic()
end end
function M.resumeEffect(handle) function M.resumeEffect(handle)
audioEngineInstance:resumeEffect(handle) cc.SimpleAudioEngine:getInstance():resumeEffect(handle)
end
function M.getInstance()
return cc.SimpleAudioEngine:getInstance()
end
function M.destroyInstance()
return cc.SimpleAudioEngine:destroyInstance()
end end
local modename = "AudioEngine" local modename = "AudioEngine"

View File

@ -414,8 +414,8 @@ _G.BRIGHT_HIGHLIGHT = ccui.BrightStyle.highlight
_G.WidgetTypeWidget = ccui.WidgetType.widget _G.WidgetTypeWidget = ccui.WidgetType.widget
_G.WidgetTypeContainer = ccui.WidgetType.container _G.WidgetTypeContainer = ccui.WidgetType.container
_G.UI_TEX_TYPE_LOCAL = ccui.TextureResType.UI_TEX_TYPE_LOCAL _G.UI_TEX_TYPE_LOCAL = ccui.TextureResType.localType
_G.UI_TEX_TYPE_PLIST = ccui.TextureResType.UI_TEX_TYPE_PLIST _G.UI_TEX_TYPE_PLIST = ccui.TextureResType.plistType
_G.TOUCH_EVENT_BEGAN = ccui.TouchEventType.began _G.TOUCH_EVENT_BEGAN = ccui.TouchEventType.began
_G.TOUCH_EVENT_MOVED = ccui.TouchEventType.moved _G.TOUCH_EVENT_MOVED = ccui.TouchEventType.moved
@ -449,15 +449,15 @@ _G.SCROLLVIEW_DIR_VERTICAL = ccui.ScrollViewDir.vertical
_G.SCROLLVIEW_DIR_HORIZONTAL = ccui.ScrollViewDir.horizontal _G.SCROLLVIEW_DIR_HORIZONTAL = ccui.ScrollViewDir.horizontal
_G.SCROLLVIEW_DIR_BOTH = ccui.ScrollViewDir.both _G.SCROLLVIEW_DIR_BOTH = ccui.ScrollViewDir.both
_G.SCROLLVIEW_EVENT_SCROLL_TO_TOP = ccui.ScrollviewEventType.SCROLL_TO_TOP _G.SCROLLVIEW_EVENT_SCROLL_TO_TOP = ccui.ScrollviewEventType.scrollToTop
_G.SCROLLVIEW_EVENT_SCROLL_TO_BOTTOM = ccui.ScrollviewEventType.SCROLL_TO_BOTTOM _G.SCROLLVIEW_EVENT_SCROLL_TO_BOTTOM = ccui.ScrollviewEventType.scrollToBottom
_G.SCROLLVIEW_EVENT_SCROLL_TO_LEFT = ccui.ScrollviewEventType.SCROLL_TO_LEFT _G.SCROLLVIEW_EVENT_SCROLL_TO_LEFT = ccui.ScrollviewEventType.scrollToLeft
_G.SCROLLVIEW_EVENT_SCROLL_TO_RIGHT = ccui.ScrollviewEventType.SCROLL_TO_RIGHT _G.SCROLLVIEW_EVENT_SCROLL_TO_RIGHT = ccui.ScrollviewEventType.scrollToRight
_G.SCROLLVIEW_EVENT_SCROLLING = ccui.ScrollviewEventType.SCROLLING _G.SCROLLVIEW_EVENT_SCROLLING = ccui.ScrollviewEventType.scrolling
_G.SCROLLVIEW_EVENT_BOUNCE_TOP = ccui.ScrollviewEventType.BOUNCE_TOP _G.SCROLLVIEW_EVENT_BOUNCE_TOP = ccui.ScrollviewEventType.bounceTop
_G.SCROLLVIEW_EVENT_BOUNCE_BOTTOM = ccui.ScrollviewEventType.BOUNCE_BOTTOM _G.SCROLLVIEW_EVENT_BOUNCE_BOTTOM = ccui.ScrollviewEventType.bounceBottom
_G.SCROLLVIEW_EVENT_BOUNCE_LEFT = ccui.ScrollviewEventType.BOUNCE_LEFT _G.SCROLLVIEW_EVENT_BOUNCE_LEFT = ccui.ScrollviewEventType.bounceLeft
_G.SCROLLVIEW_EVENT_BOUNCE_RIGHT = ccui.ScrollviewEventType.BOUNCE_RIGHT _G.SCROLLVIEW_EVENT_BOUNCE_RIGHT = ccui.ScrollviewEventType.bounceRight
_G.PAGEVIEW_EVENT_TURNING = ccui.PageViewEventType.turning _G.PAGEVIEW_EVENT_TURNING = ccui.PageViewEventType.turning

View File

@ -2,53 +2,54 @@
**Table of Contents** *generated with [DocToc](http://doctoc.herokuapp.com/)* **Table of Contents** *generated with [DocToc](http://doctoc.herokuapp.com/)*
- [Misc Information](#misc-information) - [cocos2d-x v3.0 Release Notes](#user-content-cocos2d-x-v30-release-notes)
- [Requirements](#requirements) - [Misc Information](#user-content-misc-information)
- [Runtime Requirements](#runtime-requirements) - [Requirements](#user-content-requirements)
- [Compiler Requirements](#compiler-requirements) - [Runtime Requirements](#user-content-runtime-requirements)
- [How to run TestCpp](#how-to-run-testcpp) - [Compiler Requirements](#user-content-compiler-requirements)
- [Mac OSX & iOS](#mac-osx--ios) - [How to run tests](#user-content-how-to-run-tests)
- [Android](#android) - [Mac OSX & iOS](#user-content-mac-osx--ios)
- [Windows](#windows) - [Android](#user-content-android)
- [Linux](#linux) - [Windows](#user-content-windows)
- [How to start a new game](#how-to-start-a-new-game) - [Linux](#user-content-linux)
- [Highlights of v3.0](#highlights-of-v30) - [How to start a new game](#user-content-how-to-start-a-new-game)
- [Features in detail](#features-in-detail) - [Highlights of v3.0](#user-content-highlights-of-v30)
- [C++11 features](#c11-features) - [Features in detail](#user-content-features-in-detail)
- [std::function](#stdfunction) - [C++11 features](#user-content-c11-features)
- [Strongly typed enums](#strongly-typed-enums) - [std::function](#user-content-stdfunction)
- [override](#override) - [Strongly typed enums](#user-content-strongly-typed-enums)
- [Removed Objective-C patterns](#removed-objective-c-patterns) - [override](#user-content-override)
- [No more 'CC' prefix for C++ classes and free functions](#no-more-cc-prefix-for-c-classes-and-free-functions) - [Removed Objective-C patterns](#user-content-removed-objective-c-patterns)
- [clone() instead of copy()](#clone-instead-of-copy) - [No more 'CC' prefix for C++ classes and free functions](#user-content-no-more-cc-prefix-for-c-classes-and-free-functions)
- [Singletons use getInstance() and destroyInstance()](#singletons-use-getinstance-and-destroyinstance) - [clone() instead of copy()](#user-content-clone-instead-of-copy)
- [Object is replaced with Ref](#object-is-replaced-with-ref) - [Singletons use getInstance() and destroyInstance()](#user-content-singletons-use-getinstance-and-destroyinstance)
- [getters](#getters) - [Object is replaced with Ref](#user-content-object-is-replaced-with-ref)
- [POD types](#pod-types) - [getters](#user-content-getters)
- [New Renderer](#new-renderer) - [POD types](#user-content-pod-types)
- [Renderer features](#renderer-features) - [New Renderer](#user-content-new-renderer)
- [Auto-batching](#auto-batching) - [Renderer features](#user-content-renderer-features)
- [Auto-culling](#auto-culling) - [Auto-batching](#user-content-auto-batching)
- [Global Z order](#global-z-order) - [Auto-culling](#user-content-auto-culling)
- [Sprite vs. SpriteBatchNode](#sprite-vs-spritebatchnode) - [Global Z order](#user-content-global-z-order)
- [Improved LabelTTF / LabelBMFont / LabelAtlas](#improved-labelttf--labelbmfont--labelatlas) - [Sprite vs. SpriteBatchNode](#user-content-sprite-vs-spritebatchnode)
- [New EventDispatcher](#new-eventdispatcher) - [Improved LabelTTF / LabelBMFont / LabelAtlas](#user-content-improved-labelttf--labelbmfont--labelatlas)
- [Physics Integration](#physics-integration) - [New EventDispatcher](#user-content-new-eventdispatcher)
- [Misc API Changes](#misc-api-changes) - [Physics Integration](#user-content-physics-integration)
- [ccTypes.h](#cctypesh) - [Misc API Changes](#user-content-misc-api-changes)
- [deprecated functions and global variables](#deprecated-functions-and--global-variables) - [ccTypes.h](#user-content-cctypesh)
- [Changes in the Lua bindings](#changes-in-the-lua-bindings) - [deprecated functions and global variables](#user-content-deprecated-functions-and--global-variables)
- [Use bindings-generator tool for lua binding](#use-bindings-generator-tool-for-lua-binding) - [Changes in the Lua bindings](#user-content-changes-in-the-lua-bindings)
- [Bind the classes with namespace to lua](#bind-the-classes-with-namespace-to-lua) - [Use bindings-generator tool for lua binding](#user-content-use-bindings-generator-tool-for-lua-binding)
- [Use ScriptHandlerMgr to manage the register and unregister of Lua function](#use-scripthandlermgr-to-manage-the-register-and-unregister-of-lua-function) - [Bind the classes with namespace to lua](#user-content-bind-the-classes-with-namespace-to-lua)
- [Misc API changes](#misc-api-changes-1) - [Use ScriptHandlerMgr to manage the register and unregister of Lua function](#user-content-use-scripthandlermgr-to-manage-the-register-and-unregister-of-lua-function)
- [Use cc、ccs、ccui gl and sp as module name](#use-ccccsccui-gl-and-sp-as-module-name) - [Misc API changes](#user-content-misc-api-changes-1)
- [Modified functions](#modified-functions) - [Use cc、ccs、ccui gl and sp as module name](#user-content-use-ccccsccui-gl-and-sp-as-module-name)
- [Add some modules](#add-some-modules) - [Modified functions](#user-content-modified-functions)
- [Add more lua bindings](#add-more-lua-bindings) - [Add some modules](#user-content-add-some-modules)
- [Replace some lua-bindings of Class or Struct with lua table](#replace-some-lua-bindings-of-class-or-struct-with-lua-table) - [Add more lua bindings](#user-content-add-more-lua-bindings)
- [Support lua script codes call Object-C codes and Java codes](#support-lua-script-codes-call-object-c-codes-and-java-codes) - [Replace some lua-bindings of Class or Struct with lua table](#user-content-replace-some-lua-bindings-of-class-or-struct-with-lua-table)
- [Add some lua files to store the constants of different modules](#add-some-lua-files-to-store-the-constants-of-different-modules) - [Support lua script codes call Object-C codes and Java codes](#user-content-support-lua-script-codes-call-object-c-codes-and-java-codes)
- [Add some lua files to store the constants of different modules](#user-content-add-some-lua-files-to-store-the-constants-of-different-modules)
# Misc Information # Misc Information
@ -74,7 +75,7 @@
* gcc 4.7 for Linux or Android. For Android ndk-r9 or newer is required. * gcc 4.7 for Linux or Android. For Android ndk-r9 or newer is required.
* Visual Studio 2012 (for Windows) * Visual Studio 2012 (for Windows)
## How to run TestCpp ## How to run tests
### Mac OSX & iOS ### Mac OSX & iOS
@ -136,7 +137,7 @@ Run
## How to start a new game ## How to start a new game
Please refer to [ReadMe](../README.md) Please refer to [ReadMe](../README.md). And there is a [document](https://github.com/chukong/cocos-docs/blob/master/manual/framework/native/getting-started/v3.0/how-to-start-a-new-game/en.md) for it.
# Highlights of v3.0 # Highlights of v3.0
@ -149,6 +150,7 @@ Please refer to [ReadMe](../README.md)
* New UI objects * New UI objects
* [JavaScript remote debugger](https://github.com/cocos2d/cocos-docs/blob/master/manual/framework/native/scripting/javascript/js-remote-debugger/en.md) * [JavaScript remote debugger](https://github.com/cocos2d/cocos-docs/blob/master/manual/framework/native/scripting/javascript/js-remote-debugger/en.md)
* Remote Console support * Remote Console support
* Use [cocos console](https://github.com/cocos2d/cocos2d-console) to create and run project
* Refactor Image - release memory in time and uniform the api of supported file format * Refactor Image - release memory in time and uniform the api of supported file format
* Automatically generated Lua bindings, add LuaJavaBridge and LuaObjcBridge * Automatically generated Lua bindings, add LuaJavaBridge and LuaObjcBridge
* Templated containers * Templated containers

View File

@ -50,6 +50,7 @@
} }
@property(nonatomic, retain) NSTextField* textField; @property(nonatomic, retain) NSTextField* textField;
@property(nonatomic, retain) NSMutableDictionary* placeholderAttributes;
@property(nonatomic, readonly, getter = isEditState) BOOL editState; @property(nonatomic, readonly, getter = isEditState) BOOL editState;
@property(nonatomic, assign) void* editBox; @property(nonatomic, assign) void* editBox;

View File

@ -61,6 +61,7 @@
@implementation CCEditBoxImplMac @implementation CCEditBoxImplMac
@synthesize textField = textField_; @synthesize textField = textField_;
@synthesize placeholderAttributes = placeholderAttributes_;
@synthesize editState = editState_; @synthesize editState = editState_;
@synthesize editBox = editBox_; @synthesize editBox = editBox_;
@ -75,6 +76,7 @@
[textField_ resignFirstResponder]; [textField_ resignFirstResponder];
[textField_ removeFromSuperview]; [textField_ removeFromSuperview];
self.textField = NULL; self.textField = NULL;
[placeholderAttributes_ release];
[super dealloc]; [super dealloc];
} }
@ -88,13 +90,17 @@
editState_ = NO; editState_ = NO;
self.textField = [[[CCCustomNSTextField alloc] initWithFrame: frameRect] autorelease]; self.textField = [[[CCCustomNSTextField alloc] initWithFrame: frameRect] autorelease];
if (!textField_) break; if (!textField_) break;
[textField_ setTextColor:[NSColor whiteColor]]; NSFont *font = [NSFont systemFontOfSize:frameRect.size.height*2/3]; //TODO need to delete hard code here.
textField_.font = [NSFont systemFontOfSize:frameRect.size.height*2/3]; //TODO need to delete hard code here. textField_.textColor = [NSColor whiteColor];
textField_.font = font;
textField_.backgroundColor = [NSColor clearColor]; textField_.backgroundColor = [NSColor clearColor];
[textField_ setup]; [textField_ setup];
textField_.delegate = self; textField_.delegate = self;
[textField_ setDelegate:self];
self.editBox = editBox; self.editBox = editBox;
self.placeholderAttributes = [NSMutableDictionary dictionaryWithObjectsAndKeys:
font, NSFontAttributeName,
[NSColor grayColor], NSForegroundColorAttributeName,
nil];
[[[self getNSWindow] contentView] addSubview:textField_]; [[[self getNSWindow] contentView] addSubview:textField_];
@ -293,18 +299,29 @@ bool EditBoxImplMac::initWithSize(const Size& size)
void EditBoxImplMac::setFont(const char* pFontName, int fontSize) void EditBoxImplMac::setFont(const char* pFontName, int fontSize)
{ {
//TODO: NSString * fntName = [NSString stringWithUTF8String:pFontName];
// if(pFontName == NULL) NSFont *textFont = [NSFont fontWithName:fntName size:fontSize];
// return; if(textFont != nil)
// NSString * fntName = [NSString stringWithUTF8String:pFontName]; [_sysEdit.textField setFont:textFont];
// UIFont *textFont = [UIFont fontWithName:fntName size:fontSize];
// if(textFont != nil)
// [_sysEdit.textField setFont:textFont];
} }
void EditBoxImplMac::setPlaceholderFont(const char* pFontName, int fontSize) void EditBoxImplMac::setPlaceholderFont(const char* pFontName, int fontSize)
{ {
// TODO need to be implemented. NSString *fontName = [NSString stringWithUTF8String:pFontName];
NSFont *font = [NSFont fontWithName:fontName size:fontSize];
if (!font) {
CCLOGWARN("Font not found: %s", pFontName);
return;
}
_sysEdit.placeholderAttributes[NSFontAttributeName] = font;
/* reload placeholder */
const char *placeholder = [_sysEdit.textField.cell placeholderAttributedString].string.UTF8String;
if (placeholder) {
setPlaceHolder(placeholder);
}
} }
void EditBoxImplMac::setFontColor(const Color3B& color) void EditBoxImplMac::setFontColor(const Color3B& color)
@ -314,7 +331,14 @@ void EditBoxImplMac::setFontColor(const Color3B& color)
void EditBoxImplMac::setPlaceholderFontColor(const Color3B& color) void EditBoxImplMac::setPlaceholderFontColor(const Color3B& color)
{ {
// TODO need to be implemented. NSColor *nsColor = [NSColor colorWithCalibratedRed:color.r/255.f green:color.g / 255.f blue:color.b / 255.f alpha:1.0f];
_sysEdit.placeholderAttributes[NSForegroundColorAttributeName] = nsColor;
/* reload placeholder */
const char *placeholder = [_sysEdit.textField.cell placeholderAttributedString].string.UTF8String;
if (placeholder) {
setPlaceHolder(placeholder);
}
} }
void EditBoxImplMac::setInputMode(EditBox::InputMode inputMode) void EditBoxImplMac::setInputMode(EditBox::InputMode inputMode)
@ -357,7 +381,11 @@ const char* EditBoxImplMac::getText(void)
void EditBoxImplMac::setPlaceHolder(const char* pText) void EditBoxImplMac::setPlaceHolder(const char* pText)
{ {
[[_sysEdit.textField cell] setPlaceholderString:[NSString stringWithUTF8String:pText]]; NSAttributedString *as = [[NSAttributedString alloc] initWithString:[NSString stringWithUTF8String:pText]
attributes:_sysEdit.placeholderAttributes];
[[_sysEdit.textField cell] setPlaceholderAttributedString:as];
[as release];
} }
NSPoint EditBoxImplMac::convertDesignCoordToScreenCoord(const Vector2& designCoord, bool bInRetinaMode) NSPoint EditBoxImplMac::convertDesignCoordToScreenCoord(const Vector2& designCoord, bool bInRetinaMode)

View File

@ -1 +1 @@
e8281e5ccfc438a1d097b9704010312801ea192e 16b3ab3a10ddab525554a84cff0bb4a04495256e

View File

@ -73,11 +73,17 @@
[super didRotateFromInterfaceOrientation:fromInterfaceOrientation]; [super didRotateFromInterfaceOrientation:fromInterfaceOrientation];
cocos2d::GLView *glview = cocos2d::Director::getInstance()->getOpenGLView(); cocos2d::GLView *glview = cocos2d::Director::getInstance()->getOpenGLView();
if (glview)
{
CCEAGLView *eaglview = (CCEAGLView*) glview->getEAGLView(); CCEAGLView *eaglview = (CCEAGLView*) glview->getEAGLView();
if (eaglview)
{
CGSize s = CGSizeMake([eaglview getWidth], [eaglview getHeight]); CGSize s = CGSizeMake([eaglview getWidth], [eaglview getHeight]);
cocos2d::Application::getInstance()->applicationScreenSizeChanged((int) s.width, (int) s.height); cocos2d::Application::getInstance()->applicationScreenSizeChanged((int) s.width, (int) s.height);
}
}
} }
//fix not hide status on ios7 //fix not hide status on ios7

View File

@ -76,6 +76,7 @@ public class AppActivity extends Cocos2dxActivity{
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
startActivity(new Intent(Settings.ACTION_WIFI_SETTINGS)); startActivity(new Intent(Settings.ACTION_WIFI_SETTINGS));
finish(); finish();
System.exit(0);
} }
}); });
builder.setCancelable(false); builder.setCancelable(false);

View File

@ -73,11 +73,17 @@
[super didRotateFromInterfaceOrientation:fromInterfaceOrientation]; [super didRotateFromInterfaceOrientation:fromInterfaceOrientation];
cocos2d::GLView *glview = cocos2d::Director::getInstance()->getOpenGLView(); cocos2d::GLView *glview = cocos2d::Director::getInstance()->getOpenGLView();
if (glview)
{
CCEAGLView *eaglview = (CCEAGLView*) glview->getEAGLView(); CCEAGLView *eaglview = (CCEAGLView*) glview->getEAGLView();
if (eaglview)
{
CGSize s = CGSizeMake([eaglview getWidth], [eaglview getHeight]); CGSize s = CGSizeMake([eaglview getWidth], [eaglview getHeight]);
cocos2d::Application::getInstance()->applicationScreenSizeChanged((int) s.width, (int) s.height); cocos2d::Application::getInstance()->applicationScreenSizeChanged((int) s.width, (int) s.height);
}
}
} }
//fix not hide status on ios7 //fix not hide status on ios7

View File

@ -1 +1 @@
8e9998bc900f66fc53ba7d0c15c57e7c989a8ab9 e016dc425c05838a9f9bbfc07a758c197691d505

View File

@ -55,7 +55,8 @@ EditBoxTest::EditBoxTest()
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) #if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
_editPassword->setFont("American Typewriter", 30); _editPassword->setFont("American Typewriter", 30);
#else #else
_editPassword->setFont("fonts/American Typewriter.ttf", 30); _editPassword->setFont("American Typewriter", 80);
_editPassword->setPlaceholderFont("American Typewriter", 80);
#endif #endif
_editPassword->setFontColor(Color3B::GREEN); _editPassword->setFontColor(Color3B::GREEN);
_editPassword->setPlaceHolder("Password:"); _editPassword->setPlaceHolder("Password:");

View File

@ -1176,12 +1176,14 @@ void TMXOrthoVertexZ::onEnter()
// TIP: 2d projection should be used // TIP: 2d projection should be used
Director::getInstance()->setProjection(Director::Projection::_2D); Director::getInstance()->setProjection(Director::Projection::_2D);
Director::getInstance()->setDepthTest(true);
} }
void TMXOrthoVertexZ::onExit() void TMXOrthoVertexZ::onExit()
{ {
// At exit use any other projection. // At exit use any other projection.
Director::getInstance()->setProjection(Director::Projection::DEFAULT); Director::getInstance()->setProjection(Director::Projection::DEFAULT);
Director::getInstance()->setDepthTest(false);
TileDemo::onExit(); TileDemo::onExit();
} }

View File

@ -129,7 +129,7 @@ local function CocosDenshionTest()
if event == "enter" then if event == "enter" then
elseif event == "exit" then elseif event == "exit" then
--SimpleAudioEngine:getInstance():endToLua() AudioEngine.destroyInstance()
end end
end end

@ -1 +1 @@
Subproject commit 70fa1ec93b56f535b9714392ddee7ca53c220bb1 Subproject commit ad62fda3d74918f81df56c95ab91c05cc6a44814

View File

@ -130,7 +130,7 @@ rename_functions = SpriteFrameCache::[addSpriteFramesWithFile=addSpriteFrames ge
Sprite::[initWithFile=init], Sprite::[initWithFile=init],
SpriteBatchNode::[initWithFile=init], SpriteBatchNode::[initWithFile=init],
Touch::[getID=getId], Touch::[getID=getId],
SimpleAudioEngine::[preloadBackgroundMusic=preloadMusic setBackgroundMusicVolume=setMusicVolume getBackgroundMusicVolume=getMusicVolume playBackgroundMusic=playMusic stopBackgroundMusic=stopMusic pauseBackgroundMusic=pauseMusic resumeBackgroundMusic=resumeMusic rewindBackgroundMusic=rewindMusic isBackgroundMusicPlaying=isMusicPlaying willPlayBackgroundMusic=willPlayMusic], SimpleAudioEngine::[preloadBackgroundMusic=preloadMusic setBackgroundMusicVolume=setMusicVolume getBackgroundMusicVolume=getMusicVolume playBackgroundMusic=playMusic stopBackgroundMusic=stopMusic pauseBackgroundMusic=pauseMusic resumeBackgroundMusic=resumeMusic rewindBackgroundMusic=rewindMusic isBackgroundMusicPlaying=isMusicPlaying willPlayBackgroundMusic=willPlayMusic end=destroyInstance],
FileUtils::[loadFilenameLookupDictionaryFromFile=loadFilenameLookup], FileUtils::[loadFilenameLookupDictionaryFromFile=loadFilenameLookup],
Director::[end=endToLua] Director::[end=endToLua]