cocos2d-x

Box2D debug draw in a specific layer

不想你离开。 提交于 2019-12-24 12:43:11
问题 This article tell how to wrap Box2D debug draw in a layer. But I do not understand why it is being drawn in the specific layer. As far as I don't know OpenGL, I don't understand where it is being drawn at all. But my problem is that I want to draw in a specific layer, so that I could put that layer on top of all layers and make Box2D shapes always visible. Today I have found the solution how to do debug draw Box2D shapes in C++ but I cannot draw in a specific layer. Could you help me

Cocos2dx Android I'm broken phenomenon after the launch is an image sprite onResume Activity

梦想与她 提交于 2019-12-24 11:44:17
问题 CCTexture2D *t = new CCTexture2D(); t->initWithData(imageData, kCCTexture2DPixelFormat_RGBA8888, sprite->getTexture()->getPixelsWide(), sprite->getTexture()->getPixelsHigh(), sprite->getTexture()->getContentSize()); CCSprite *ret = CCSprite::createWithTexture(t); In this way, only the title and sprite-like phenomenon is created. CCSprite *ret the effect of the water on the Beach the Sprite to customize the image. IOS, Android, without any problems, the onPause ()-> onResume (a) through Ret

Webview on Amazon Fire Stick not responding to controller

二次信任 提交于 2019-12-24 09:56:47
问题 I've got an Android app in Cocos2d-x that uses a WebView to display the front end menu. Currently it's just a mock-up, and just has a URL to a website, which makes it easy to test. If I load the URL of the interface in the Amazon Web App Tester on an Amazon Fire TV stick it works perfectly, and you can navigate the interface happily with the controller. However, when I load the app on the stick, which shows the same URL in a WebView component then the controller has no effect and doesn't

Inter change blue and red channels in bitmap in android

青春壹個敷衍的年華 提交于 2019-12-24 00:37:06
问题 I am using the following code to get pixel data from a bitmap and then passing the array through JNI to cocos2dx. When I render the image in cocos2d-x the Red and Blue channels are reversed. Is there a way to access the red, blue channels separately from the pixel's int value and then inter-change them? JAVA CODE int[] pixels = new int[bitmap.getWidth() * bitmap.getHeight()]; bitmap.getPixels(pixels, 0, bitmap.getWidth(), 0, 0, bitmap.getWidth(), bitmap.getHeight()); int len = bitmap.getWidth

TextField in cocos2d-x 3.0 with background image, text alignment and colored shadow

醉酒当歌 提交于 2019-12-24 00:23:32
问题 I need a input text filed with: background image text aligned to center text color, shadow and shadow color options But I cannot find and appropriate one. I have investigated and found: cocos2d::extension::EditBox which has 1, but 2 and 3 are missing as I understand cocos2d::TextFieldTTF ui::UICCTextField ui::TextField The latest 3 ones don't have 2 and 3 and also are not easy to use in terms of getting input. cocos2d::Label seams to hove what I want (I can use a sprite for background), but

Error SSL archive symbol table (run ranlib)

巧了我就是萌 提交于 2019-12-23 22:22:13
问题 I built OpenSS1.0.2g for SmartfoxClient API 1.6.3 (Cocos2dx v3 - Android - Window10 64bit). It throws error: Error SSL archive symbol table (run ranlib) . My config in Android.mk LOCAL_CFLAGS += -I$(LOCAL_PATH)/boost LOCAL_CFLAGS += -I$(LOCAL_PATH)/OpenSSL/include LOCAL_CFLAGS += -I$(LOCAL_PATH)/../libs/smartfox LOCAL_LDLIBS += -L$(LOCAL_PATH)/lib LOCAL_LDLIBS += -L$(LOCAL_PATH)/OpenSSL/lib LOCAL_LDLIBS += -lboost_system -lboost_thread -lboost_regex -lcrypto -lssl LOCAL_CPPFLAGS +=

How to prevent time-cheating on offline game based on Cocos2dx?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-23 17:45:07
问题 Recently I'm working on a mobile offline game based on Cocos2dx-lua. I found an app on Google Play called GameGuardian which can set the time speed. The app maybe modify the method gettimeofday() in libc.so . I've tried many APIs such as os.time() , SystemClock.elapsedRealtime() , but all failed. Could somebody please give me a way to avoid the effect of the app? 回答1: The only sure method is to make your app contact your game's server to ensure time. Many android games is doing that. "The

Unresolved inclusion: “cocos2d.h” - Cocos2dx

大城市里の小女人 提交于 2019-12-23 16:26:14
问题 when I import the cocos2dx android project in my eclipse I get this warning on my header files Unresolved inclusion: "cocos2d.h" Why is this? Its actually bugging me. The project compiles and runs correctly but I want that to go away. Can someone tell me how to remove that warning and also I want the intellisense feature for my c++ projects in eclipse. I have that feature for my android stuff but not for c++. Please guide me. Thanks in advance :) 回答1: Add cocos2d-x resource to your Eclipse

Call to unavailable function 'system': not available on iOS

北战南征 提交于 2019-12-23 13:08:34
问题 I'm new to cocos2d-x and while compiling my project I get this error. Call to unavailable function 'system': not available on iOS I see this call is no longer applicable but, what can I use to replace it? Any insight would be appreciated! bool FileUtils::removeDirectory(const std::string& path) { #if !defined(CC_TARGET_OS_TVOS) std::string command = "rm -r "; // Path may include space. command += "\"" + path + "\""; if (system(command.c_str()) >= 0) /*System Call Error/Not Availible*/ return

Trying to set up a CCLabelTTF with an integer as part of it's string in Cocos2d-X C++

∥☆過路亽.° 提交于 2019-12-23 10:00:17
问题 So in Objective-C with Cocos2d, I'd use a NSMutableString with format to put a variable (score) into a string. I'd take that string and use a CCLabel to place it on the screen. Using Cocos2D-x, I'm having trouble finding a way to get this result. A simple example would be great. Thanks! 回答1: int score = 35; float time = 0.03; char* name = "Michael"; char text[256]; sprintf(text,"name is %s, time is %.2f, score is %d", name, time, score); CCLabelTTF* label = CCLabelTTF::labelWithString(text,