This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
// create mesh | |
Sprite3D* mesh = Sprite3D::create("mymesh.c3b"); | |
// create the shader | |
GLProgram* shader = GLProgram::createWithFilenames("shaders/lightmap.vert","shaders/lightmap.frag"); | |
// apply shader to mesh | |
GLProgramState* state = GLProgramState::create(shader); | |
mesh->setGLProgramState(state); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <jni.h> | |
#include "platform/android/jni/JniHelper.h" | |
void CppToJava(const char* str, bool flag) | |
{ | |
cocos2d::JniMethodInfo t; | |
if (cocos2d::JniHelper::getStaticMethodInfo( t, | |
// package and class name with slashes rather than dots | |
"com/my/package/JNIExample", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.my.package; | |
import org.cocos2dx.lib.Cocos2dxHelper; | |
import org.cocos2dx.lib.Cocos2dxActivity; | |
public class JNIExample | |
{ | |
static public void JavaFromCpp(String java_str, String [] java_array, boolean flag) | |
{ | |
// run on cocos thread |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <vector> | |
#include <queue> | |
#include <math.h> | |
template<typename T> | |
class Dijkstra | |
{ | |
public: | |
class GraphEdge; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/****** CPlusPlus.h ******/ | |
#include "somelib.h" | |
class MyClass; // forward declaration | |
// c++ has multiple inhereitance so no need for protocol. | |
class MyProtocol | |
{ | |
public: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/****** ObjC.h ******/ | |
#import <somelib.h> | |
@class MyClass; // forward declaration | |
// a protocol is similar to an abstract class in C++ | |
@protocol MyProtocol | |
- (BOOL) protocolFunction; | |
@end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "sqlite3.h" | |
#include "cocos2d.h" | |
sqlite3 *_db = nullptr; | |
// sql query helper function. | |
int sql_query(const char * query,int (*callback)(void*,int,char**,char**) = NULL, void* data = NULL) | |
{ | |
char* errMsg = 0; | |
int result = sqlite3_exec(_db, query, callback, data, &errMsg); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#=============================================================================== | |
# Filename: boost.sh | |
# Author: Pete Goodliffe | |
# Copyright: (c) Copyright 2009 Pete Goodliffe | |
# Licence: Please feel free to use this, with attribution | |
# Modified version | |
#=============================================================================== | |
# |
NewerOlder