SlideShare a Scribd company logo
Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 1
Happy Creation, Play the Development!
1ソースで作る!
マルチプラットフォームアプリケーション
2018/08/03 Delphi Community Edition Meet up
エンバカデロ・テクノロジーズ Delphi MVP
株式会社シリアルゲームズ 取締役
細川 淳
Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 2
Happy Creation, Play the Development!
細川 淳 (Twitter: @pik)
• 株式会社シリアルゲームズ
• エンバカデロ・テクノロジーズ Delphi MVP
• 最初に触ったマイコン: MZ-80K
• 最初に触った言語: SHARP BASIC
• 最初に触った統合開発環境:Turbo Pascal 5.0
https://edn.embarcadero.com/museum/antiquesoftware
~2001 Windows 版プログラマ
V3 Windows 版メインプログラマ
C++Builder 製
Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 3
Happy Creation, Play the Development!
Delphi とは!
Delphi Community Edition がリリースされた!というのはそこそこ大きな
ニュースになったみたいで「窓の杜」や「CodeZine」「クラウドWatch」
などに掲載されたのはご存じの通りです。
このニュースを見た方々で昔 Delphi を触っていた方は「ほお」と思った事
と思います。
しかし、そもそも Delphi の黄金時代を知らない方々は「Delphi??」って
なったのではないでしょうか?
ということで、まずは Delphi の紹介です。
Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 4
Happy Creation, Play the Development!
Delphi 概要
Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 5
Happy Creation, Play the Development!
Delphi とは
• マルチプラットフォームアプリケーション開発環境
– Windows / macOS / iOS / Android / Linux (Enterprise Edition 以上)
– IDE 自体は Windows でのみ動作(VMWare 上の Windows で OK)
• ネイティブ
– Intel, ARM のコンパイラ搭載で Android さえもネイティブコードになる
• 1バイナリ
– ランタイムやVMを必要としない
• GUI 構築が異常に簡単
– コントロールの Drag & Drop 構築の走り
Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 6
Happy Creation, Play the Development!
Delphi とは
• 1ソース
– なんといってもこれ!
– プロジェクトマネージャでターゲットを切り替えるだけ!!!
ここを切り替えるだけ!
Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 7
Happy Creation, Play the Development!
Delphi で出来ること
• 3D もお手の物です
– なお Delphi が 3D もお手の物だとしても、僕自身はお手の物
ではないので、割愛します…
Delphi で 3D といえば
でおなじみの中山さんの
GitHub リポジトリより
Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 8
Happy Creation, Play the Development!
Drag & Drop 形式の GUI 構築
Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 9
Happy Creation, Play the Development!
ビジュアル開発
• コンポーネントによるビジュアル開発
コンポーネント(部品)を
D&Dで配置します
Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 10
Happy Creation, Play the Development!
ビジュアル開発
• 2way-tools
オブジェクトインスペクタで
・プロパティ(部品の属性)の変更
・イベントの生成
ができます
これらは全てコードとして生成されます。
Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 11
Happy Creation, Play the Development!
ビジュアル開発
置いたコンポーネントが
自動的にクラスの変数に!
イベントがメソッドとして
自動的に宣言される!
Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 12
Happy Creation, Play the Development!
ライブラリ / API について
Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 13
Happy Creation, Play the Development!
Delphi のライブラリ
ライブラリについて
• Runtime Library (RTL)
– 名前空間 : System
– VCL / FMX 共通で基礎となるライブラリ
• Visual Component Library (VCL)
– 名前空間 : Vcl
– Windows 専用のライブラリ
– Win32 をラッピングしたものです
– ソースコードが公開されています。
• FireMonkey (FMX)
– 名前空間 : FMX
– マルチプラットフォーム用のライブラリ
– XE2 で追加されました。
– ソースコードが公開されています。
• 一部 Object Pascal ではない記述があります (Android Activity 部)
Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 14
Happy Creation, Play the Development!
RTL のマルチプラットフォームサポートルーチン(一部)
– ファイル関係
• TPath, TDirectory, TFile
– 通信
• Beacon
• Bluetooth
• THttpClient
– 非同期系
• スレッド
• ダイアログ
参考:マルチデバイス アプリケーションでの RTL の使用
http://docwiki.embarcadero.com/RADStudio/Tokyo/ja/%E3%83%9E%E3%83%AB%E3%83%81%E3
%83%87%E3%83%90%E3%82%A4%E3%82%B9_%E3%82%A2%E3%83%97%E3%83%AA%E3%
82%B1%E3%83%BC%E3%82%B7%E3%83%A7%E3%83%B3%E3%81%A7%E3%81%AE_RTL_%E3
%81%AE%E4%BD%BF%E7%94%A8
Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 15
Happy Creation, Play the Development!
OS API
– Win32API, macOS (Cocoa), iOS, Android
– そのままコール可能!
Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 16
Happy Creation, Play the Development!
Delphi で出来ること
• API 直接呼び出し
– API をラッピングせずに呼び出せます。
uses
Macapi.ObjectiveC,
Macapi.CocoaTypes,
Macapi.Foundation,
Macapi.AppKit,
FMX.Platform.Mac
procedure SetMinSize(const iForm: TForm; const iMinW, iMin: Integer);
var
Wnd: NSWindow; // OS X 用のクラスがそのまま使えてる
Size: NSSize; // こっちも
begin
Wnd := WindowHandleToPlatform(iForm.Handle).Wnd; // NSWindow を取り出す
Size.width := iMinW;
Size.height := iMinH;
Wnd.setContentMinSize(Size); // そのまま呼び出せる
end;
macOS のコードを呼び出す例
Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 17
Happy Creation, Play the Development!
Delphi で出来ること
• API 直接呼び出し
– Jar リンケージ
• Jar ファイルを追加すると自動的に dex ファイルに組み込まれます。
• Java2OP を使えば Jar ファイルへのブリッジファイルが自動で生成されます。
uses
Androidapi.JNI.JavaTypes,
Androidapi.JNI.GraphicsContentViewText,
FMX.Helpers.Android;
procedure StartIntent;
var
Intent: JIntent;
begin
Intent := TJIntent.Create;
Intent
.setAction(TJIntent.JavaClass.ACTION_VIEW)
.setData(StrToJURI('URLとか'));
try
SharedActivity.startActivity(intent);
except
on E: Exception do
Log.e(E.Message);
end;
end;
Android のコードを呼び出す例
Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 18
Happy Creation, Play the Development!
FireMonkey について
Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 19
Happy Creation, Play the Development!
FireMonkey の仕組み
• 自分で描画!
– 使う API 群は各 OS のネイティブを使います
• Windows DirectX
• macOS OpenGL
• iOS OpenGL ES
• Android OpenGL ES
– 基本的にベクターグラフィクス
• Bitmap を中に埋め込むこともできます
– 自分で描画しているので何でもあり!
• 全てのコントロールがコンテナになれます!
– IDE は Windows で動いているにも関わらず他の見た目を表示で
きます!
Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 20
Happy Creation, Play the Development!
FMX Control
FMX Control
FMX Control
FireMonkey World
Native Layer
各 OS に依存した構造上に自分で描画しています
FMX Control は「絵」!
OS から見ると実体はありません!
Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 21
Happy Creation, Play the Development!
自分で描画しているので UI すら 3D にできます
Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 22
Happy Creation, Play the Development!
見た目サンプル
Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 23
Happy Creation, Play the Development!
Style を適用した見た目サンプル
Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 24
Happy Creation, Play the Development!
マルチプラットフォーム
開発環境について
Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 25
Happy Creation, Play the Development!
• Windows の開発
– Windows PC だけで OK !
• macOS の開発
– macOS 実機が必要なので Mac が必要です。
– Xcode Command Line Tools も必要です。
• iOS の開発
– macOS 開発で必要なもの(Mac, Xcode)
– iOS Developer License
• Android の開発
– ハードウェアは Windows PC で OK です。
– Android SDK, Android NDK が必要です
• ただし、この2つは Delphi をインストールするとインストールされます。
– インストールしないことも可能です
• Linux の開発
– Ubuntu, Red Had および、それぞれの SDK が必要です
– Community Edition では使えません。Enterprise Edition 以上が必要です。
Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 26
Happy Creation, Play the Development!
マルチプラットフォーム開発を試すには
• まずは Android で。
– Windows PC と Delphi, USB ケーブルだけあれば良い
– お金が掛からない
• Google Play に出すためには有料の開発者登録が必要です。
• Windows のアプリと Android のアプリを同時に作れます。
– FireUI, Style, TMultiView などの機能を使えば UI も1つのコードで作れます。
– つまり、デスクトップアプリケーションとモバイルアプリケーションを同時に作成可
能です。
USB Cable
ADB
Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 27
Happy Creation, Play the Development!
• iOS の場合
Lightning Cable
Network
Windows PC
Mac
iPhone
PAClient
PAServer
Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 28
Happy Creation, Play the Development!
デモ
Hello, World!
Windows, macOS, iOS, Android へのデプロイ
会場のネットワークの都合により
デモできず
Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 29
Happy Creation, Play the Development!
単純な Hello, World! のため、ソースは割愛
Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 30
Happy Creation, Play the Development!
デモ
Android で intent を使う
Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 31
Happy Creation, Play the Development!
uMain.fmx
コントロールの配置
Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 32
Happy Creation, Play the Development!
uMain.pas
// フォームのソースの implementation 以下
implementation
{$R *.fmx}
uses
uIntent; // こっちに処理の実態が書いてある
procedure TfrmMain.Button1Click(Sender: TObject);
begin
{$IFDEF ANDROID} // Android でしかコンパイルが走らないようにする
OpenIntent(ImageControl1.Bitmap);
{$ENDIF}
end;
end.
Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 33
Happy Creation, Play the Development!
uIntent.pas
unit uIntent;
{$IFNDEF ANDROID}
{$WARNINGS OFF}
interface
implementation
end.
{$ENDIF}
interface
uses
System.SysUtils
, System.Messaging
, FMX.Graphics
;
procedure OpenIntent(const iBmp: TBitmap);
implementation
Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 34
Happy Creation, Play the Development!
uIntent.pas
uses // Android のヘッダー uses すると Android の API が呼べるようになる
Androidapi.JNI.GraphicsContentViewText
, Androidapi.JNI.Os
, Androidapi.JNI.App
, Androidapi.JNI.Net
, Androidapi.JNI.JavaTypes
, Androidapi.Helpers
, FMX.Helpers.Android
, FMX.Surfaces
, FMX.Types
, FMX.Forms
;
// Intent の戻り値からビットマップを取得する処理
procedure GetImage(const iBmp: TBitmap; const iMsg: TMessageResultNotification);
var
Intent: JIntent; // Android のクラス!
Uri: Jnet_Uri; // Android のクラス!
Stream: JInputStream; // Android のクラス!
ResultBmp: JBitmap; // Android のクラス!
Surface: TBitmapSurface;
begin
Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 35
Happy Creation, Play the Development!
uIntent.pas
// エラーと nil チェック
if iBmp = nil then
Exit;
iBmp.Clear(0);
if iMsg.ResultCode <> TJActivity.JavaClass.RESULT_OK then
Exit;
Intent := iMsg.Value;
if Intent = nil then
Exit;
Uri := Intent.getData; // API が普通に呼べる
if Uri = nil then
Exit;
Stream := TAndroidHelper.Activity.getContentResolver.openInputStream(Uri); // API が普通に呼べる
if Stream = nil then
Exit;
ResultBmp := TJBitmapFactory.JavaClass.decodeStream(Stream); // API が普通に呼べる
if ResultBmp = nil then
Exit;
Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 36
Happy Creation, Play the Development!
uIntent.pas
// Java 側の Bitmap からビットマップのデータを読み取って TBitmap に割り付ける
Surface := TBitmapSurface.Create;
try
if JBitmapToSurface(ResultBmp, Surface) then
iBmp.Assign(Surface);
finally
Surface.DisposeOf;
end;
end;
Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 37
Happy Creation, Play the Development!
uIntent.pas
procedure OpenIntent(const iBmp: TBitmap); // 画像を選択する暗黙的 intent を飛ばす
var
MessageId: Integer;
Intent: JIntent;
begin
Intent := TJIntent.JavaClass.init;
Intent
.setAction(TJIntent.JavaClass.ACTION_GET_CONTENT)
.setType(TAndroidHelper.StringToJString('image/*'));
TAndroidHelper.Activity.startActivityForResult(Intent, 0);
MessageId :=
TMessageManager.DefaultManager.SubscribeToMessage( // TMessageResultNotification メッセージの要求
TMessageResultNotification,
procedure(const Sender: TObject; const M: TMessage) // メッセージの受け取りには匿名メソッドが指定できる
begin
GetImage(iBmp, TMessageResultNotification(M));
TMessageManager.DefaultManager.Unsubscribe( // TMessageResultNotification メッセージの解除
TMessageResultNotification,
MessageId);
end
);
end;
Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 38
Happy Creation, Play the Development!
実行イメージ
chooser
暗黙的 intent
TMessageResultNotification の
戻り値に intent が入っている
その intent の data に Uri が
入っている
(普通の Android の戻り値取得と同じ)
Android が適切な画像選択アプリを開く
Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 39
Happy Creation, Play the Development!
1ソース開発
Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 40
Happy Creation, Play the Development!
1ソースを支える技術(一部)
– Style
– Layout
– Anchor
– TMultiView
– FireUI
– FireUI Preview
– マルチデバイス プレビュー
1ソースを支えるフレームワーク
– FireMonkey
– RTL
Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 41
Happy Creation, Play the Development!
デモ
Align
Anchor
Layout
TMultiView
Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 42
Happy Creation, Play the Development!
TMultiView と Layout / Align / Anchor
コントロールの配置
Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 43
Happy Creation, Play the Development!
TMultiView と Layout / Align / Anchor
TMultiView
TLayout: align = Bottom
TLayout: align = Center
TBottom: align =Left TBottom: align = Right
TImageControl: align = client
Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 44
Happy Creation, Play the Development!
TMultiView によるデスクトップとモバイルのワンソース化
Windows Android
TMultiView は端末の大きさによって自動的にスライドメニューになる
Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 45
Happy Creation, Play the Development!
デモ
FireUI
Style
Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 46
Happy Creation, Play the Development!
FireUI
FireUI とは
各プラットフォームや
解像度の異なる端末で
プロパティを変更できる
機能
様々な OS ・端末が
選択できる
例えば画面左上に「戻
る」ボタンを配置して
Android 端末では表示
しない(Visible =
false)といった事がで
きる
Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 47
Happy Creation, Play the Development!
FireUI では設計時に見た目も変わる
macOS
iPhone 5.5 インチ
Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 48
Happy Creation, Play the Development!
Style
Style とは見た目を変える機能
FireMonkey がコントロールを自分で描いている事で可能になった機能です
Default のスタイルは下記にインストールされています
C:¥Users¥Public¥Documents¥Embarcadero¥Studio¥19.0¥Styles
Delphi に最初から入っている Blend スタイル DelphiStyle.com で購入できる Ubuntu スタイル
DelphiStyle.com で購入できる Calypso スタイル※IDE のダークテーマ・ライトテーマは DelphiStyles.com が製作しました
Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 49
Happy Creation, Play the Development!
デモ
マルチデバイスプレビュー
FireUI Live Preview
アプリケーションテザリング
会場のネットワークの都合により
デモできず
Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 50
Happy Creation, Play the Development!
マルチデバイスプレビューとは各プラットフォームでの見た目を一括して表示できる機能
Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 51
Happy Creation, Play the Development!
• FireUI LivePreview (AppPreview)
– デザイン画面を実機でみる機能
– http://docwiki.embarcadero.com/RADStudio/Tokyo/ja/FireUI_%E3%83%A9%E3%8
2%A4%E3%83%96_%E3%83%97%E3%83%AC%E3%83%93%E3%83%A5%E3%
83%BC
– 同じ WiFi ネットワーク内で相互に相手を見れる必要あり
– IDE のオプションで「FireUI ライブプレビューをブロードキャストする」にチェックが必要
任意の名前
パスワードは無しでOK
Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 52
Happy Creation, Play the Development!
マルチデバイスプレビューではフォントやアイコンといった端末に固有の見
た目等は再現できません
FireUI Live Preview では実機で表示されるのでフォントなども実際に使用
される物で表示されます
IDEでは
「リアルタイムにプレビューできるぞ!!」
と表示されているが
フォントの違う実機では
「リアルタイムにプレビューでき」
までしか表示されていない
このことから Label.Width をもう少し広げないといけない事が
デザイン時に判る
Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 53
Happy Creation, Play the Development!
FireUI LivePreview の入手方法
Windows / macOS 用はデフォルトでは下記のフォルダ
C:¥Program Files (x86)¥Embarcadero¥Studio¥19.0¥LivePreview
iOS 用
https://itunes.apple.com/us/app/fireui-app-preview-10.1-berlin/id1090861997
Android 用
https://play.google.com/store/apps/details?id=com.embarcadero.LivePreview101
FireUI LivePreview のソース
C:¥Program Files (x86)¥Embarcadero¥Studio¥19.0¥source¥Tools¥FireUIAppPreview
AppTethering やマルチプラットフォームアプリケーションのサンプルとしても優秀
Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 54
Happy Creation, Play the Development!
Rapid Application Development
Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 55
Happy Creation, Play the Development!
開発を加速させる技術
– Animation / Effect
– GetIt ライブラリマネージャ
– Visual Live Bindings
– データエクスプローラ
– REST コンポーネント / REST デバッガ
Delphi はコンポーネントが「異常」に充実しています(200以上存在)。
これによってほとんどコードを書かずに様々な機能を実現可能です。
たとえば、カメラアプリであれば、コードはたったの1行です。
(TTakePhotoFromCameraAction を使用)
Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 56
Happy Creation, Play the Development!
procedure TForm1.TakePhotoFromCameraAction1DidFinishTaking(Image: TBitmap);
begin
Image1.Bitmap.Assign(Image); // たったこれだけ!
end;
画像は英語版から拝借
Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 57
Happy Creation, Play the Development!
デモ
Animation / Effect
Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 58
Happy Creation, Play the Development!
Animation / Effect は親コントロールに効く
ノーコーディングで GlowEffect(画像周囲の黄
色部分)を掛け、0.2 秒間で0~360度回転する
FloatAnimation が設定されている
Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 59
Happy Creation, Play the Development!
デモ
GetIt ライブラリマネージャ
Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 60
Happy Creation, Play the Development!
GetIt はライブラリマネージャ
他の開発環境で言う NuGet や
CocoaPods のような物です
様々なコンポーネントやライブラリ、
サンプルを取得できます
自作のコンポーネントやライブラリも
申請すれば登録されます
「ScriptGate」で検索すると筆者が
作ったコンポーネントがダウンロード
され使用できます
Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 61
Happy Creation, Play the Development!
デモ
データエクスプローラ
RESTコンポーネント
RESTデバッカ
Visual Live Bindings
会場ではここで米澤さんによる
ライブデモがありました
Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 62
Happy Creation, Play the Development!
注意
Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 63
Happy Creation, Play the Development!
注意
Delphi を使うと簡単にマルチプラットフォームアプリケーションが作れますが、各
OSの作法に則るのが基本です。
例えば、iOS / Android ではメインスレッドを止めてはなりません。
また、ファイル操作も限られています。
特に Android では、アプリケーションは機能に特化した形にして、他のこと(例え
ば「画像を開く」とか「メールを出す」など)は、それに特化したアプリに処理を
委譲します(暗黙的 intent を使う)
これには TTakePhotoFromLibraryAction などを使う事でワンソースにできます
出来ればスタイルも各OSに即したスタイルにすると良いでしょう。
作法を知るため一度は Android Studio / Xcode でアプリケーションを作ってみる
ことをオススメします。

More Related Content

PDF
ソフトウェア開発30年史を振り返りつつ考えるプログラマにとって変わらないもの
PDF
Spring Boot の Web アプリケーションを Docker に載せて AWS ECS で動かしている話
PDF
より高品質なメディアサービスを目指す ABEMA の技術進化
PDF
リーンスタートアップ、アジャイル開発導入事例
PDF
Steam ゲーム内購入 サーバーサイド実装について
PPTX
スマホアプリのSSLサーバ証明書の検証不備について
PDF
Wakamonog6 “ISPのネットワーク”って どんなネットワーク?
ソフトウェア開発30年史を振り返りつつ考えるプログラマにとって変わらないもの
Spring Boot の Web アプリケーションを Docker に載せて AWS ECS で動かしている話
より高品質なメディアサービスを目指す ABEMA の技術進化
リーンスタートアップ、アジャイル開発導入事例
Steam ゲーム内購入 サーバーサイド実装について
スマホアプリのSSLサーバ証明書の検証不備について
Wakamonog6 “ISPのネットワーク”って どんなネットワーク?

What's hot (20)

PPTX
Keycloakのステップアップ認証について
PDF
基礎から学ぶ組み込みAndroid
PDF
導入から 10 年、PHP の trait は滅びるべきなのか その適切な使いどころと弱点、将来について
PDF
株式会社コロプラ『GKE と Cloud Spanner が躍動するドラゴンクエストウォーク』第 9 回 Google Cloud INSIDE Game...
PDF
Grafana LokiではじめるKubernetesロギングハンズオン(NTT Tech Conference #4 ハンズオン資料)
PDF
IIJmio meeting 31 音声通信の世界
PPTX
Docker Tokyo
PDF
「仮想マシンからの移⾏先としてPaaSとKaaS、どちらを選ぶか? #ヤフー名古屋」
PDF
【Unite Tokyo 2019】運用中超大規模タイトルにおけるUnityアップデート課題の解決手法と事例
PPTX
Keycloakの全体像: 基本概念、ユースケース、そして最新の開発動向
PPTX
Amazon SageMakerでカスタムコンテナを使った学習
PDF
Blockchain Startups landscape in Japan (国内ブロックチェーンベンチャーカオスマップ)
PDF
Kubernetes 基盤における非機能試験の deepdive(Kubernetes Novice Tokyo #17 発表資料)
PDF
Goji とレイヤ化アーキテクチャ
PPTX
世界一わかりやすいClean Architecture
PDF
Power Automateってどんな子?(気ままに勉強会#01)
PDF
async/awaitダークサイド is 何
PDF
なんとなく理解するActor 〜Actorと仲良くしよう〜 @DMM.swift #1
PPTX
YoctoをつかったDistroの作り方とハマり方
PDF
Spring Boot × Vue.jsでSPAを作る
Keycloakのステップアップ認証について
基礎から学ぶ組み込みAndroid
導入から 10 年、PHP の trait は滅びるべきなのか その適切な使いどころと弱点、将来について
株式会社コロプラ『GKE と Cloud Spanner が躍動するドラゴンクエストウォーク』第 9 回 Google Cloud INSIDE Game...
Grafana LokiではじめるKubernetesロギングハンズオン(NTT Tech Conference #4 ハンズオン資料)
IIJmio meeting 31 音声通信の世界
Docker Tokyo
「仮想マシンからの移⾏先としてPaaSとKaaS、どちらを選ぶか? #ヤフー名古屋」
【Unite Tokyo 2019】運用中超大規模タイトルにおけるUnityアップデート課題の解決手法と事例
Keycloakの全体像: 基本概念、ユースケース、そして最新の開発動向
Amazon SageMakerでカスタムコンテナを使った学習
Blockchain Startups landscape in Japan (国内ブロックチェーンベンチャーカオスマップ)
Kubernetes 基盤における非機能試験の deepdive(Kubernetes Novice Tokyo #17 発表資料)
Goji とレイヤ化アーキテクチャ
世界一わかりやすいClean Architecture
Power Automateってどんな子?(気ままに勉強会#01)
async/awaitダークサイド is 何
なんとなく理解するActor 〜Actorと仲良くしよう〜 @DMM.swift #1
YoctoをつかったDistroの作り方とハマり方
Spring Boot × Vue.jsでSPAを作る
Ad

Similar to Delphi Community Edition Meet up ! (20)

PDF
Delphi のひみつ!(2015/01/29 CROSS 2015)
PDF
Delphi Debut Tokyo #1 - FireMonkey HD の基本
PDF
Sencha & Delphi Ready Studiy
PDF
ソースコードの共通化
PPTX
DelphiでWin/Macクロスコンパイル
PDF
0621 ndk game
PDF
デブサミ2013 【15-B-2】iOS/Android向け開発をビジュアルに!
PPTX
RAD Studioで始めるマルチデバイス・クロスプラットフォーム開発ワークショップ
PPT
Heliumエンジンの設計と実装
PPTX
Game Development and Automation @ Agile Sapporo 2018 #1
PPTX
どこでも動くゲームを作るためのベタープラクティス
PDF
【16-D-4】3分ではじめるスマホアプリのビジュアル開発
PPTX
DELPHI BOOT CAMP / DELPHIでビジュアル開発に挑戦しよう ◆ DAY1: Delphiで作るはじめてのアプリケーション
PPSX
Windows phone!そういうのもあるのか
PDF
Delphi 言語に見る顕在化する言語のリスクとは?(2013/08/24)
PDF
XNAとはなにか?XNAうれしいところ、うれしくないところ
PPTX
DELPHI BOOT CAMP / DELPHIでビジュアル開発に挑戦しよう ◆ DAY2: DELPHIでUI設計のポイントを学ぼう
PDF
CLRの基礎 - プログラミング .NET Framework 第3版 読書会
PPTX
スマートフォン勉強会 関東 19
PDF
Windowsフォームで大丈夫か?一番良いのを頼む。
Delphi のひみつ!(2015/01/29 CROSS 2015)
Delphi Debut Tokyo #1 - FireMonkey HD の基本
Sencha & Delphi Ready Studiy
ソースコードの共通化
DelphiでWin/Macクロスコンパイル
0621 ndk game
デブサミ2013 【15-B-2】iOS/Android向け開発をビジュアルに!
RAD Studioで始めるマルチデバイス・クロスプラットフォーム開発ワークショップ
Heliumエンジンの設計と実装
Game Development and Automation @ Agile Sapporo 2018 #1
どこでも動くゲームを作るためのベタープラクティス
【16-D-4】3分ではじめるスマホアプリのビジュアル開発
DELPHI BOOT CAMP / DELPHIでビジュアル開発に挑戦しよう ◆ DAY1: Delphiで作るはじめてのアプリケーション
Windows phone!そういうのもあるのか
Delphi 言語に見る顕在化する言語のリスクとは?(2013/08/24)
XNAとはなにか?XNAうれしいところ、うれしくないところ
DELPHI BOOT CAMP / DELPHIでビジュアル開発に挑戦しよう ◆ DAY2: DELPHIでUI設計のポイントを学ぼう
CLRの基礎 - プログラミング .NET Framework 第3版 読書会
スマートフォン勉強会 関東 19
Windowsフォームで大丈夫か?一番良いのを頼む。
Ad

More from Jun Hosokawa (10)

PDF
2016/11/21 社内LT Android TV
PDF
31st DevCamp Eve
PDF
TImageList / TGlyph の使い方
PDF
VCL ユーザーのための FireMonkey 入門
PDF
CnPack の紹介
PDF
Delphi のダメな所
PDF
知っておいて欲しい Android の基礎知識
PDF
Developer Summit 2014, 13-C-4 セッション
PDF
CROSS 2014 - 言語CROSS:Delphi のご紹介
PDF
Dev camp25 lt
2016/11/21 社内LT Android TV
31st DevCamp Eve
TImageList / TGlyph の使い方
VCL ユーザーのための FireMonkey 入門
CnPack の紹介
Delphi のダメな所
知っておいて欲しい Android の基礎知識
Developer Summit 2014, 13-C-4 セッション
CROSS 2014 - 言語CROSS:Delphi のご紹介
Dev camp25 lt

Delphi Community Edition Meet up !

  • 1. Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 1 Happy Creation, Play the Development! 1ソースで作る! マルチプラットフォームアプリケーション 2018/08/03 Delphi Community Edition Meet up エンバカデロ・テクノロジーズ Delphi MVP 株式会社シリアルゲームズ 取締役 細川 淳
  • 2. Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 2 Happy Creation, Play the Development! 細川 淳 (Twitter: @pik) • 株式会社シリアルゲームズ • エンバカデロ・テクノロジーズ Delphi MVP • 最初に触ったマイコン: MZ-80K • 最初に触った言語: SHARP BASIC • 最初に触った統合開発環境:Turbo Pascal 5.0 https://edn.embarcadero.com/museum/antiquesoftware ~2001 Windows 版プログラマ V3 Windows 版メインプログラマ C++Builder 製
  • 3. Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 3 Happy Creation, Play the Development! Delphi とは! Delphi Community Edition がリリースされた!というのはそこそこ大きな ニュースになったみたいで「窓の杜」や「CodeZine」「クラウドWatch」 などに掲載されたのはご存じの通りです。 このニュースを見た方々で昔 Delphi を触っていた方は「ほお」と思った事 と思います。 しかし、そもそも Delphi の黄金時代を知らない方々は「Delphi??」って なったのではないでしょうか? ということで、まずは Delphi の紹介です。
  • 4. Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 4 Happy Creation, Play the Development! Delphi 概要
  • 5. Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 5 Happy Creation, Play the Development! Delphi とは • マルチプラットフォームアプリケーション開発環境 – Windows / macOS / iOS / Android / Linux (Enterprise Edition 以上) – IDE 自体は Windows でのみ動作(VMWare 上の Windows で OK) • ネイティブ – Intel, ARM のコンパイラ搭載で Android さえもネイティブコードになる • 1バイナリ – ランタイムやVMを必要としない • GUI 構築が異常に簡単 – コントロールの Drag & Drop 構築の走り
  • 6. Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 6 Happy Creation, Play the Development! Delphi とは • 1ソース – なんといってもこれ! – プロジェクトマネージャでターゲットを切り替えるだけ!!! ここを切り替えるだけ!
  • 7. Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 7 Happy Creation, Play the Development! Delphi で出来ること • 3D もお手の物です – なお Delphi が 3D もお手の物だとしても、僕自身はお手の物 ではないので、割愛します… Delphi で 3D といえば でおなじみの中山さんの GitHub リポジトリより
  • 8. Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 8 Happy Creation, Play the Development! Drag & Drop 形式の GUI 構築
  • 9. Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 9 Happy Creation, Play the Development! ビジュアル開発 • コンポーネントによるビジュアル開発 コンポーネント(部品)を D&Dで配置します
  • 10. Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 10 Happy Creation, Play the Development! ビジュアル開発 • 2way-tools オブジェクトインスペクタで ・プロパティ(部品の属性)の変更 ・イベントの生成 ができます これらは全てコードとして生成されます。
  • 11. Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 11 Happy Creation, Play the Development! ビジュアル開発 置いたコンポーネントが 自動的にクラスの変数に! イベントがメソッドとして 自動的に宣言される!
  • 12. Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 12 Happy Creation, Play the Development! ライブラリ / API について
  • 13. Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 13 Happy Creation, Play the Development! Delphi のライブラリ ライブラリについて • Runtime Library (RTL) – 名前空間 : System – VCL / FMX 共通で基礎となるライブラリ • Visual Component Library (VCL) – 名前空間 : Vcl – Windows 専用のライブラリ – Win32 をラッピングしたものです – ソースコードが公開されています。 • FireMonkey (FMX) – 名前空間 : FMX – マルチプラットフォーム用のライブラリ – XE2 で追加されました。 – ソースコードが公開されています。 • 一部 Object Pascal ではない記述があります (Android Activity 部)
  • 14. Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 14 Happy Creation, Play the Development! RTL のマルチプラットフォームサポートルーチン(一部) – ファイル関係 • TPath, TDirectory, TFile – 通信 • Beacon • Bluetooth • THttpClient – 非同期系 • スレッド • ダイアログ 参考:マルチデバイス アプリケーションでの RTL の使用 http://docwiki.embarcadero.com/RADStudio/Tokyo/ja/%E3%83%9E%E3%83%AB%E3%83%81%E3 %83%87%E3%83%90%E3%82%A4%E3%82%B9_%E3%82%A2%E3%83%97%E3%83%AA%E3% 82%B1%E3%83%BC%E3%82%B7%E3%83%A7%E3%83%B3%E3%81%A7%E3%81%AE_RTL_%E3 %81%AE%E4%BD%BF%E7%94%A8
  • 15. Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 15 Happy Creation, Play the Development! OS API – Win32API, macOS (Cocoa), iOS, Android – そのままコール可能!
  • 16. Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 16 Happy Creation, Play the Development! Delphi で出来ること • API 直接呼び出し – API をラッピングせずに呼び出せます。 uses Macapi.ObjectiveC, Macapi.CocoaTypes, Macapi.Foundation, Macapi.AppKit, FMX.Platform.Mac procedure SetMinSize(const iForm: TForm; const iMinW, iMin: Integer); var Wnd: NSWindow; // OS X 用のクラスがそのまま使えてる Size: NSSize; // こっちも begin Wnd := WindowHandleToPlatform(iForm.Handle).Wnd; // NSWindow を取り出す Size.width := iMinW; Size.height := iMinH; Wnd.setContentMinSize(Size); // そのまま呼び出せる end; macOS のコードを呼び出す例
  • 17. Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 17 Happy Creation, Play the Development! Delphi で出来ること • API 直接呼び出し – Jar リンケージ • Jar ファイルを追加すると自動的に dex ファイルに組み込まれます。 • Java2OP を使えば Jar ファイルへのブリッジファイルが自動で生成されます。 uses Androidapi.JNI.JavaTypes, Androidapi.JNI.GraphicsContentViewText, FMX.Helpers.Android; procedure StartIntent; var Intent: JIntent; begin Intent := TJIntent.Create; Intent .setAction(TJIntent.JavaClass.ACTION_VIEW) .setData(StrToJURI('URLとか')); try SharedActivity.startActivity(intent); except on E: Exception do Log.e(E.Message); end; end; Android のコードを呼び出す例
  • 18. Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 18 Happy Creation, Play the Development! FireMonkey について
  • 19. Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 19 Happy Creation, Play the Development! FireMonkey の仕組み • 自分で描画! – 使う API 群は各 OS のネイティブを使います • Windows DirectX • macOS OpenGL • iOS OpenGL ES • Android OpenGL ES – 基本的にベクターグラフィクス • Bitmap を中に埋め込むこともできます – 自分で描画しているので何でもあり! • 全てのコントロールがコンテナになれます! – IDE は Windows で動いているにも関わらず他の見た目を表示で きます!
  • 20. Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 20 Happy Creation, Play the Development! FMX Control FMX Control FMX Control FireMonkey World Native Layer 各 OS に依存した構造上に自分で描画しています FMX Control は「絵」! OS から見ると実体はありません!
  • 21. Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 21 Happy Creation, Play the Development! 自分で描画しているので UI すら 3D にできます
  • 22. Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 22 Happy Creation, Play the Development! 見た目サンプル
  • 23. Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 23 Happy Creation, Play the Development! Style を適用した見た目サンプル
  • 24. Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 24 Happy Creation, Play the Development! マルチプラットフォーム 開発環境について
  • 25. Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 25 Happy Creation, Play the Development! • Windows の開発 – Windows PC だけで OK ! • macOS の開発 – macOS 実機が必要なので Mac が必要です。 – Xcode Command Line Tools も必要です。 • iOS の開発 – macOS 開発で必要なもの(Mac, Xcode) – iOS Developer License • Android の開発 – ハードウェアは Windows PC で OK です。 – Android SDK, Android NDK が必要です • ただし、この2つは Delphi をインストールするとインストールされます。 – インストールしないことも可能です • Linux の開発 – Ubuntu, Red Had および、それぞれの SDK が必要です – Community Edition では使えません。Enterprise Edition 以上が必要です。
  • 26. Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 26 Happy Creation, Play the Development! マルチプラットフォーム開発を試すには • まずは Android で。 – Windows PC と Delphi, USB ケーブルだけあれば良い – お金が掛からない • Google Play に出すためには有料の開発者登録が必要です。 • Windows のアプリと Android のアプリを同時に作れます。 – FireUI, Style, TMultiView などの機能を使えば UI も1つのコードで作れます。 – つまり、デスクトップアプリケーションとモバイルアプリケーションを同時に作成可 能です。 USB Cable ADB
  • 27. Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 27 Happy Creation, Play the Development! • iOS の場合 Lightning Cable Network Windows PC Mac iPhone PAClient PAServer
  • 28. Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 28 Happy Creation, Play the Development! デモ Hello, World! Windows, macOS, iOS, Android へのデプロイ 会場のネットワークの都合により デモできず
  • 29. Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 29 Happy Creation, Play the Development! 単純な Hello, World! のため、ソースは割愛
  • 30. Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 30 Happy Creation, Play the Development! デモ Android で intent を使う
  • 31. Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 31 Happy Creation, Play the Development! uMain.fmx コントロールの配置
  • 32. Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 32 Happy Creation, Play the Development! uMain.pas // フォームのソースの implementation 以下 implementation {$R *.fmx} uses uIntent; // こっちに処理の実態が書いてある procedure TfrmMain.Button1Click(Sender: TObject); begin {$IFDEF ANDROID} // Android でしかコンパイルが走らないようにする OpenIntent(ImageControl1.Bitmap); {$ENDIF} end; end.
  • 33. Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 33 Happy Creation, Play the Development! uIntent.pas unit uIntent; {$IFNDEF ANDROID} {$WARNINGS OFF} interface implementation end. {$ENDIF} interface uses System.SysUtils , System.Messaging , FMX.Graphics ; procedure OpenIntent(const iBmp: TBitmap); implementation
  • 34. Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 34 Happy Creation, Play the Development! uIntent.pas uses // Android のヘッダー uses すると Android の API が呼べるようになる Androidapi.JNI.GraphicsContentViewText , Androidapi.JNI.Os , Androidapi.JNI.App , Androidapi.JNI.Net , Androidapi.JNI.JavaTypes , Androidapi.Helpers , FMX.Helpers.Android , FMX.Surfaces , FMX.Types , FMX.Forms ; // Intent の戻り値からビットマップを取得する処理 procedure GetImage(const iBmp: TBitmap; const iMsg: TMessageResultNotification); var Intent: JIntent; // Android のクラス! Uri: Jnet_Uri; // Android のクラス! Stream: JInputStream; // Android のクラス! ResultBmp: JBitmap; // Android のクラス! Surface: TBitmapSurface; begin
  • 35. Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 35 Happy Creation, Play the Development! uIntent.pas // エラーと nil チェック if iBmp = nil then Exit; iBmp.Clear(0); if iMsg.ResultCode <> TJActivity.JavaClass.RESULT_OK then Exit; Intent := iMsg.Value; if Intent = nil then Exit; Uri := Intent.getData; // API が普通に呼べる if Uri = nil then Exit; Stream := TAndroidHelper.Activity.getContentResolver.openInputStream(Uri); // API が普通に呼べる if Stream = nil then Exit; ResultBmp := TJBitmapFactory.JavaClass.decodeStream(Stream); // API が普通に呼べる if ResultBmp = nil then Exit;
  • 36. Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 36 Happy Creation, Play the Development! uIntent.pas // Java 側の Bitmap からビットマップのデータを読み取って TBitmap に割り付ける Surface := TBitmapSurface.Create; try if JBitmapToSurface(ResultBmp, Surface) then iBmp.Assign(Surface); finally Surface.DisposeOf; end; end;
  • 37. Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 37 Happy Creation, Play the Development! uIntent.pas procedure OpenIntent(const iBmp: TBitmap); // 画像を選択する暗黙的 intent を飛ばす var MessageId: Integer; Intent: JIntent; begin Intent := TJIntent.JavaClass.init; Intent .setAction(TJIntent.JavaClass.ACTION_GET_CONTENT) .setType(TAndroidHelper.StringToJString('image/*')); TAndroidHelper.Activity.startActivityForResult(Intent, 0); MessageId := TMessageManager.DefaultManager.SubscribeToMessage( // TMessageResultNotification メッセージの要求 TMessageResultNotification, procedure(const Sender: TObject; const M: TMessage) // メッセージの受け取りには匿名メソッドが指定できる begin GetImage(iBmp, TMessageResultNotification(M)); TMessageManager.DefaultManager.Unsubscribe( // TMessageResultNotification メッセージの解除 TMessageResultNotification, MessageId); end ); end;
  • 38. Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 38 Happy Creation, Play the Development! 実行イメージ chooser 暗黙的 intent TMessageResultNotification の 戻り値に intent が入っている その intent の data に Uri が 入っている (普通の Android の戻り値取得と同じ) Android が適切な画像選択アプリを開く
  • 39. Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 39 Happy Creation, Play the Development! 1ソース開発
  • 40. Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 40 Happy Creation, Play the Development! 1ソースを支える技術(一部) – Style – Layout – Anchor – TMultiView – FireUI – FireUI Preview – マルチデバイス プレビュー 1ソースを支えるフレームワーク – FireMonkey – RTL
  • 41. Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 41 Happy Creation, Play the Development! デモ Align Anchor Layout TMultiView
  • 42. Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 42 Happy Creation, Play the Development! TMultiView と Layout / Align / Anchor コントロールの配置
  • 43. Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 43 Happy Creation, Play the Development! TMultiView と Layout / Align / Anchor TMultiView TLayout: align = Bottom TLayout: align = Center TBottom: align =Left TBottom: align = Right TImageControl: align = client
  • 44. Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 44 Happy Creation, Play the Development! TMultiView によるデスクトップとモバイルのワンソース化 Windows Android TMultiView は端末の大きさによって自動的にスライドメニューになる
  • 45. Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 45 Happy Creation, Play the Development! デモ FireUI Style
  • 46. Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 46 Happy Creation, Play the Development! FireUI FireUI とは 各プラットフォームや 解像度の異なる端末で プロパティを変更できる 機能 様々な OS ・端末が 選択できる 例えば画面左上に「戻 る」ボタンを配置して Android 端末では表示 しない(Visible = false)といった事がで きる
  • 47. Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 47 Happy Creation, Play the Development! FireUI では設計時に見た目も変わる macOS iPhone 5.5 インチ
  • 48. Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 48 Happy Creation, Play the Development! Style Style とは見た目を変える機能 FireMonkey がコントロールを自分で描いている事で可能になった機能です Default のスタイルは下記にインストールされています C:¥Users¥Public¥Documents¥Embarcadero¥Studio¥19.0¥Styles Delphi に最初から入っている Blend スタイル DelphiStyle.com で購入できる Ubuntu スタイル DelphiStyle.com で購入できる Calypso スタイル※IDE のダークテーマ・ライトテーマは DelphiStyles.com が製作しました
  • 49. Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 49 Happy Creation, Play the Development! デモ マルチデバイスプレビュー FireUI Live Preview アプリケーションテザリング 会場のネットワークの都合により デモできず
  • 50. Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 50 Happy Creation, Play the Development! マルチデバイスプレビューとは各プラットフォームでの見た目を一括して表示できる機能
  • 51. Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 51 Happy Creation, Play the Development! • FireUI LivePreview (AppPreview) – デザイン画面を実機でみる機能 – http://docwiki.embarcadero.com/RADStudio/Tokyo/ja/FireUI_%E3%83%A9%E3%8 2%A4%E3%83%96_%E3%83%97%E3%83%AC%E3%83%93%E3%83%A5%E3% 83%BC – 同じ WiFi ネットワーク内で相互に相手を見れる必要あり – IDE のオプションで「FireUI ライブプレビューをブロードキャストする」にチェックが必要 任意の名前 パスワードは無しでOK
  • 52. Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 52 Happy Creation, Play the Development! マルチデバイスプレビューではフォントやアイコンといった端末に固有の見 た目等は再現できません FireUI Live Preview では実機で表示されるのでフォントなども実際に使用 される物で表示されます IDEでは 「リアルタイムにプレビューできるぞ!!」 と表示されているが フォントの違う実機では 「リアルタイムにプレビューでき」 までしか表示されていない このことから Label.Width をもう少し広げないといけない事が デザイン時に判る
  • 53. Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 53 Happy Creation, Play the Development! FireUI LivePreview の入手方法 Windows / macOS 用はデフォルトでは下記のフォルダ C:¥Program Files (x86)¥Embarcadero¥Studio¥19.0¥LivePreview iOS 用 https://itunes.apple.com/us/app/fireui-app-preview-10.1-berlin/id1090861997 Android 用 https://play.google.com/store/apps/details?id=com.embarcadero.LivePreview101 FireUI LivePreview のソース C:¥Program Files (x86)¥Embarcadero¥Studio¥19.0¥source¥Tools¥FireUIAppPreview AppTethering やマルチプラットフォームアプリケーションのサンプルとしても優秀
  • 54. Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 54 Happy Creation, Play the Development! Rapid Application Development
  • 55. Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 55 Happy Creation, Play the Development! 開発を加速させる技術 – Animation / Effect – GetIt ライブラリマネージャ – Visual Live Bindings – データエクスプローラ – REST コンポーネント / REST デバッガ Delphi はコンポーネントが「異常」に充実しています(200以上存在)。 これによってほとんどコードを書かずに様々な機能を実現可能です。 たとえば、カメラアプリであれば、コードはたったの1行です。 (TTakePhotoFromCameraAction を使用)
  • 56. Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 56 Happy Creation, Play the Development! procedure TForm1.TakePhotoFromCameraAction1DidFinishTaking(Image: TBitmap); begin Image1.Bitmap.Assign(Image); // たったこれだけ! end; 画像は英語版から拝借
  • 57. Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 57 Happy Creation, Play the Development! デモ Animation / Effect
  • 58. Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 58 Happy Creation, Play the Development! Animation / Effect は親コントロールに効く ノーコーディングで GlowEffect(画像周囲の黄 色部分)を掛け、0.2 秒間で0~360度回転する FloatAnimation が設定されている
  • 59. Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 59 Happy Creation, Play the Development! デモ GetIt ライブラリマネージャ
  • 60. Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 60 Happy Creation, Play the Development! GetIt はライブラリマネージャ 他の開発環境で言う NuGet や CocoaPods のような物です 様々なコンポーネントやライブラリ、 サンプルを取得できます 自作のコンポーネントやライブラリも 申請すれば登録されます 「ScriptGate」で検索すると筆者が 作ったコンポーネントがダウンロード され使用できます
  • 61. Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 61 Happy Creation, Play the Development! デモ データエクスプローラ RESTコンポーネント RESTデバッカ Visual Live Bindings 会場ではここで米澤さんによる ライブデモがありました
  • 62. Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 62 Happy Creation, Play the Development! 注意
  • 63. Copyright © 2018 SERIALGAMES Inc. All Rights Reserved. PAGE 63 Happy Creation, Play the Development! 注意 Delphi を使うと簡単にマルチプラットフォームアプリケーションが作れますが、各 OSの作法に則るのが基本です。 例えば、iOS / Android ではメインスレッドを止めてはなりません。 また、ファイル操作も限られています。 特に Android では、アプリケーションは機能に特化した形にして、他のこと(例え ば「画像を開く」とか「メールを出す」など)は、それに特化したアプリに処理を 委譲します(暗黙的 intent を使う) これには TTakePhotoFromLibraryAction などを使う事でワンソースにできます 出来ればスタイルも各OSに即したスタイルにすると良いでしょう。 作法を知るため一度は Android Studio / Xcode でアプリケーションを作ってみる ことをオススメします。