NaCl Samples

This topic describes sample applications that introduce basic Native Client features, and explains how to access the sample source code in the Tizen Studio.

The following tutorials introduce how to implement basic Native Client (NaCl) features using C and C++.

Tutorial Description Source Code Download
Hello World in C

This module waits for a “Hello World” message from the JavaScript component and sends a reply message. hello_world_c.zip

Hello World in C++

hello_world_cpp.zip

Input Events in C++

This module detects and logs mouse or keyboard input events within the plugin area. input_events.zip

2D Graphics in C++

This module creates a 2D flame animation that can be controlled with the mouse. graphics_2d.zip

3D Graphics in C++

This module creates a rotating, textured 3D cube that can be controlled with the mouse. graphics_3d.zip

Audio in C++

This module loads multiple WAV files, and the user can start, pause, and stop their playback. audio.zip

Sockets in C++

This module creates simple TCP and UDP sockets that echo text messages sent to them. sockets.zip

Table 1. Tutorials and source code

You can access the sample application source code from within the Tizen Studio, or download the source code and open it in an editor of your choice.

To access the sample application source code in the Tizen Studio:

  1. Select "File > New > Other".

  2. In the "Select a wizard" dialog, select "Tizen > Samsung TV > Tizen NaCl App (C/C++)", and click "Next".

  3. Enter a project name and folder, select the programming language and Pepper toolchain version, and click "Next".

  4. In the "Select project content" dialog, click "Example projects", select the sample you want from the list, and click "Next".

  5. Select the screen resolution you want, and click "Finish".

In the Tizen Studio, you can use a cheat sheet to study key parts of the sample code. To open the cheat sheet, select "Help > Cheat Sheets > NaCl Application > NaCl demo guides > [required cheat sheet]" and click "OK".

To test a sample application on the TV emulator, you must compile and build the application with the Tizen Studio. If you simply want to test the application in the Google Chrome™ browser, you can also compile the code manually with the make command.