'PGS4A (Pygame for Android)'에 해당되는 글 2건

  1. 2014.04.20 Porting your Python app / Python games / Pygame app / Pygame game to Android app
  2. 2014.04.20 How to install & setup PGS4A on Mac?

All right guys, 



I assume that you guys are already install correctly pygame, PGS4A, Java and Android driver (only for windows). If you haven't, check PGS4A official website and my previous posting. 


So, how we can convert / porting the app to Android app?



Step 1: 


Rename your main app python file to 'main.py'



Step 2: 


Include 'import android' into your main.py



Step 3:


Create a directory that stores your python. All necessary things (images, python files, even libraries or API if it is required). And you must create a directory inside of PGS4A directory.

Ex) In my case, I just put 'app1'



Step 4:


Configure the setting. Type 'python android.py app1 configure'


This command will help you to setup your app. 



Step 5:


Then, build & release. Type 'python android.py build app1 release'



Step 6:


Check 'bin' directory. There should be 'your_app.apk'



Once you success once, next time will be dang easy. :)


I faced a little problem. The game I developed didn't work on Android. Why? Because of input. My game was using keyboard, but it didn't work in PGS4A. 


So, I will show you guys how to change your app/games input for Android in next posting. 



'PGS4A (Pygame for Android)' 카테고리의 다른 글

How to install & setup PGS4A on Mac?  (0) 2014.04.20



I made a sample game using by pygame.

Pygame is AWESOME!!! 
Then, I was looking for a way that I can make my pygame more useful. Luckily, I found PGS4A (PyGame Subset 4 Android). 

 


What is PGS4A? 


It is simple. It is porting your pygame to Android app (APK format). Isn’t it great? Once you develop a game with pygame, you can give it to your friend as exe format (by using py2exe), python script or Android game!!!


 

HOWEVER, I failed to convert EVEN I FOLLOWED ALL THE STEPS on their website!!!!



What the........... Whats wrong? Did I miss any step? 


I don't know, but obviously I missed some step and I am not sure I missed it from the official website or they haven't update yet. 



So, here is my note for other people like me. I have installed it on my Mac, but I bet Linux or Windows will be the same. 


Let's start this instruction!



++ Here is my environment:


- My Mac  OSX is 10.8.5. 


- Java is 1.6. I upgraded to 1.7, but it still shows me 1.6. I bet 1.6 is still fine.


- Python…. of course 2.7


- PGS4A is 0.9.6


 

Step 1: 



Follow the PGS4A guid



Step 2:


Once you followed PGS4A’s instruction, you probably can’t convert a game even if you passed the test. So check this out. 


0. You should run ‘python android.py installsdk’ and saw the failed message


1. Go to pgs4a-0.9.6 directory.


2. go to ‘add-ons’


3. go to ‘tools’


4. double click ‘android’


5. it will open Andriod SDK manager something like that. 


6. You will see “Tools” folder is not installed all. Make sure you manually install all of them. 


7. Make sure installing all of Android 4.4.2 (API 19) or 4.1.2 or something like that. Just full install at least one. In my case, I installed 4.4.2, 4.1.2, and 4.0.0.


8. Then re-run ‘python android.py installsdk’


9. You will see that instruction is asking you to install something (choose yes or no) and it actually installing something!!!!!



Step 3: (In case of Windows user)


You may see there is an error message like this: apache-ant blah blah. It sounds like the installer can't unpack the apache-ant. But you can see there is 'apache-ant-1.8.4-bin.tar.gz' in your folder. Unzip it manually. Try it again. 



If you see the same error, then rename the folder to 'apache-ant'. Try it again.



Step 4: This is very very important part.

Thank you so much to http://pychildren.blogspot.com !!! Because of your posting, I can post this!! :D



Because of this MISSED step, I spent 4 days. What the ............


Ok, you must change your main python file name to 'main.py'.


I kept using it as its original name such as 'down.py' or 'thisismain.py' etc.....


No, you can't! You must change it to 'main.py'.


Then, add this before 'pygame.init()':



try:

    import android

except ImportError:

    android = None





Check this webpage:


http://pychildren.blogspot.com/search/label/PGS4A





1 

글 보관함

카운터

Total : / Today : / Yesterday :
get rsstistory!