13.07.2015 Views

Mali GPU User Interface Engine Application Development Guide

Mali GPU User Interface Engine Application Development Guide

Mali GPU User Interface Engine Application Development Guide

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Tutorial on the System Classes2.5 Creating a Timer interfaceThe following steps describe how to create a Timer object:1. Open the main.cpp file from the 04 - Using the Timer <strong>Interface</strong> project.Example 2-16 shows how to create a System and Timer interface:Example 2-16 Create a timer#include #include using namespace MDE;/* Portable sleep function */#ifdef MDE_PLATFORM_ARM_LINUX#include void Sleep(unsigned int time){usleep(time * 1000);}#endif#ifdef MDE_OS_PC_LINUX#include void Sleep(unsigned int time){usleep(time * 1000);}#endifint main(){try{Managed system = create_system_backend();Managed timer = system->createTimer();...2. Example 2-17 shows how to track changes in the timer.Example 2-17 Timer sleep calls...printf("Reseting timer\n");timer->reset();printf("Time since object reset is: %f\n", timer->getTime());printf("\nSleeping 1000 milliseconds\n");Sleep(1000);printf("Time since object creation is: %f\n", timer->getTime());printf("\nReseting timer\n");timer->reset();printf("Time since timer reset is: %f\n", timer->getTime());printf("\nSleeping 1000 milliseconds\n");ARM DUI 0527A-02a Copyright © 2010 ARM. All rights reserved. 2-11ID070710Non-Confidential - Draft - Beta

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!