Porting Pythonista modules to PC
This is a port of Pythonista-only modules to PC. It will allow you to play games written using scene.py module.
Git repo can be found here
If you want to help me, please try to find out and explain to me, how
pop_matrixfunctions work :)
I really need them.
Currently working on
Images, text and Hydrogen. Text rendering is working fine, and now I am trying to write
load_imageand such stuff.
I love your idea, unfortunately I am too new to Python to be of much help, but I have bookmarked you on github :)
@siddbudd, thanks :). I am currently working on fixing drawing. Because pygame sets start coords to the top-left of the screen, while Pythonista sets it to start coords to down-left of the screen.
Maybe anyone has any ideas how do I do this? Thanks
@ShadowSlayer, simply use [screen height] - y for any y coordinates and you'll achieve the same y coordinate handling as with Pythonista.
This is a great idea! However, I am new to Pythonista and I have installed anaconda on my windows 8. I have put the files in the Anaconda\Lib\site-packages folder. I can't get python to recognize the module when I try 'import scene'. What am I missing?
Hey people! I am finally back with some fixes. Sorry for not being active for such long time, I had some other stuff to do.
@dgelessus, thanks :). I already understood. Thought I had to add a little bit more stuff:
y = size - (y + h).
@nwinspeare, not very sure what your problem is... I've never used anaconda myself. Try to create some file like mytestfile.py in Anaconda\Lib\site-packages\ and then import it in python:
import mytestfile. If it gives you error about module not found - Anaconda\Lib\site-packages\ is probably not in your PYTHONPATH.
About the new version.
I managed to fix drawing, so now it works just like in Pythonista!
In the next update I am going to add normal text drawing, and maybe something else :)
P. S. The piano is now working just as it should, except stroke. I think I am going to write my own function for drawing strokes (it won't be very hard), because when I use stroke in pygame.draw.rect, it gives me VERY weird results.
Thank you for posting this, ShadowSlayer!
I was just starting to work on precisely the same thing. I'm teaching my daughter programming using Python and was distressed to find that we had to choose between writing (reasonably) portable code with PyGame or writing scripts that would run on her iPad (fun).
When this layer is complete, we can write to the Pythonista interface and run almost anywhere.
Have you by any chance heard of anybody working on the converse - a python-only layer that provides PyGame-like classes and functions implemented in terms of the Pythonista modules? That would open up a large collection of PyGame apps that could then run on iOS. Presumably it would be much larger undertaking. (And yes, I realize that PyGame is normally implemented as natively-compiled code. This would be an exception.)
Fantastic work, thanks!
pop_matrixare used for transforms (translate, scale and rotate) however pyGame provides the pygame.transform functions so it is not necessary as such for these functions in the port. (I am not currently at my main computer to test this). I believe that if you were using a PyOpenGL backend then it would heavily rely on
However this does raise an issue of the pythonista scene module changes the transformation matrix, were as the pyGame
pygame.transformcreates a new surface object.