Skip to content

Instantly share code, notes, and snippets.

//※SCREEN_WIDTHは1280、SCREEN_HEIGHTは720
//実機の画面サイズ
Size frameSize = Director::sharedDirector()->getOpenGLView()->getFrameSize();
//setDesignResolutionSize()で指定した画面サイズ(アス比の違う実機では多少変わる)
Size windowSize = Director::getInstance()->getWinSize();
//Live2Dのキャンバスサイズ
float canvasWidth = m_live2DModel->getCanvasWidth();
float canvasHeight = m_live2DModel->getCanvasHeight();
float logicalWidth = abs(VIEW_LOGICAL_LEFT - VIEW_LOGICAL_RIGHT);
float aspect = ((float)SCREEN_WIDTH / SCREEN_HEIGHT);
@xiangyuan
xiangyuan / UIAlertViewCrashFix.h
Last active August 30, 2015 03:27 — forked from joshhudnall/UIAlertViewCrashFix.h
A potential fix to a new crash in iOS 8.3 where UIAlertViews will crash because they expect a different auto rotation behavior than what they are getting.
//
// UIAlertViewCrashFix.h
//
// Created by Josh Hudnall on 4/28/15.
//
//
#import <Foundation/Foundation.h>
@interface UIAlertController (CrashFix)
@xiangyuan
xiangyuan / ..build-protbuf-2.5.0.md
Last active August 29, 2015 14:26 — forked from BennettSmith/..build-protbuf-2.5.0.md
Script used to build Google Protobuf 2.5.0 for use with Xcode 5 / iOS 7. Builds all supported architectures and produces a universal binary static library.

Google Protobuf 2.5.0 - Mac OS X and iOS Support

The script in this gist will help you buid the Google Protobuf library for use with Mac OS X and iOS. Other methods (such as homebrew or direct compilation) have issues that prevent their use. The libraries built by this script are universal and support all iOS device architectures including the simluator.

Get the Script

The easiest way to use this script is to simply clone the gist onto your

@xiangyuan
xiangyuan / cpp
Last active August 29, 2015 14:11 — forked from t-takasaka/cpp
#include "HelloWorldScene.h"
USING_NS_CC;
Scene *HelloWorld::createScene(){
auto scene = Scene::create();
auto layer = HelloWorld::create();
scene->addChild(layer);
return scene;
}
@xiangyuan
xiangyuan / LayerBlur.js
Last active August 29, 2015 14:11 — forked from mutoo/LayerBlur.js
var LayerBlur = cc.Layer.extend({
ctor: function (blurRadius, maskColor) {
this._super();
// create shader program
var program = cc.GLProgram.create(res.blur_vsh, res.blur_fsh);
program.addAttribute(cc.ATTRIBUTE_NAME_POSITION, cc.VERTEX_ATTRIB_POSITION);
program.addAttribute(cc.ATTRIBUTE_NAME_COLOR, cc.VERTEX_ATTRIB_COLOR);
program.addAttribute(cc.ATTRIBUTE_NAME_TEX_COORD, cc.VERTEX_ATTRIB_TEX_COORDS);
program.link();
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := game_shared
LOCAL_MODULE_FILENAME := libgame
#traverse all the directory and subdirectory
define walk
@xiangyuan
xiangyuan / DropboxHost
Last active August 29, 2015 14:06 — forked from yannisxu/DropboxHost
# update 2014-06-19 18:51
# Section Start: dropbox
108.160.166.62 dropbox.com
108.160.165.62 dropbox.com
205.251.196.138 dropbox.com
108.160.166.20 www.dropbox.com
108.160.167.204 www.dropbox.com
108.160.166.13 www.dropbox.com
108.160.165.147 www.dropbox.com
108.160.167.208 www.dropbox.com
- (void) layerPanZoom: (CCLayerPanZoom *) sender
clickedAtPoint: (CGPoint) point
tapCount: (NSUInteger) tapCount
{
NSLog(@"CCLayerPanZoomTestLayer#layerPanZoom: %@ clickedAtPoint: { %f, %f }", sender, point.x, point.y);
if (tapCount == 2) {
// Toggle zooming all the way in and all the way out.
float midScale = (sender.minScale + sender.maxScale) / 2.0;
# Instructrions:
# click on "raw" and copy the link to the .rb file
# from your terminal type: brew install <copy-link>
require 'formula'
class Ctags < Formula
url 'https://github.com/fishman/ctags.git'
homepage 'http://ctags.sourceforge.net/'
version '1.2'
import os
import ycm_core
# These are the compilation flags that will be used in case there's no
# compilation database set (by default, one is not set).
# CHANGE THIS LIST OF FLAGS. YES, THIS IS THE DROID YOU HAVE BEEN LOOKING FOR.
flags = [
'-Wall',
'-Wextra',
'-Wno-long-long',