cocos2d-x-3.0

Awk file not found when Setting Up Cococ2dx-3.5 environment on Windows 7

痞子三分冷 提交于 2019-12-12 06:18:11
问题 I am trying to setup cocos2dx-3.5 environment on Windows 7. Following are my values for the environment variables NDK_ROOT = D:\Android\Cocos2dx\android-ndk-r10d-windows-x86\android-ndk-r10d SDK_ROOT = D:\Android\android-sdk I didnt set ANDROID_NDK_ROOT environment variable as the tutorial that I followed did not set it. [ However if I set it the same value as NDK_ROOT, I get the error that ANDROID_NDK_ROOT variable does not point to the directory] I am testing cpp-empty-test project [android

Why does this downscaling algorithm produce artifacts?

▼魔方 西西 提交于 2019-12-12 04:28:51
问题 I have a scaling algorithm which appears to scale the image to the right size, but produces artefacts(slight image corruption) in the right half of the image. As I am inexperienced using pointers, I suspect I may have blundered with my pointer arithmetic! To run the project on OSX: 1. Download from :https://www.dropbox.com/s/myme1z1mkxjwyjf/artifact.zip?dl=0 Open the xcodeproj file found in proj.ios All code that is of relevance, is in HelloWorldScene.cpp In function test(), you can comment

How to add a sprite that is always on the screen in Cocos2d?

心不动则不痛 提交于 2019-12-12 02:39:15
问题 I'm doing a platformer game using cocos2d-x v3 in c++, where the maps are usually very large, the visible screen follows the object through the map. Let's say I want to show a sprite in the top right corner of the screen and it would be in this position even when the screen is following the object. Using the object position doesn't do it. Is there a way to show a sprite or whatever in the screen and it would be in the screen even when the screen is moving? Ps. I'm super noob in game

Cocos2d-x: How can I draw a resizing rectangle?

故事扮演 提交于 2019-12-11 11:29:43
问题 I'm working on a project with Cocos2d-x 3.4 (wonderful framework BTW :) ). I was wondering how I can draw a simple translucence selection, the same selection you can see on Windows ? http://cdn.maximumpcguides.com/windows-7/wp-content/uploads/2010/11/use-translucent-select-rectangle-2.png I tried to use the DrawNode class, but failed to achieve this :'( I hope that someone can show me the right way to do it, please :-) 回答1: It's pretty easy to draw with DrawNode. Set the origin point on

Weird y-position offset using custom frag shader (Cocos2d-x)

假如想象 提交于 2019-12-11 01:17:07
问题 I'm trying to mask a sprite so I wrote a simple fragment shader that renders only the pixels that are not hidden under another texture (the mask). The problem is that it seems my texture has its y-coordinate offset after passing through the shader. This is the init method of the sprite (GroundZone) I want to mask: bool GroundZone::initWithSize(Size size) { // [...] // Setup the mask of the sprite m_mask = RenderTexture::create(textureWidth, textureHeight); m_mask->retain(); m_mask-

Error when trying to compile using sqlite3_open in Visual Studio 2013

南笙酒味 提交于 2019-12-10 15:39:16
问题 I'm working in a Cocos2dx (c++) win 32 project and trying to use sqlite to save the game data. My knowledge of c++ / Visual Studio is very limited right now. This is part of the code that I'm trying to compile. #include <sqlite3\include\sqlite3.h> ... void HelloWorld::SaveAndLoadTest() { sqlite3 *pdb = NULL; sqlite3_open("writablePath", &pdb); ... } But when I try to compile the line with the sqlite3_open command I get the following error: Error 7 error LNK2019: unresolved external symbol

Back and Home buttons pressed event for Android devices (cocos2d-x 3)

萝らか妹 提交于 2019-12-10 14:17:29
问题 I have done this to catch Home and Back buttons press events on android devices: Overrided void Layer::onKeyReleased(EventKeyboard::KeyCode keyCode, Event* event) function like this: void MyLayer::onKeyReleased(EventKeyboard::KeyCode keyCode, Event* event) { if (keyCode == EventKeyboard::KeyCode::KEY_BACKSPACE /*KeyboardEvent::KeyCode::Menu(KEY_BACKSPACE)*/) { CCLOG("You pressed back button"); Director::getInstance()->end(); exit(0); } else if (keyCode == EventKeyboard::KeyCode::KEY_HOME) {

How to add vibration to cocos2d-x 3.2 on Android and iOS devices?

余生长醉 提交于 2019-12-08 07:54:50
问题 I want to vibrate my device in one of my slider functionality, using cocos2d-x 3.2. I followed some of reference links regarding this on the official forums but I'm still stumped. Can anyone help me? 回答1: After Searching a lot , Finally i am done with my Vibrate Function in Cocos2d-x 3.2 for android. There is one Vibrator Class. Vibrator.h #if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) #include <jni.h> #include <android/log.h> #include "platform/android/jni/JniHelper.h" #endif #define CLASS

Cocos2d-x v3 Cannot override forward function Draw

北战南征 提交于 2019-12-06 10:05:00
问题 //in my .h file virtual void draw(); //in .cpp void GameLayer:draw() { Layer::draw(); //draw code goes here } It shows cannot override forward function node::draw() As far as I know, it was working on the old versions. Is there any new approach in cocos2d-x 3.0? Thanks in advance. 回答1: in v3.0 overriding the draw() method has changed. try in .h: virtual void draw(Renderer* renderer, const kmMat4& transform, bool transformUpdated); try in cpp: void draw(Renderer* renderer, const kmMat4&

how to declare label in global class (helloworld.h) with cocos2d-x v3.2?

别来无恙 提交于 2019-12-06 04:57:35
I'm creating a 2d platform game with cocos2d-x v3.2 (c++) and i'm using label. cocos2d-x v3.0 (c++) declared like cocos2d::LabelTTF* currentScore; cocos2d-x v2.2.2 (c++) declared like cocos2d::CCLabelTTF* currentScore; cocos2d-x v3.2(c++) how to declare label in global class(helloworld.h) i have try like HelloWorld.h class HelloWorld : public cocos2d::LayerColor { public: virtual bool init(); cocos2d::LabelTTF* currentScore; //semantic issue(LabelTTF deprecared) }; #endif HelloWorld.cpp bool HelloWorld::init() { currentScore = LabelTTF::create("", "Arial", 40); //semantic issue(LabelTTF