Revision 36 as of 2010-06-07 08:36:57

Clear message

# # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License.

import appuifw from graphics import * import e32 from key_codes import *

class Keyboard(object):

keyboard=Keyboard()

appuifw.app.screen='full' img=None def handle_redraw(rect):

appuifw.app.body=canvas=appuifw.Canvas(

img=Image.new(canvas.size)

running=1 def quit():

appuifw.app.exit_key_handler=quit

location=[img.size[0]/2,img.size[1]/2] speed=[0.,0.] blobsize=16 xs,ys=img.size[0]-blobsize,img.size[1]-blobsize gravity=0.03 acceleration=0.05

import time start_time=time.clock() n_frames=0 # To speed things up, we prerender the text. labeltext=u'Use arrows to move ball' textrect=img.measure_text(labeltext, font='normal')[0] text_img=Image.new((textrect[2]-textrect[0],textrect[3]-textrect[1])) text_img.clear(0) text_img.text((-textrect[0],-textrect[1]),labeltext,fill=0xffffff,font='normal')

while running:

end_time=time.clock() total=end_time-start_time

print "%d frames, %f seconds, %f FPS, %f ms/frame."%(n_frames,total,

Unable to edit the page? See the FrontPage for instructions.