[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[pygame] pygame to android -- problem with font objects



Greetings!

The code works fine on my PC (runs Linux of course), i.e., it prints
"hello world" on the window it produces. But when I make it into an
apk with the pgsa-0.9.4 kit and run it on my phone, it puts garbage on
the screen.

;o(

I've put pygame apps on the phone which don't use the Font objects and
they run fine. ;o)

'freesans' is a shot in the dark. i'm wondering if that's the culprit.

Thanks in advance for any ideas,

Tom Arnall
Baja Norte


-----
Happiness is a barometer, not the purpose.




==========


import pygame, sys, os, random
from pygame.locals import *
import time

try:
    import android
except ImportError:
    android = None

def stop(interval=3):
    print "stopping >> " + str(interval)
    time.sleep(interval)

pygame.init()

BLACK = (0, 0, 0)
WHITE = (255, 255, 255)

width = 400
height = 400

screen = pygame.display.set_mode((width, height))

background = pygame.Surface(screen.get_size())
background = background.convert()
background.fill(WHITE)

surface = pygame.Surface((width,height))

font = pygame.font.SysFont("freesans", 25)

itemSurface = font.render("hello world!", True, BLACK, WHITE)
surface.blit(itemSurface, (0,0))
background.blit(surface, (0,0))
screen.blit(background,(0,0))

pygame.display.flip()

stop(20)