Skip to content

Commit

Permalink
Removed more references to pygame
Browse files Browse the repository at this point in the history
  • Loading branch information
inclement committed Feb 3, 2019
1 parent e334b75 commit 2304f20
Show file tree
Hide file tree
Showing 11 changed files with 11 additions and 293 deletions.
1 change: 0 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,3 @@ recursive-include pythonforandroid/recipes *.py *.patch *.c *.pyx Setup *.h
recursive-include pythonforandroid/bootstraps *.properties *.xml *.java *.tmpl *.txt *.png *.aidl *.py *.sh *.c *.h *.html *.patch

prune .git
prune pythonforandroid/bootstraps/pygame/build/libs
12 changes: 4 additions & 8 deletions doc/source/apis.rst
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,7 @@ Advanced Android API use
As mentioned above, the ``android`` Python module provides a simple
wrapper around many native Android APIS, and it can be included by
adding it to your requirements, e.g. :code:`--requirements=kivy,android`.
It is not automatically included by Kivy unless you use the old (Pygame)
bootstrap.
It is not automatically included with Kivy.

The available functionality of this module is not separately documented.
You can read the source `on
Expand Down Expand Up @@ -159,9 +158,6 @@ a Java class. For instance, here is the code to vibrate your device::
# application, this reference is stored automatically by
# Kivy's PythonActivity bootstrap

# This one works with Pygame
# PythonActivity = autoclass('org.renpy.android.PythonActivity')
# This one works with SDL2
PythonActivity = autoclass('org.kivy.android.PythonActivity')

Expand All @@ -176,9 +172,9 @@ Things to note here are:

- The class that must be wrapped depends on the bootstrap. This is
because Pyjnius is using the bootstrap's java source code to get a
reference to the current activity, which both the Pygame and SDL2
bootstraps store in the ``mActivity`` static variable. This
difference isn't always important, but it's important to know about.
reference to the current activity, which the bootstraps store in the
``mActivity`` static variable. This difference isn't always
important, but it's important to know about.
- The code closely follows the Java API - this is exactly the same set
of function calls that you'd use to achieve the same thing from Java
code.
Expand Down
2 changes: 1 addition & 1 deletion doc/source/bootstraps.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Bootstraps
==========

This page is about creating new bootstrap backends. For build options
of existing bootstraps (i.e. with SDL2, Pygame, Webview etc.), see
of existing bootstraps (i.e. with SDL2, Webview, etc.), see
:ref:`build options <bootstrap_build_options>`.

python-for-android (p4a) supports multiple *bootstraps*. These fulfill a
Expand Down
12 changes: 4 additions & 8 deletions doc/source/services.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,16 @@ There are two ways to have services included in your APK.
Service folder
~~~~~~~~~~~~~~

This basic method works with both the new SDL2 and old Pygame
bootstraps. It is recommended to use the second method (below) where
possible.
This is the older method of handling services. It is
recommended to use the second method (below) where possible.

Create a folder named ``service`` in your app directory, and add a
file ``service/main.py``. This file should contain the Python code
that you want the service to run.

To start the service, use the :code:`start_service` function from the
:code:`android` module (included automatically with the Pygame
bootstrap, you must add it to the requirements manually with SDL2 if
you wish to use this method)::
:code:`android` module (you may need to add ``android`` to your app
requirements)::

import android
android.start_service(title='service name',
Expand All @@ -49,8 +47,6 @@ you wish to use this method)::
Arbitrary service scripts
~~~~~~~~~~~~~~~~~~~~~~~~~

.. note:: This service method is *not supported* by the Pygame bootstrap.

This method is recommended for non-trivial use of services as it is
more flexible, supporting multiple services and a wider range of
options.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,11 @@
#include <errno.h>

#include "bootstrap_name.h"

#ifndef BOOTSTRAP_USES_NO_SDL_HEADERS
#include "SDL.h"
#ifndef BOOTSTRAP_NAME_PYGAME
#include "SDL_opengles2.h"
#endif
#endif
#ifdef BOOTSTRAP_NAME_PYGAME
#include "jniwrapperstuff.h"
#endif
#include "android/log.h"

#define ENTRYPOINT_MAXLEN 128
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
/**
* This class takes care of managing resources for us. In our code, we
* can't use R, since the name of the package containing R will
* change. (This same code is used in both org.renpy.android and
* org.renpy.pygame.) So this is the next best thing.
* change. So this is the next best thing.
*/

package org.renpy.android;
Expand Down
54 changes: 0 additions & 54 deletions pythonforandroid/recipes/android/src/android/_android.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,6 @@

include "config.pxi"

IF BOOTSTRAP == 'pygame':
cdef extern int SDL_ANDROID_CheckPause()
cdef extern void SDL_ANDROID_WaitForResume() nogil
cdef extern void SDL_ANDROID_MapKey(int scancode, int keysym)

def check_pause():
return SDL_ANDROID_CheckPause()

def wait_for_resume():
android_accelerometer_enable(False)
SDL_ANDROID_WaitForResume()
android_accelerometer_enable(accelerometer_enabled)

def map_key(scancode, keysym):
SDL_ANDROID_MapKey(scancode, keysym)

# Android keycodes.
KEYCODE_UNKNOWN = 0
KEYCODE_SOFT_LEFT = 1
Expand Down Expand Up @@ -179,8 +163,6 @@ python_act = autoclass(JAVA_NAMESPACE + u'.PythonActivity')
Rect = autoclass(u'android.graphics.Rect')
mActivity = python_act.mActivity
if mActivity:
# PyGame backend already has the listener so adding
# one here leads to a crash/too much cpu usage.
# SDL2 now does not need the listener so there is
# no point adding a processor intensive layout listenere here.
height = 0
Expand Down Expand Up @@ -274,42 +256,6 @@ def get_buildinfo():
binfo.VERSION_RELEASE = BUILD_VERSION_RELEASE
return binfo

IF IS_PYGAME:
# Activate input - required to receive input events.
cdef extern void android_activate_input()

def init():
android_activate_input()

# Action send
cdef extern void android_action_send(char*, char*, char*, char*, char*)
def action_send(mimetype, filename=None, subject=None, text=None,
chooser_title=None):
cdef char *j_mimetype = <bytes>mimetype
cdef char *j_filename = NULL
cdef char *j_subject = NULL
cdef char *j_text = NULL
cdef char *j_chooser_title = NULL
if filename is not None:
j_filename = <bytes>filename
if subject is not None:
j_subject = <bytes>subject
if text is not None:
j_text = <bytes>text
if chooser_title is not None:
j_chooser_title = <bytes>chooser_title
android_action_send(j_mimetype, j_filename, j_subject, j_text,
j_chooser_title)

cdef extern int android_checkstop()
cdef extern void android_ackstop()

def check_stop():
return android_checkstop()

def ack_stop():
android_ackstop()

# -------------------------------------------------------------------
# URL Opening.
def open_url(url):
Expand Down
112 changes: 0 additions & 112 deletions pythonforandroid/recipes/android/src/android/_android_jni.c
Original file line number Diff line number Diff line change
Expand Up @@ -201,118 +201,6 @@ void android_get_buildinfo() {
}
}

#if IS_PYGAME
void android_activate_input(void) {
static JNIEnv *env = NULL;
static jclass *cls = NULL;
static jmethodID mid = NULL;

if (env == NULL) {
env = SDL_ANDROID_GetJNIEnv();
aassert(env);
cls = (*env)->FindClass(env, "org/renpy/android/SDLSurfaceView");
aassert(cls);
mid = (*env)->GetStaticMethodID(env, cls, "activateInput", "()V");
aassert(mid);
}

(*env)->CallStaticVoidMethod(env, cls, mid);
}

int android_checkstop(void) {
static JNIEnv *env = NULL;
static jclass *cls = NULL;
static jmethodID mid = NULL;

if (env == NULL) {
env = SDL_ANDROID_GetJNIEnv();
aassert(env);
cls = (*env)->FindClass(env, "org/renpy/android/SDLSurfaceView");
aassert(cls);
mid = (*env)->GetStaticMethodID(env, cls, "checkStop", "()I");
aassert(mid);
}

return (*env)->CallStaticIntMethod(env, cls, mid);
}

void android_ackstop(void) {
static JNIEnv *env = NULL;
static jclass *cls = NULL;
static jmethodID mid = NULL;

if (env == NULL) {
env = SDL_ANDROID_GetJNIEnv();
aassert(env);
cls = (*env)->FindClass(env, "org/renpy/android/SDLSurfaceView");
aassert(cls);
mid = (*env)->GetStaticMethodID(env, cls, "ackStop", "()I");
aassert(mid);
}

(*env)->CallStaticIntMethod(env, cls, mid);
}

void android_action_send(char *mimeType, char *filename, char *subject, char *text, char *chooser_title) {
static JNIEnv *env = NULL;
static jclass *cls = NULL;
static jmethodID mid = NULL;

if (env == NULL) {
env = SDL_ANDROID_GetJNIEnv();
aassert(env);
cls = (*env)->FindClass(env, "org/renpy/android/Action");
aassert(cls);
mid = (*env)->GetStaticMethodID(env, cls, "send",
"(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V");
aassert(mid);
}

jstring j_mimeType = (*env)->NewStringUTF(env, mimeType);
jstring j_filename = NULL;
jstring j_subject = NULL;
jstring j_text = NULL;
jstring j_chooser_title = NULL;
if ( filename != NULL )
j_filename = (*env)->NewStringUTF(env, filename);
if ( subject != NULL )
j_subject = (*env)->NewStringUTF(env, subject);
if ( text != NULL )
j_text = (*env)->NewStringUTF(env, text);
if ( chooser_title != NULL )
j_chooser_title = (*env)->NewStringUTF(env, text);

(*env)->CallStaticVoidMethod(
env, cls, mid,
j_mimeType, j_filename, j_subject, j_text,
j_chooser_title);
}

void android_open_url(char *url) {
static JNIEnv *env = NULL;
static jclass *cls = NULL;
static jmethodID mid = NULL;

if (env == NULL) {
env = SDL_ANDROID_GetJNIEnv();
aassert(env);
cls = (*env)->FindClass(env, "org/renpy/android/SDLSurfaceView");
aassert(cls);
mid = (*env)->GetStaticMethodID(env, cls, "openUrl", "(Ljava/lang/String;)V");
aassert(mid);
}

PUSH_FRAME;

(*env)->CallStaticVoidMethod(
env, cls, mid,
(*env)->NewStringUTF(env, url)
);

POP_FRAME;
}
#endif // IS_PYGAME

void android_start_service(char *title, char *description, char *arg) {
static JNIEnv *env = NULL;
static jclass *cls = NULL;
Expand Down
3 changes: 0 additions & 3 deletions test_builds/test.sh

This file was deleted.

69 changes: 0 additions & 69 deletions test_builds/tests/test_apk.py

This file was deleted.

Loading

0 comments on commit 2304f20

Please sign in to comment.