Skip to content

Instantly share code, notes, and snippets.

@takashi1975
takashi1975 / AppDelegate.cpp
Last active August 29, 2015 14:24
Cocos2d-x v3.x マルチ解像度 例3 (iPhone 6/6Plus 考慮)
bool AppDelegate::applicationDidFinishLaunching() {
// initialize director
auto director = Director::getInstance();
auto glview = director->getOpenGLView();
if(!glview) {
glview = GLView::create("My Game");
director->setOpenGLView(glview);
}
@takashi1975
takashi1975 / Twitter.h
Last active August 29, 2015 14:15
iOS5 Twitter.framwork
//
// Twitter.h
// XXX
//
// Created by takashi1975 on 2015/02/22.
//
//
#ifndef __XXX__Twitter__
#define __XXX__Twitter__
@takashi1975
takashi1975 / ToggleAppleShowAllFiles.sh
Created February 15, 2015 09:29
Mac 隠しフォルダの 表示/非表示 切り替え
# 隠しフォルダ 表示/非表示 切り替え
if [[ $(defaults read com.apple.finder AppleShowAllFiles) == TRUE ]]
then
defaults write com.apple.finder AppleShowAllFiles FALSE
else
defaults write com.apple.finder AppleShowAllFiles TRUE
fi
# Finder 再起動
killAll Finder
@takashi1975
takashi1975 / ReadMe.txt
Last active August 29, 2015 14:15
build_native.py
Cocos2d-x ver.3.x ... Android用 .soファイル コンパイル時のオプション
(他にもあるのか...わかっていないです^^;
//Help
./build_native.py -h
./build_native.py --help
//Release build (リリースビルド)
./build_native.py -b release
@takashi1975
takashi1975 / Sample.cpp
Last active August 29, 2015 14:15
Cocos2d-x 特定のノード全てに処理 (名前がつけてあるといい)
//
{
newTiledMap->enumerateChildren("xxx", [](Node * node) -> bool {
if (auto sprite = dynamic_cast<Sprite *>(node))
{
//...
}
return false;
@takashi1975
takashi1975 / number.fnt
Created February 8, 2015 07:24
ビットマップフォント について
info face="number" size=32 bold=0 italic=0 charset="" unicode=0 stretchH=100 smooth=1 aa=1 padding=0,0,0,0 spacing=2,2
common lineHeight=55 base=26 scaleW=250 scaleH=32 pages=1 packed=0 alphaChnl=1 redChnl=0 greenChnl=0 blueChnl=0
page id=0 file="number.png"
chars count=10
char id=48 x=0 y=0 width=24 height=32 xoffset=0 yoffset=0 xadvance=24 page=0 chnl=0 letter="0"
char id=49 x=25 y=0 width=24 height=32 xoffset=0 yoffset=0 xadvance=24 page=0 chnl=0 letter="1"
char id=50 x=50 y=0 width=24 height=32 xoffset=0 yoffset=0 xadvance=24 page=0 chnl=0 letter="2"
char id=51 x=75 y=0 width=24 height=32 xoffset=0 yoffset=0 xadvance=24 page=0 chnl=0 letter="3"
char id=52 x=100 y=0 width=24 height=32 xoffset=0 yoffset=0 xadvance=24 page=0 chnl=0 letter="4"
char id=53 x=125 y=0 width=24 height=32 xoffset=0 yoffset=0 xadvance=24 page=0 chnl=0 letter="5"
@takashi1975
takashi1975 / .gitignore (for *.xcodeproj)
Last active August 29, 2015 14:14
Gist 備忘録 〜 何度も...何度でも忘れる自分へ 〜
XCode プロジェクトファイル(*.xcodeproj)があるフォルダに 以下の .gitignore ファイルを置くといい。
(個々のユーザー設定の情報がコミットされない)
[.gitignore]
xcuserdata/
project.xcworkspace/
@takashi1975
takashi1975 / Sample.cpp
Last active August 29, 2015 14:14
C++11 std::find_if ループ検索例
//Cocos2d-x Layer での使用例を想定
{
auto children = this->getChildren();
auto func = [](Node * node){
bool result = false;
{
//TODO: 判定条件
if (/*判定条件*/)
{
@takashi1975
takashi1975 / HelloWorld.cpp
Created January 27, 2015 00:56
Cocos2d-x 非同期処理
std::mutex mtx;
void HelloWorld::init()
{
do {
if (! Layer::init() ) {
return false;
}
// 別スレッドを生成して引数を渡して実行
@takashi1975
takashi1975 / hoge.cpp
Last active August 29, 2015 14:13
今更 c++ シリーズ [static変数の初期化]
#include "hoge.h"
//static変数の初期化
int hoge::_hoge = 0;
hoge::hoge()
{
//...
}