Skip to content

Instantly share code, notes, and snippets.

@takashi1975
takashi1975 / Geospatial.swift
Last active November 16, 2017 15:59
Swift4 標高API
import CoreLocation
class Geospatial: NSObject {
//JSON 全体の構成
struct Json: Codable {
let elevation: Double
let hsrc: String
}
@takashi1975
takashi1975 / code.swift
Last active November 16, 2017 11:14
Swift4 GoogleMap(GMSMapView)の中心にMarkerを置く
//表示している地図の中心の緯度経度
public static func centerCoordinate(mapView: GMSMapView) -> CLLocationCoordinate2D {
let frame = mapView.frame
let pos = CGPoint(x:mapView.center.x - frame.origin.x,
y:mapView.center.y - frame.origin.y);
//中央の座標
let coordinate = mapView.projection.coordinate(for: pos)
return coordinate;
@takashi1975
takashi1975 / XMLMessage.cs
Last active May 9, 2017 09:56
Unity 多言語対応
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.Xml;
/**
* MEMO: 2017.04.19
* とりあえず 指定の書式のxml を読み込む
* エラー処理は基本考慮していない
@takashi1975
takashi1975 / MultiImageButton.cs
Created March 4, 2017 09:22
Unity-UGUI-Multi-image-button
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.EventSystems;
/**
* Buttonの下にImageを追加した場合、Buttonを押した時の色を子供のImageにも追従させる
@takashi1975
takashi1975 / 全てを破棄.cpp
Last active April 18, 2016 13:10
Box2d Memo (for Cocos2d-x ver.3.x)
//world ... b2World
{
//DestroyBody -> DestroyJoint
for (auto body = world->GetBodyList(); body; body = body->GetNext())
{
world->DestroyBody(body);
}
// for (auto joint = world->GetJointList(); joint; joint = joint->GetNext())
// {
@takashi1975
takashi1975 / Sample.cpp
Created April 7, 2016 05:19
C++11 ランダム 例
#include <random>
//処理例
{
//乱数の初期化
std::mt19937 rng;
{
// 非決定的な乱数生成器
std::random_device rnd;
@takashi1975
takashi1975 / AppDelegate.cpp
Last active March 15, 2016 23:37
Cocos2d-x ver.3.7.1 画面解像度 (メモ書き)
//解像度設定
{
//横画面
//const auto designResolutionSize = Size( 480, 320);
//const auto smallResolutionSize = Size( 480, 320);
//const auto mediumResolutionSize = Size(1024, 768);
//const auto largeResolutionSize = Size(2048, 1536);
//縦画面
const auto designResolutionSize = Size( 320, 480);
@takashi1975
takashi1975 / HelloWorldScene.cpp
Last active February 7, 2016 07:11
Box2dを動かしてみた (Cocos2d-x v3.9)
#include "HelloWorldScene.h"
#include "GLES-Render.h"
USING_NS_CC;
#pragma mark
const float HelloWorld::PTM_RATIO = (32.0f);
@takashi1975
takashi1975 / Sample.cpp
Created December 1, 2015 05:29
Cocos2d-x Sprite::create について
const auto fileName = "image.png";
if (auto frame = SpriteFrameCache::getInstance()->getSpriteFrameByName(fileName))
{
if (auto sprite = Sprite::createWithSpriteFrame(frame))
{
this->addChild(sprite);
}
}
else if (FileUtils::getInstance()->isFileExist(fileName))
{
@takashi1975
takashi1975 / Readme.txt
Last active October 29, 2015 23:16
MAC Android Eclipse のインストール
1. Android SDK のダウンロード(解凍後 Application へ移動)
http://developer.android.com/sdk/index.html#Other
2. Eclipse Luna のダウンロード(解凍後 Application へ移動)
https://www.eclipse.org/downloads/
※起動時に以下のコメントが...
「“eclipse”を開くには、以前の Java SE 6 ランタイムをインストールする必要があります。」
対処方法