Weitere ähnliche Inhalte
Ähnlich wie Goだけでモバイルアプリを作ろう (20)
Mehr von Takuya Ueda (16)
Kürzlich hochgeladen (11)
Goだけでモバイルアプリを作ろう
- 2. アジェンダ
● 自己紹介
● Go Mobileとは?
● どうやって作るのか?
● イベント
● spriteパッケージ
● その他できること
● Google Playに公開するまでの道のり
- 7. Go Mobileとは
● Goでモバイルアプリを作るツール群
○ iOS / Androidに対応
○ golang.org/x/mobile
● 2通りのスタイル
○ Goだけで書く
⇒ OpenGL を使う
○ 一部だけ書く
⇒ Java, Obj-c/Swiftから
参考:https://github.com/golang/go/wiki/Mobile
- 10. gomobileコマンド
■ gomobile init
● ツールチェインのインストールや初期化を行う
● 最初の1回だけ実行すればよい
■ gomobile build
● ビルドを行う
● apk(Android)やapp(iOS)の生成を行う
■ gomobile install
● gomobile build後にadb installまで行う
● Android限定
PCで動かす場合は
go buildで行う
- 11. Go Mobileのパッケージ
■ glパッケージ
● golang.org/x/mobile/gl
● OpenGL ES で頑張る
■ eventパッケージ
● golang.org/x/mobile/event/touch
● golang.org/x/mobile/event/paint
● golang.org/x/mobile/event/lifecycle など
■ spriteパッケージ
● golang.org/x/mobile/exp/sprite
● 2次元のシーングラフ
- 18. テクスチャのロード
■ アセットのオープン
a, err := asset.Open("gopher.png")
■ 画像のデコード
img, err := image.Decode(a)
■ テクスチャのロード
t, err := eng.LoadTexture(img)
assetsディレクトリ以下の
ファイルを見に行く
- 23. アフィン変換行列の計算
■ 親ノードから子ノードへ
親ノードの変換結果に子ノードの変換行列を
掛けわせて子ノードの描画位置を決める
root
n
eng.SetTransform(root, f32.Affine{
{2, 0, 5},
{0, 2, 5},
})
eng.SetTransform(n, f32.Affine{
{100, 0, 10},
{0, 100, 10},
})
2x2, (5, 5)
200x200, (25, 25)
- 29. Google Play に公開するまでの道のり
● Goでモバイルアプリを書く
● apkを作る
○ gomobile build pkg_name
● アイコンを作る
○ apkにresがない
● apkにresを突っ込む
○ apk-toolで一度展開して突っ込む
● 署名+zipaligne