Example Code

Dual Platform Keyboard Puzzle

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabVIEW

Code and Documents

Attachment

Overview: Brick game.


Description:

This is an enhanced version of the example Keyboard Puzzle Game.vi. It now has different colored game blocks, runs on dual platforms (standard LabVIEW and Pocket PC/PDA). This VI gives an example of how to write a program using the LabVIEW keyboard vi's, the button vi's On the Pocket PC and how to make a program work on dual platforms. It is a LabVIEW version of the game Tetris. You use the keyboard to control the movement of the blocks as they are falling down the screen.

 

To move the game block right, left, down or rotate/turn, use the arrow keys on a desktop also pressing the 'S" key will start the game and pressing the "X" key will exit the game.You can also click the buttons with your mouse.  On a Pocket PC click the buttons with your stylist or use the buttons on the device itself. Pocket PC IssuesThe "S" and "X" keys are not current supported on the Pocket PC.  Although the color property node is support on the pocket PC there seems to be a limitation on the number of properties it can handle for this reason the color control is disabled in the Pocket PC mode. Get Date/Time in Seconds.vi only has a resolution of one second that is the reason behind not using it for timing in the Pocket PC mode. An Array was not used for the game board because you cannot hide the Index display. A cluster was not use be cause of behavioral issues. Other requirements:

Pocket PC Emulator Only If you use the PDA Button Input VIs, you must manually copy gx.dll, located in the default directory C:\Program Files\Windows CE Tools\wce420\POCKET PC 2003\Target\X86, on the host computer, to the \Windows directory on the Pocket PC emulator. To copy the DLL to the correct directory, launch the Windows CE Remote File Viewer,located in C:\Program Files\Common Files\Microsoft Shared\Windows CE Tools\Platman\bin\cefilevw.exe, and copy gx.dll to the \Windows directory on the Pocket PC Emulator.

 


Requirements: LabVIEW 2012 (or compatible). Hardware: none.


Steps to Implement or Execute Code: Run the VI, enjoy.


Additional Information or References:

 Dual Platform Keyboard Puzzle FP.png


**This document has been updated to meet the current required format for the NI Code Exchange.**

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.