Mastering Android NDK
eBook - ePub

Mastering Android NDK

  1. 328 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

Mastering Android NDK

Book details
Book preview
Table of contents
Citations

About This Book

Master the skills you need to develop portable, highly-functional Android applications using NDK

About This Book

  • Develop portable games using Android NDK and debug them on your desktop
  • Familiarise yourself with different popular C++ libraries on Android and use them in your games
  • Write multi-threaded code with graphics, sound, networking, and resource storage

Who This Book Is For

If you want to leverage your C++ skills in mobile development and increase the performance of your Android applications, then this is the book for you. Knowledge of C or C++ is assumed, including pointer manipulation, multi-threading, object-oriented programming concepts, and the basics of C++11. It would be an added advantage if you know how to develop applications without any IDE.

What You Will Learn

What You Will Learn

  • Explore popular C++ libraries and use them on Android
  • Write portable, multithreaded native networking code
  • Create portable audio framework using OpenAL
  • Implement portable rendering framework using OpenGL ES 3
  • Debug mobile applications on your desktop machine
  • Access resources from APK archives
  • Render text with FreeType

In Detail

Android NDK is used for multimedia applications that require direct access to system resources. NDK is also the key for portability, which in turn allows a reasonably comfortable development and debugging process using familiar tools such as GCC and Clang toolchains.

This is a hands-on guide to extending your game development skills with Android NDK. The book takes you through many clear, step-by-step example applications to help you further explore the features of Android NDK and some popular C++ libraries and boost your productivity by debugging the development process.

Through the course of this book, you will learn how to write portable multi-threaded native code, use HTTP networking in C++, play audio files, use OpenGL ES 3, and render high-quality text. Each chapter aims to take you one step closer to building your application. By the end of this book, you will be able to create an engaging, complete gaming application.

Style and approach

This book adopts a step-by-step approach and each chapter is based on the material from the previous ones. The book focuses on putting to your knowledge of C++ use while you develop Android applications of your own.

Frequently asked questions

Simply head over to the account section in settings and click on “Cancel Subscription” - it’s as simple as that. After you cancel, your membership will stay active for the remainder of the time you’ve paid for. Learn more here.
At the moment all of our mobile-responsive ePub books are available to download via the app. Most of our PDFs are also available to download and we're working on making the final remaining ones downloadable now. Learn more here.
Both plans give you full access to the library and all of Perlego’s features. The only differences are the price and subscription period: With the annual plan you’ll save around 30% compared to 12 months on the monthly plan.
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, we’ve got you covered! Learn more here.
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Yes, you can access Mastering Android NDK by Sergey Kosarevsky, Viktor Latypov in PDF and/or ePUB format, as well as other popular books in Computer Science & Programming Mobile Devices. We have over one million books available in our catalogue for you to explore.

Information

Year
2015
ISBN
9781785288333
Edition
1

Mastering Android NDK


Table of Contents

Mastering Android NDK
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers, and more
Why subscribe?
Free access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
1. Using Command-line Tools
Using Android command-line tools on Windows
Using Android command-line tools on OS X
Using Android command-line tools on Linux
Creating an Ant-based application template manually
Creating a Gradle-based application template manually
Embedding native code
Building and signing release Android applications
Organizing the cross-platform code
Using TeamCity continuous integration server with Android applications
Summary
2. Native Libraries
Dealing with precompiled static libraries
Dynamic linking on Windows platform
Curl
OpenSSL
FreeImage
Loading and saving images
FreeType
Theora
OpenAL
Linking the libraries to your application
Summary
3. Networking
Intrusive smart pointers
Portable multithreading primitives
Task queues
Message pumps and asynchronous callbacks
Asynchronous networking with libcurl
Android licensing in native applications
Flurry analytics
Summary
4. Organizing a Virtual Filesystem
Mount points
Mount points and streams
Accessing files on the host filesystems
In-memory files
Aliasing
Writing files
Accessing the archive files
Accessing application assets
Summary
5. Cross-platform Audio Streaming
Initialization and playback
Streaming sounds
Stringed musical instrument model
Decoding compressed audio
Decoding tracker music using the ModPlug library
Decoding MP3 files
Decoding OGG files
Summary
6. OpenGL ES 3.1 and Cross-platform Rendering
Linear algebra and transformations
Graphics initialization using SDL2
OpenGL API binding
Cross-platform OpenGL abstractions
Feeding the geometry data to OpenGL
Shader programs
Textures
Summary
7. Cross-platform UI and Input System
Rendering
Text rendering
Calculating glyph positions and string size in pixels
Decoding UTF-8
Glyphs rendering
Font initialization and caching
Integrating the text renderer into the canvas
Organizing the UI system
The base UI view
Events
Implementing UI classes
Using views in application
Summary
8. Writing a Rendering Engine
The scene graph
Lighting and shading
Lights and light nodes
Material system
Demo application and a rendering technique
Scene construction
User interaction with 3D scenes
Summary
9. Implementing Game Logic
Boids
Implementation of the flocking algorithms
Digression: helper routines
Collective behaviors
Rendering the swarm
Boids demonstration
The page-based user interface
Summary
10. Writing Asteroids Game
Creating an on-screen joystick
Implementing the particle system
Using particle systems in the game
Using particle systems inside a scene graph
Asteroids game
Summary
Index

Mastering Android NDK

Copyright © 2015 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the authors nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: September 2015
Production reference: 1250915
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham B3 2PB, UK.
ISBN 978-1-78528-833-3
www.packtpub.com

Credits

Authors
Sergey Kosarevsky
Viktor Latypov
Reviewers
Koji Hasegawa
Raimon RĂ fols
Sebastian Roth
Ali Utku Selen
Commissioning Editor
Priya Singh
Acquisition Editor
Tushar Gupta
Content Development Editor
Neeshma Ramakrishnan
Technical Editor
Dhiraj Chandanshive
Copy Editors
Janbal Dharmaraj
Kevin McGowan
Project Coordinator
Shweta H Birwatkar
Proofreader
Safis Editing
Indexer
Hemangini Bari
Production Coordinator
Nitesh Thakur
Cover Work
Nitesh Thakur

About the Authors

Sergey Kosarevsky is a software engineer with experience in C++ and 3D graphics. He worked for mobile industry companies and was involved in mobile projects at SPB Software, Yandex, Layar and Blippar. He has more than 12 years of software development experience and more than 6 years of Android NDK experience. Sergey got his PhD in the field of mechanical engineering from St. Petersburg Institute of Machine-Building in Saint-Petersburg, Russia. In his spare time, Sergey maintains and develops an open source multiplatform gaming engine, the Linderdaum Engine (http://linderdaum.com).
Viktor Latypov is a software engineer and mathematician with experience in compiler development, device drivers, robotics, and high-performance computing and with a personal interest in 3D graphics and mobile technology. Surrounded by computers for more than 20 years, he enjoys every bit of developing and designing software for anything with a CPU inside. Viktor holds a PhD in applied mathematics from Saint-Petersburg State University.

About the Reviewers

Koji Hasegawa is an iOS/Android app developer, living in Japan. He released various applications to the AppStore, such as "Den-Ace quiz, Minoru Kawasaki's tokusatsu movies world", and "Futsal rules and trivia".
In addition, he is also involved in community activities related to test automation. Koji has authored a few books on testing and test automation in Japanese.
He is an ISTQB Certification Tester and is also certified in Iaido (Japanese Sword Arts) and Kyudo (Japanese Archery).
Raimon RĂ fols has been developing for mobile devices since 2004. He has experience in developing on several technologies specializing in the UI, build systems, and client-server communications. He is currently working as an engineering manager at AXA Group Solutions in Barcelona. In the past, he worked for Imagination Technologies near London and Service2Media in the Netherlands. In his spare time, he enjoys programming, photography, and giving talks on Android performance optimization and Android custom views at mobile conferences.
Ali Utku Selen is a system engineer at Sony Mobile Communications, working on flagship Android de...

Table of contents

  1. Mastering Android NDK