Embarcadero多平台遊戲原始碼開放

Embarcadero官方釋出了幾項以Delphi/C++ Builder開發的跨平台遊戲,可以在Android/iOS/MacOS/Windows下面執行。
主要也透過遊戲原始碼分享幾個技術:
.Game loop
.Using TRectangle
.Frames UI
.Motion Sensor
.High Scores via SQLite & LiveBindings
.Object Pooling
.Sprite Sheet Animation
.App Tethering
.Cross Platform Sound

教學的影片

Delphi FireMonkey在Android/OSX/Win如何支援com port

以前在VCL架構時,有許多支援comport開發的元件,那在firemonkey下呢?
整理了一些for android/os x以及win下的元件

Check out ComPort for VCL in Delphi 10 Berlin.

Check out ComPort for Android with Firemonkey in Delphi 10 Berlin.

Check out ComPort for Android FTDI FT31xD with Firemonkey in Delphi 10 Berlin.

Check Out ComPort for Android Prolific with Firemonkey in Delphi 10 Berlin.

Check Out ComPort for Android USB with Firemonkey in Delphi 10 Berlin.

Check out ComPort for Android USB Serial with Firemonkey in Delphi 10 Berlin.

Check out ComPort for FireMonkey on Windows in Delphi 10 Berlin.

Check out ComPort for OS X in Firemonkey for Delphi 10 Berlin.

 

source: http://community.embarcadero.com/blogs?view=entry&id=8724

Delphi Berlin跨平台條件編譯(Conditional compilation)

Delphi Berlin可以在不同平台裝置上執行,那程式可以依不同平台裝置跑嗎?
答案是可行的~只要透過條件編譯就可以了 範例如下

   {$IFDEF MSWINDOWS}
   LABEL1.Text := Label1.Text + '(電腦版)';
   {$ENDIF}
   {$IFDEF ANDROID}
   LABEL1.Text := Label1.Text + '(安卓版)';

   {$ENDIF}
   {$IFDEF OSX}
   LABEL1.Text := Label1.Text + '(MAC版)';

   {$ENDIF}
   {$IFDEF IOS}
   LABEL1.Text := Label1.Text + '(IOS版)';

   {$ENDIF}

Delphi 10 Andriod/iOS開發小筆記(常常更新)

System.IOUtils.TPath.GetHomePath

Platform Sample path Path ID
Windows XP C:\Documents and Settings\<username>\Application Data CSIDL_APPDATA
Windows Vista or later C:\Users\<username>\AppData\Roaming FOLDERID_RoamingAppData
Mac OS X /Users/<username> NSUserDirectory
iOS Device /private/var/mobile/Containers/Data/Application/<application ID>
iOS Simulator /Users/<username>/Library/Developer/CoreSimulator/Devices/<Device ID>/data/Containers/Data/Application/<application ID>
Android /data/data/<application ID>/files Context.getFilesDir

For Android, set the Remote Path to assets\internal

For iOS, set the Remote Path to StartUp\Documents

// XE3 : DBJSON
// Seattle: System.JSON
var
  LJsonArr   : TJSONArray;
  LJsonValue : TJSONValue;
  LItem     : TJSONValue;
begin
   memo1.Lines.Clear;
   LJsonArr    := TJSONObject.ParseJSONValue(TEncoding.utf8.GetBytes(memo2.Lines.Text),0) as TJSONArray;
   for LJsonValue in LJsonArr do
   begin
      for LItem in TJSONArray(LJsonValue) do
        memo1.lines.add(Format('%s : %s',[TJSONPair(LItem).JsonString.Value, TJSONPair(LItem).JsonValue.Value]));
     memo1.Lines.Add('');
   end;
end;

參考: http://blogs.embarcadero.com/davidi/2013/11/23/43005/