Difference between revisions of "Make and run simple PND"

From Pandora Wiki
Jump to: navigation, search
(Created page.)
 
(cat)
Line 75: Line 75:
 
# Re-insert your SD card.
 
# Re-insert your SD card.
 
# The "Simple Py Test" game should appear in the Arcade Game folder.
 
# The "Simple Py Test" game should appear in the Arcade Game folder.
 +
 +
[[Category:PND]]
 +
[[Category:Tutorial]]
 +
[[Category:Development]]

Revision as of 15:42, 19 April 2011

Feel free to use this as a start for your own PND! This is pretty much the simplest PND possible. It will show a black screen for 2 seconds and then quit. Unfortunately, due to a bug in MiniMenu, this PND can only (as of HF5) be launched from XFCE.

Overview

The PND has 2 files. First, "simplepytest.py", which is our executable application, and "PXML.xml" which the Pandora uses to launch the application correctly.

First, create a "simplepytest" folder in one of your application folders (i.e., "/pandora/menu").

SimplePyTest.py

This file is the actual application that the Pandora executes.

Create a file called "simplepytest.py" and put the following contents in it. This will display a black screen for 2 seconds at the current screen resolution, using Python and Pygame.

#! /usr/bin/python

import pygame, pygame.locals
import time

pygame.init()

vidInfo = pygame.display.Info()
resolution = (vidInfo.current_w, vidInfo.current_h)

pygame.display.set_mode(resolution, pygame.locals.FULLSCREEN)

time.sleep(2)

PXML.xml

This file contains the information the Pandora needs to figure out where to display your game and how to execute it.

Create a file called "PXML.xml" and put the following contents in it:

<?xml version="1.0" encoding="UTF-8">
<PXML xmlns="http://openpandora.org/namespaces/PXML">
        <package id="simplepytest">
        <version major="0" minor="0" release="0" build="1"/>
        <author name="YOUR NAME" email="YOUR EMAIL"/>        
                <title lang="en_US">Simple Py Test</title>
                <titles>
                        <title lang="en_US">Simple Py Test</title>
        </titles>
        </package>
    <application id="simplepytest">
        <title lang="en_US">Simple Py Test</title>
                <titles>
                        <title lang="en_US">Simple Py Test</title>
        </titles>
        <description lang="en_US">A Python and Pygame test program.
            </description>
        <version major="0" minor="0" release="0" build="1"/>
        <exec command="python simplepytest.py" />
        <author name="YOUR NAME" email="YOUR EMAIL"/>
                <licenses>
                        <license name="other"/>
                </licenses>
        <categories>
            <category name="Game">
                <subcategory name="ArcadeGame">
            </category>
        </categories>
    </application>
</PXML>

Running Your Game

  1. Save all the above files.
  2. Make sure your Pandora is running the XFCE Gui.
  3. Unmount, then remove your SD card.
  4. Re-insert your SD card.
  5. The "Simple Py Test" game should appear in the Arcade Game folder.