Skip to content

Instantly share code, notes, and snippets.

View darkdukey's full-sized avatar

Nite Luo darkdukey

View GitHub Profile
@darkdukey
darkdukey / gist:2e65db671bf58b4168fa
Created April 29, 2015 22:23
Setup dev environment for cocos2d-x

Setup dev environment for cocos2d-x

Install homebrew

Start a console window and run following command

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Install android SDK/NDK

When the homebrew installation is finished, run the following command

@darkdukey
darkdukey / nsarray.mm
Last active August 29, 2015 14:17 — forked from jeremy-w/nsarray.mm
//clang++ -std=c++11 -stdlib=libc++ -framework Foundation nsarray.mm -o nsarray
/* Note:
* - libstdc++ has been frozen by Apple at a pre-C++11 version, so you must opt
for the newer, BSD-licensed libc++
* - Apple clang 4.0 (based on LLVM 3.1svn) does not default to C++11 yet, so
you must explicitly specify this language standard. */
/* @file nsarray.mm
* @author Jeremy W. Sherman
*
* Demonstrates three different approaches to converting a std::vector
@darkdukey
darkdukey / vungle crash
Created January 20, 2015 23:18
vungle plugin crash stack
01-20 15:17:09.189: E/AndroidRuntime(5322): FATAL EXCEPTION: GLThread 6519
01-20 15:17:09.189: E/AndroidRuntime(5322): Process: org.cocos2dx.HelloPlugins, PID: 5322
01-20 15:17:09.189: E/AndroidRuntime(5322): java.lang.NoClassDefFoundError: com.vungle.publisher.location.GooglePlayServicesDetailedLocationProvider$a
01-20 15:17:09.189: E/AndroidRuntime(5322): at com.vungle.publisher.location.GooglePlayServicesDetailedLocationProvider.<init>(vungle:18)
01-20 15:17:09.189: E/AndroidRuntime(5322): at com.vungle.publisher.location.GooglePlayServicesDetailedLocationProvider$$InjectAdapter.get(vungle:56)
01-20 15:17:09.189: E/AndroidRuntime(5322): at com.vungle.publisher.location.GooglePlayServicesDetailedLocationProvider$$InjectAdapter.get(vungle:23)
01-20 15:17:09.189: E/AndroidRuntime(5322): at dagger.internal.Linker$SingletonBinding.get(Linker.java:364)
01-20 15:17:09.189: E/AndroidRuntime(5322): at com.vungle.publisher.inject.ConfigurablePublisherModule$$ModuleAdapter$ProvideDetailedLocationProviderProvides
@darkdukey
darkdukey / HelloWorldScene.cpp
Created December 22, 2014 18:22
Example for Cocos Studio
#include "HelloWorldScene.h"
#include "cocostudio/CocoStudio.h"
#include "ui/CocosGUI.h"
USING_NS_CC;
using namespace cocostudio::timeline;
Scene* HelloWorld::createScene()
{
@darkdukey
darkdukey / Android.mk
Created December 15, 2014 23:55
Android.mk for Vungle Plugin
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
$(call import-add-path,$(LOCAL_PATH)/../../cocos2d)
$(call import-add-path,$(LOCAL_PATH)/../../cocos2d/external)
$(call import-add-path,$(LOCAL_PATH)/../../cocos2d/cocos)
LOCAL_MODULE := cocos2dcpp_shared
@darkdukey
darkdukey / MyWidget.cpp
Last active March 20, 2019 06:20
Cocos Studio Event Callback example
#include "MyWidget.h"
#include "ui/UIText.h"
USING_NS_CC;
using namespace std;
using namespace cocos2d::ui;
MyWidget::MyWidget(){}
Widget::ccWidgetTouchCallback MyWidget::onLocateTouchCallback(const string &callBackName)
{
@darkdukey
darkdukey / Design.md
Last active August 29, 2015 14:10
Cocos PackageManager

Package Manager

Package Manager provides a way for developers to easily extend cocos2d-x with plugins

Core Features:

  • Modularize coocs2d-x enable developers to customize the engine for their own game
  • Developers can search, manage and install plugins
  • Update project for the developers when install, remove or update the plugin
  • Developers can share their plugin with others
@darkdukey
darkdukey / gist:2e58ebc03176046fb785
Created November 7, 2014 21:31
Cocos2d-x Plugin for PushNotification
#include "PluginProtocol.h"
#include <map>
#include <list>
#include <string>
using namespace std;
typedef enum
{
@darkdukey
darkdukey / Android.mk
Last active December 10, 2022 14:31
NDK build include all the files under a directory
#traverse all the directory and subdirectory
define walk
$(wildcard $(1)) $(foreach e, $(wildcard $(1)/*), $(call walk, $(e)))
endef
#find all the file recursively under jni/
ALLFILES = $(call walk, $(LOCAL_PATH))
FILE_LIST := $(filter %.cpp, $(ALLFILES))
LOCAL_SRC_FILES := $(FILE_LIST:$(LOCAL_PATH)/%=%)
@darkdukey
darkdukey / PluginProtocal.h
Created July 29, 2014 18:33
AnySDK Ads API
/** @file PluginProtocol.h
*/
#ifndef __CCX_IPLUGIN_H__
#define __CCX_IPLUGIN_H__
#include "PluginParam.h"
#include <vector>
namespace anysdk { namespace framework {