[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[pygame] pygame to android -- problem with font objects
- To: pygame-users@xxxxxxxx
- Subject: [pygame] pygame to android -- problem with font objects
- From: tom arnall <kloro2006@xxxxxxxxx>
- Date: Fri, 24 Jul 2015 00:14:27 -0700
- Delivered-to: archiver@xxxxxxxx
- Delivered-to: pygame-users-outgoing@xxxxxxxx
- Delivered-to: pygame-users@xxxxxxxx
- Delivery-date: Fri, 24 Jul 2015 03:14:31 -0400
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=nYArlbycEheBYI0KCm8pBQ85MPqY/WgJkVbutzu9myQ=; b=Zb2yyKbssjI8sQHNDyOogPbKX57CbnZhZf/Gi5VZ/4rmtV+8RGuLNhOkGxcwkcbOhL yQOeTtmY7LtlTWwxqo8JAx1HRjqYdIjFoJWkvt0wWgOG5l83cYWHtqxINBMYNGr0v49c sA2TEUH8z4816H26xAMK6RtxpLLz/rbVsDiA+ce/nrpoujZHP7WPCRBKtqGpkM50ub8L N/Fwa+D+Z6hOcXysQ78G6xM/mOPHPZqfntcLt/4/gIoQ3nxEZydkCVezfKYv/MNHF5aW Us0B8KIqjZWwPuSM/Vi1ru72slZ+vbYPEpxaDg4s3DsxyNBjFPibxKsxtiAKwvqjD9qz ccwA==
- Reply-to: pygame-users@xxxxxxxx
- Sender: owner-pygame-users@xxxxxxxx
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)