[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

RE: [pygame] pygame Xbox One port



The graphics side of PyGame has been ported to UWP, I haven’t tested the remaining extensions, portmidi needs work, the sdl2 extensions collide in mixer against pygame’s mixer extension, imageext does not work, it didn’t link properly and I don’t know why it’s failing, and there is a super ugly change on the way __init__ gets called, I will push changes made to pygame to one of my repositories.

 

The remaining grace is to test it on Xbox One, since it works for UWP it should not be a problem to finish up the port.

 

The least change is that instead of calling, for example

 

os.path.split(os.path.abspath(__file__))[0]

 

you should call relative to the app’s folder (such as the Assets directory)

 

Assets/Pygame

 

For example.

 

From: owner-pygame-users@xxxxxxxx <owner-pygame-users@xxxxxxxx> On Behalf Of René Dudfield
Sent: Thursday, November 5, 2020 2:05 AM
To: pygame-users@xxxxxxxx
Subject: Re: [pygame] pygame Xbox One port

 

Sorry if below sounds obvious, I don't think I understand your question :)

 

Have you seen the python C extension guide?

 

Python extensions are shared libraries, they can also theoretically be compiled statically. Although I don't know the last time someone tried to compile things in statically with pygame - so it probably doesn't currently work without some adjustments.

 

You can either embed python inside an executable and tell it to load a module from a particular place.

Or have a python executable which can load modules (either with a filename path, or a python module). "python filename.py", or "python -m amodulename".

 

The setup.py uses distutils (and setuptools) to compile extensions. I don't know if there is support for WinRT extensions in the port you use (probably best to ask them if there is). It's also possible to create a visual studio project file with all of the extensions in instead if distutils does not work with the python port.

 

Probably you want to get base.c compiling first, then things like display.c, surface.c, rect.c.

 

 

What is the current Python version pygame Is supporting for pygame 2.0?

 

We test with python 3.5 as the minimum. We haven't gone out of our way to drop python 3.4 support, but we just don't test it anymore. It's probably got some issues, but may not take too much work to get going again.

 

 

 

On Thu, Nov 5, 2020 at 9:53 AM <greentwip@xxxxxxxxx> wrote:

Hi René,

 

I’m new to low level binding for Python, although I’m not new to game porting.

 

There is a source file for OS X called sdlmain_osx.m, I haven’t checked it out completely, but I assumed it’s the entry point for all the bindings and set an executable to run pygame py files, I wonder if there is something similar for Windows, I’m trying to understand what are the extensions or how do they get built, from setup.py

 

    @add_command('build_ext')

    class WinBuildExt(build_ext):

        """This build_ext sets necessary environment variables for MinGW"""

 

        # __sdl_lib_dir is possible location of msvcrt replacement import

        # libraries, if they exist. Pygame module base only links to SDL so

        # should have the SDL library directory as its only -L option.

        for e in extensions:

            if e.name == 'base':

                __sdl_lib_dir = e.library_dirs[0].replace('/', os.sep)

                break

 

        def build_extensions(self):

            # Add supported optimisations flags to reduce code size with MSVC

            opts = flag_filter(self.compiler, "/GF", "/Gy")

            for extension in extensions:

                extension.extra_compile_args += opts

 

            build_ext.build_extensions(self)

 

I suppose those are Python extensions. The main problem found is the binding place in which, for example, the aliens.py file will execute, how does Python know where to pick the built bindings for Windows?

 

It is possible to upgrade Python to something newer, I can definitely start working on it, my first attempt was to use the latest Python release, there are some key points in the port that would be only specific for UWP/Xbox One that can translate to later versions, but it can take at least a few months more.

 

What is the current Python version pygame Is supporting for pygame 2.0?

 

From: owner-pygame-users@xxxxxxxx <owner-pygame-users@xxxxxxxx> On Behalf Of René Dudfield
Sent: Thursday, November 5, 2020 1:41 AM
To: pygame-users@xxxxxxxx
Subject: Re: [pygame] pygame Xbox One port

 

Hello Victor,

 

oh, fun project.

 

To your question... "Where is the main file for Windows?" I'm not sure what you mean.

We don't really support python 3.4 in pygame anymore. Is there not something newer? If there's not something newer... we can reconsider of course!

 

Looking forward to reading about your progress.

 

best regards,

 

 

On Thu, Nov 5, 2020 at 9:10 AM <greentwip@xxxxxxxxx> wrote:

Hello.

 

I recently upgraded a Python 3.4 Windows 8.1 port for WinRT to be used with UWP and Xbox One. The port can be found at https://github.com/Greentwip/cpython, however, I’m troubling myself with the way pygame makes its binding calls to SDL DLLs, the cpython port is embedded in such a way it can be called like this:

 

#include <Python.h>

 

int

main(int argc, char *argv[])

{

  Py_SetProgramName(argv[0]);  /* optional but recommended */

  Py_Initialize();

  PyRun_SimpleString("from time import time,ctime\n"

                     "print 'Today is',ctime(time())\n");

  Py_Finalize();

  return 0;

}

 

Where is the main file for Windows?, am I getting it right? There should be a main file right? I think it might be a good starting point to start porting projects to console platforms.

 

I will share my findings on the code as I slowly port pygame to Xbox One.

 

Thanks!

 

Victor Lopez