github.com/graybobo/golang.org-package-offline-cache@v0.0.0-20200626051047-6608995c132f/x/talks/2014/gothamgo-android.slide (about)

     1  Go on Android
     2  
     3  GothamGo
     4  15 Nov 2014
     5  
     6  David Crawshaw
     7  Google
     8  @davidcrawshaw
     9  
    10  * Video
    11  
    12  This talk was presented at GothamGo in New York City, November 2014.
    13  
    14  .link http://vimeo.com/115307069 Watch the talk on Vimeo
    15  
    16  * Go on Mobile
    17  
    18  The goal is to bring Go to Android and iOS,
    19  starting with Android.
    20  
    21  This is new territory for Go and a well-established
    22  ecosystem. A lot of experimentation is necessary.
    23  
    24  * Today
    25  
    26  * Go 1.4 Status
    27  
    28  The coming 1.4 release can build binaries for Android OS.
    29  
    30  With the `mobile` subrepository and the Android SDK/NDK, it can:
    31  
    32  - Build `.so` files for linking into Android Apps
    33  - Build apps based on NativeActivity ("All Go")
    34  
    35  * What's there
    36  
    37  - Go standard library tests running on Android OS
    38  
    39  - JDK / runtime hooks
    40  
    41  - The `gobind` tool, for calling Go from Java: [[http://golang.org/s/gobind]]
    42  
    43  Packages for cross-device apps:
    44  
    45  - [[https://godoc.org/golang.org/x/mobile/app][App control]]
    46  
    47  - [[https://godoc.org/golang.org/x/mobile/gl][OpenGL ES 2]]
    48  
    49  - [[https://godoc.org/golang.org/x/mobile/event][Touch events]]
    50  
    51  - [[https://godoc.org/golang.org/x/mobile/geom][Screen geometry]]
    52  
    53  * What's missing — a good build system
    54  
    55  There's more than one way to build an Android App.
    56  
    57  None of them
    58  
    59  - fit well with what go programmers expect (the go tool)
    60  - work for cross-device development
    61  
    62  We are working on this for Go 1.5.
    63  
    64  Until it is done, using Go on Android requires some bravery.
    65  
    66  * What it's for — the two kinds of apps
    67  
    68  *SDK* *Apps*
    69  
    70  Write your Android UI in Java.
    71  Write your iOS UI in Objective-C/Swift.
    72  Write your logic in Go.
    73  
    74  Share the Go using interfaces generated by `gobind`.
    75  
    76  *NDK* *Apps*
    77  
    78  Games.
    79  
    80  Use OpenGL or the coming 2D [[http://godoc.org/golang.org/x/mobile/sprite][sprite]] package to write to the screen.
    81  Everything is written in Go.
    82  
    83  * Hello, World!
    84  
    85  Portable APIs, just Go. This is a complete app:
    86  
    87  .play gothamgo-android/red.go
    88  
    89  * Write anywhere
    90  
    91  Developing with portable APIs means starting from very little.
    92  It is a lot of work to get going and limits access to device features.
    93  
    94  But it also frees us from device-specific build systems.
    95  
    96  The app package includes Mac/X11 shims for starting as normal programs.
    97  We can write Apps anywhere we can write Go.
    98  
    99  (Windows coming soon.)
   100  
   101  * Touch events
   102  
   103  .play gothamgo-android/touch.go
   104  
   105  * Package sprite
   106  
   107  We are building a 2D rendering and compositing package.
   108  
   109  It renders a scene graph. A scene starts with a root
   110  `*sprite.Node`, which can have child nodes.
   111  
   112  Each node may have an affine transform and texture.
   113  
   114  Rendering is done in a depth-first traversal of the scene,
   115  with transforms applied relative to the parent.
   116  
   117  Composition is done in OpenGL.
   118  
   119  * Sprite — affine transform
   120  
   121  .image gothamgo-android/sprite_affine.svg
   122  
   123  * Sprite — depth first traversal, applying parent's transforms
   124  
   125  .image gothamgo-android/sprite_subtex.svg
   126  
   127  * Sprite Demo
   128  
   129  * Sprite — what's next
   130  
   131  - Rasterizer, CPU-based for now
   132  
   133  - Text, based on freetype-go
   134  
   135  - Simple UI elements, focused on game menu needs
   136  
   137  - Debugging tools
   138  
   139  - Performance
   140  
   141  * Go 1.5 Plans (July 2015)
   142  
   143  - A build system
   144  
   145  - OpenAL bindings for sound
   146  
   147  - Very basic UI building blocks for game-like apps
   148  
   149  - iOS experimental support