-
JadedTuna
@omz how long would it take for this fix to make it into the App Store? Also, will getting the beta affect my files/settings in any way?
-
JadedTuna
While developing a streaming app for Pythonista I noticed that it usually crashes after some time. Turns out it's somehow related to loading/unloading images with
scene
. Here is a minimal example that crashes Pythonista reliably:import scene import random from cStringIO import StringIO import Image def raw_jpeg(img): buf = StringIO() img.save(buf, 'JPEG', quality=50) data = buf.getvalue()[::] buf.close() return data imglist = [raw_jpeg(img) for img in [ Image.new('RGB', (512, 384), 'red'), Image.new('RGB', (512, 384), 'yellow'), Image.new('RGB', (512, 384), 'green'), Image.new('RGB', (512, 384), 'blue'), Image.new('RGB', (512, 384), 'gray'), ]] imgnames = [] while True: name = scene.load_image_data(random.choice(imglist)) if len(imgnames) == 16: scene.unload_image(imgnames.pop(0)) imgnames.append(name) print name
It takes a variable amount of time, somewhere between a second and a minute I'd say. And using
scene.load_pil_image
instead does not help, but only makes the loading process slower.
Am I missing something?scene.unload_image
should free memory, and since this example never exceeds 16 images loaded at once it should have plenty of that.
EDIT: I am using iPad 4 and what seems to be the latest version of Pythonista. -
JadedTuna
I tried using it with a simple ellipse, but I still have no idea how it works and where actually is the rotation point. It seems as the ellipse is not rotated along its own rotation point (center).
P. S. A side question: scene.translate just moves objects on the x and y axises by the specified number, right?
-
JadedTuna
Heh, no. This is a method of a class Scene, and I am talking about the scene module itself (
scene.size
notscene.Scene.size
) -
JadedTuna
Module
scene
has a function calledsize
which seems to return the size of the display, but I can't seem to find it here: http://omz-software.com/pythonista/docs/ios/scene ? : ] -
JadedTuna
Hey there.
touch_id
is basically an ID for every touch - you can have any amount of touches and all of them will have an uniquetouch_id
. It can be used in multi-touch applications to track down different touches. -
JadedTuna
Gonna advertise GamePie some more :)
Here is a video of a game I am working on (PieRPG): https://www.youtube.com/watch?v=N3cKMUwPd_g.
It uses GamePie as game engine and runs fine on Linux and iOS.P. S. Incase anybody wants to take a look at the code it is here: https://github.com/Vik2015/pierpg. Please note that PieRPG is using a dev version of GamePie (0.2) which is not available yet.
-
JadedTuna
I finally made something that works! :)
GamePie allows you to create games which can be ran on many platforms. The project was created to allow creation of cross-platform games - those that can run on both iOS devices and PCs. It's licensed under zlib license.
Git repository is here: https://github.com/Vik2015/gamepie. For PC you need
gamepie-pc/
and for iOS -gamepie-ios/
. Just put it in the site-packages folder and rename togamepie
.Check
examples/
folder to see some examples. Currently it containsplanes.py
which is a shooting game where you control the player and your goal is to shoot down as many enemy planes as possible. Player can be controlled via keyboard on PC (left
/a
andright
/d
keys,space
shoots,escape
quits) and mouse/touches on PC and iOS. Nothing fancy :)If you have any ideas about what can I add to it please post them here.
-
JadedTuna
@Moe, thanks, cross-platform support was the intention :). Btw, the library also automatically converts Pythonista coordinates ([0, 0] is bottom-left) to PyGame coordinates ([0, 0] is upper-left).
-
JadedTuna
Hey guys. Is it possible to draw 3D objects in Pythonista? I know it doesn't have 3D libraries, but AFAIK Doom was made in DOS without 3D libraries (2.5 D or something). Is it possible to do such stuff in Pythonista (and if it is, what's the estimated speed?). Thanks.