Create
jni/TimeManager.hpp
with thetime.h
manager and define the following methods:reset()
to initialize the manager.update()
to measure game step duration.elapsed()
andelapsedTotal()
to get game step duration and game duration. They are going to allow the adaptation of the application behavior to the device speed.now()
is a utility method to recompute the current time.
Define the following member variables:
mFirstTime
andmLastTime
to save a time checkpoint in order to computeelapsed()
andelapsedTotal()
mElapsed
andmElapsedTotal
to save computed time measures#ifndef _PACKT_TIMEMANAGER_HPP_ #define _PACKT_TIMEMANAGER_HPP_ #include "Types.hpp" #include <ctime> class TimeManager { public: TimeManager(); void reset(); void update(); double now(); float elapsed() { return mElapsed; }; float elapsedTotal() { return mElapsedTotal; }; private: double mFirstTime; double mLastTime...
Android NDK: Beginner's Guide
By :
Android NDK: Beginner's Guide
By:
Overview of this book
Table of Contents (18 chapters)
Android NDK Beginner's Guide Second Edition
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Free Chapter
Setting Up Your Environment
Starting a Native Android Project
Interfacing Java and C/C++ with JNI
Calling Java Back from Native Code
Writing a Fully Native Application
Rendering Graphics with OpenGL ES
Playing Sound with OpenSL ES
Handling Input Devices and Sensors
Porting Existing Libraries to Android
Intensive Computing with RenderScript
Afterword
Index
Customer Reviews