Skip to content

Instantly share code, notes, and snippets.

View ricardoquesada's full-sized avatar

Ricardo Quesada ricardoquesada

View GitHub Profile
@ricardoquesada
ricardoquesada / mega65_gaming_install_guide.md
Last active October 15, 2021 02:55
Instructions for the Mega65 gaming competition

Mega65 gaming competition: how to run the emulator

If you want to run the Mega65 emulator for the [Mega65 x-mas gaming competition][1] follow these steps:

  1. Download the mega65 emulator from here: https://github.lgb.hu/xemu/
  2. Run the xmega65 binary (not the x65 one!)
  3. It will complain about missing rom files and missing SD
    • Click Ok, and let it create the SD image
  • It will enter into an infinite boot loop (don't worry, that's Ok).
@ricardoquesada
ricardoquesada / renderer
Last active May 26, 2016 03:42
cocos2d-x v3.0 renderer pseudo code
#
# cocos2d-x v3.0 renderer
#
# for further info read: https://docs.google.com/document/d/17zjC55vbP_PYTftTZEuvqXuMb9PbYNxRFu0EGTULPK8/edit#heading=h.3kpkd5ktk6p1
#
# Populates the VBO.
# It stops if the command is a group or if
# the VBO's capacity is not enough for the current Quad Command
@ricardoquesada
ricardoquesada / Application.mk
Created January 29, 2016 03:07
Application.mk with armeabi-v7a support
APP_STL := gnustl_static
APP_CPPFLAGS := -frtti -DCC_ENABLE_CHIPMUNK_INTEGRATION=1 -std=c++11 -fsigned-char
APP_LDFLAGS := -latomic
APP_ABI := armeabi-v7a
ifeq ($(NDK_DEBUG),1)
APP_CPPFLAGS += -DCOCOS2D_DEBUG=1
APP_OPTIM := debug
@ricardoquesada
ricardoquesada / main.cpp
Last active January 29, 2016 03:06
cocos2d-x with android GL trace support
#include "AppDelegate.h"
#include "cocos2d.h"
#include "platform/android/jni/JniHelper.h"
#include <jni.h>
#include <android/log.h>
#include <dlfcn.h>
#define LOG_TAG "main"
#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG,LOG_TAG,__VA_ARGS__)
@ricardoquesada
ricardoquesada / math.cpp
Created July 19, 2013 15:20
calls to different libraries
class Matrix4
{
mult(const Matrix4& other) {
#if defined(CC_PLATFORM_IOS) || defined(CC_PLATFORM_MAC)
GLKMatrix4Multiply(...);
#elif defined(CC_PLATFORM_ANDROID) && defined(__ARMV7__)
// Use ne10 library
ne10XXXXX();
@ricardoquesada
ricardoquesada / gist:4261879
Created December 11, 2012 20:28
Using blocks without leaks
@implementation HelloWorldLayer
// on "init" you need to initialize your instance
-(id) init
{
// always call "super" init
// Apple recommends to re-assign "self" with the "super's" return value
if( (self=[super init]) ) {
@ricardoquesada
ricardoquesada / gist:3940675
Created October 23, 2012 18:40
how to run the cocos2d-html5 tests
$ git clone git://github.com/cocos2d/cocos2d-html5.git
$ cd cocos2d-html5
$ git submodule update --init
$ python -m SimpleHTTPServer
... and run a brower and open it in localhost:8000/tests
@ricardoquesada
ricardoquesada / jsb_constants_cocos2d.js
Created October 12, 2012 03:25
jsb_constants_cocos2d.js with ctor for native objects
//
// cocos2d constants
//
cc.DIRECTOR_PROJECTION_2D = 0;
cc.DIRECTOR_PROJECTION_3D = 1;
cc.TEXTURE_PIXELFORMAT_RGBA8888 = 0;
cc.TEXTURE_PIXELFORMAT_RGB888 = 1;
cc.TEXTURE_PIXELFORMAT_RGB565 = 2;
cc.TEXTURE_PIXELFORMAT_A8 = 3;
@ricardoquesada
ricardoquesada / CCARRAY_FOREACH
Created December 1, 2010 14:07
CCARRAY_FOREACH fixed ?
#define CCARRAY_FOREACH(__array__, __object__) \
if (__array__ && __array__->data->num > 0) \
for(id *arr = __array__->data->arr, *end = __array__->data->arr + __array__->data->num-1; \
arr <= end && ((__object__ = *arr) != nil || true); \
arr++)
Copyright (C) 2013 Henry van Merode. All rights reserved.
Copyright (C) 2015 Chukong Technologies.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARI