Skip to content

Instantly share code, notes, and snippets.

View akehoyayoi's full-sized avatar

Yohei Okaya akehoyayoi

View GitHub Profile
@akehoyayoi
akehoyayoi / gist:0466d26ea82d7c74069a
Created May 4, 2015 09:18
cocos2d-x v2系でRPG風に一文字ずつ遅延して表示するクラス
// header file
#include "cocos-ext.h"
#include "CCPointer.h"
// https://github.com/ivzave/cocos2dx-ext/blob/master/CCPointer.h
USING_NS_CC;
USING_NS_CC_EXT;
class CCLabelTTFWithAnimation
@akehoyayoi
akehoyayoi / Version.scala
Created September 27, 2014 04:45
汎用Versionクラス
case class Version(v: Int *) extends Ordered[Version] {
def compare(other: Version) = {
c(v,other.v)
}
def c(v1: Seq[Int], v2: Seq[Int]): Int = {
val diff = v1.headOption.getOrElse(0) compare v2.headOption.getOrElse(0)
if(diff == 0) c(v1.tail,v2.tail) else diff
}
}
@akehoyayoi
akehoyayoi / HelloWorld.cpp
Last active August 29, 2015 13:56
cocos2d-x v3.0 SceneEditorの読み込みサンプル
bool HelloWorld::init()
{
if (!Layer::init()) return false;
auto reader = cocostudio::SceneReader::getInstance();
// SceneEditorデフォルトに存在するサンプルを読み込む
auto node = reader->createNodeWithSceneFile("FightScene.json");
auto hero = node->getChildByTag(10005); // サンプル上のheroに設定されていたtagの値
@akehoyayoi
akehoyayoi / gist:6102407
Created July 29, 2013 06:05
json4s(lift-json)がバグってる件
// "org.json4s" %% "json4s-native" % "3.2.4"
import org.json4s._
import org.json4s.native.Serialization._
case class AAA(a : Option[Long],b : Option[Long],c : Option[Long])
object JsonTest {
def toJson[Value <: AnyRef](any : Value) : String = {
write(any)(DefaultFormats)