Re: [pygame] Re: Playing with Flatpak packaging

2017-03-07 Thread jcupitt
Flatpak is a linux-only thing, it's way of putting desktop programs
into sandboxes that can be safely run without needing to be installed
and with no danger they could mess up the rest of your system.

I think the Windows equivalent is UWP apps. They also run in a sandbox
and are "containerized" in a way that traditional Windows programs are
not.

In a very similar way to this effort, someone would need to make a
base UWP app for python2.7 and pygame, then game developers could just
drop their assets in to make something they could distribute.

John




On 7 March 2017 at 07:06, DiliupG  wrote:
> a python 27 version for windows would be GREATLY appreciated unless you
> consider python 27 users redundant and windows, not a real os.
> :(
>
>
> On 7 March 2017 at 02:28, Luke Paireepinart  wrote:
>>
>> Would be great to try this on my pyweek entry if you're looking for games
>> to test, just let me know how it turns out. It's called solar flair, but was
>> developed with python 2.7 on Windows. I'm not sure on the compatibility with
>> 3.x. - https://github.com/lukevp/pyweek23
>>
>>
>> On Mar 6, 2017 12:11 PM, "Thomas Kluyver"  wrote:
>>
>> I developed this a bit further, though there's still more I hope to do
>> with it.
>>
>> It turns out that building a custom runtime is discouraged; the better way
>> to support game developers is to build a 'base app', which people can then
>> add their own game files to. I have prepared two different base apps: one
>> includes Python 3.6, and makes a download of about 30 MiB. The other uses
>> Python 3.4 from the shared runtime, so is a download of about 7 MiB. My idea
>> is that the game developer can choose between the latest language features
>> and a quicker installation.
>>
>> My next step is to make a more complete example of using this to package a
>> game (so far, I've tested with the 'aliens' example that ships with pygame).
>> I might try with the solarwolf example on Pygame's Github org - or if anyone
>> wants to suggest another suitable open-source game based on pygame, I could
>> try with that.
>>
>> Thomas
>>
>> On 26 February 2017 at 19:47, Thomas Kluyver  wrote:
>>>
>>> I spent a while today playing with Flatpak, a new system for packaging
>>> sandboxed applications on Linux. The result is an example that can build and
>>> install Pygame's Aliens example game:
>>>
>>> https://github.com/takluyver/pygame-flatpak-test
>>>
>>> If you're running Fedora 24+, Ubuntu 16.10 (might need a PPA?) Debian
>>> testing/unstable or Arch, you can install Flatpak and try it out.
>>>
>>> This is quite rough at the moment, but I think it has good potential for
>>> distributing games to Linux users in the future. It looks like [1] Flatpak
>>> is on its way to becoming the default cross-distro app distribution
>>> mechanism for desktop Linux.
>>>
>>> The big improvement I'd like to make is building a dedicated Flatpak
>>> 'runtime' for pygame, including a newer version of Python - the base runtime
>>> I'm using at present has Python 3.4.
>>>
>>> Thanks,
>>> Thomas
>>>
>>> [1]
>>> https://kamikazow.wordpress.com/2017/02/09/adoption-of-flatpak-vs-snap/
>>
>>
>>
>
>
>
> --
> Kalasuri Diliup Gabadamudalige
>
> https://dahamgatalu.wordpress.com/
> http://soft.diliupg.com/
> http://www.diliupg.com
>
> **
> This e-mail is confidential. It may also be legally privileged. If you are
> not the intended recipient or have received it in error, please delete it
> and all copies from your system and notify the sender immediately by return
> e-mail. Any unauthorized reading, reproducing, printing or further
> dissemination of this e-mail or its contents is strictly prohibited and may
> be unlawful. Internet communications cannot be guaranteed to be timely,
> secure, error or virus-free. The sender does not accept liability for any
> errors or omissions.
> **
>


Re: [pygame] Faster blitting

2016-03-14 Thread jcupitt
On 13 March 2016 at 23:22, Greg Ewing  wrote:
> Leif Theden wrote:
>> The fast_blit method would with the barest minimum of checking before
>> calling the sdl blitting functions.
>
> Have you performed any measurements to find out whether
> the checking overhead is significant in the cases where
> the formats do match? Without evidence, I'm skeptical
> about that.

I agree with Greg, the checks themselves are very unlikely to take a
significant amount of time.

I think Leif is right though that the forgiving nature of the blit
functions makes it easy to have horrible performance problems in your
code and to be completely unaware of them. How about adding a thing to
print warnings about issues like this?

You'd something like this to your game:

  pygame.set_performance_warnings(True)

And then in the blit code, there would be extra stuff like this:

  if (src->format != dst->format) {
if (performance_warnings)
  printf ("** performance warning: bit: src and dst formats do not
match\n");
format_convert (src, dst->format);
  }

ie. it would warn you that extra conversions were being done behind your back.

Now to speed up your game, you just need to turn on the warnings and
try to stop your inner loops printing things. No doubt other parts of
pygame do similar things to this.

I'm a C programmer, I'd be happy to make a small patch to add
something like this if there's interest.

John


Re: [pygame] Accessing C++ libs with ctypes

2015-11-10 Thread jcupitt
On 10 November 2015 at 00:52, Bartosz Debski  wrote:
> I know this is not directly pygame related question but I'm looking for help
> from more c++/Python able.
>
> I'm trying to get some use of Steam libraries which are C++. I have managed
> quite easily to load Steam library and initialize it with use of Python
> ctypes (Steam lib returns loaded Steam App)
>
> Now as I'm trying to get more useful information from documentation, all is
> in C++ and all references are C++.
>
> eg:
> "
> At the beginning of a game session, call
> SteamUserStats()->RequestCurrentStats() to fetch the user's data from the
> Steam back end. You will receive a UserStatsReceived_t callback when the
> data is ready.

In that C++, SteamUserStats() is returning a struct, and that struct
contains a function pointer called RequestCurrentStats() which you
must then call. The function pointer might be a plain struct member,
or it might be a class member, perhaps on the vfunc table. you'd need
to do some digging to find out exactly how it all works. It would be
rather difficult in ctypes.

Have you looked at cffi? It's a modern replacement for ctypes which
automates a lot of this stuff. You just give it a copy of the C++
headers and it generates all of the glue code for you. There's a nice
post here:

http://eli.thegreenplace.net/2013/03/09/python-ffi-with-ctypes-and-cffi

And some demos and examples in the cffi project:

https://bitbucket.org/cffi/cffi/src/default/demo/

John


Re: [pygame] Pygame for python 2.7 64bit - Yosemite - Help!!

2015-03-21 Thread jcupitt
On 21 March 2015 at 20:31, JeffreyDanowitz  wrote:
> Ok  - I tried using Homebrew and I got the following error:
>
> Jeffreys-Air:opt jeffreydanowitz$ brew install pygame
> Error: No available formula for pygame
> Searching formulae...
> Searching taps...
> homebrew/python/pygame


Sorry, I forgot, pygame is in the "python" section of homebrew (they
call them taps). You need to add the tap before you can install
pygame.

Enter:

brew tap homebrew/python
brew install pygame

This installs pygame 1.9, hopefully that's the one you need.

John


Re: [pygame] Pygame for python 2.7 64bit - Yosemite - Help!!

2015-03-21 Thread jcupitt
On 21 March 2015 at 19:51, JeffreyDanowitz  wrote:
> Do you think that brew will work with Anaconda? I know that pip does - so
> perhaps this is possible. Will the brew put in the SDL if necessary? I'll
> let you know what happens.

Yes, brew will pull in all of SDL for you. I've no idea about Anaconda, sorry.

John


Re: [pygame] Pygame for python 2.7 64bit - Yosemite - Help!!

2015-03-21 Thread jcupitt
Hi Jeff,

I used homebrew to install pygame. Install homebrew as per their instructions:

  http://brew.sh/

Don't forget to remove macports first, they'll get tangled up. Then
just type "brew install pyame" and it'll download, patch, configure,
build and install pygame for you automatically.

Performance is not great on mac, unfortunately. I think the mac
backend for SDL needs some work.

John






On 21 March 2015 at 15:10, JeffreyDanowitz  wrote:
> Hi everybody,
>
> I have Python 2.7.9 :: Anaconda 2.1.0 (x86_64) - in other words, my Python
> comes from the Anaconda install for Mac which is only a 64bit version.
> I want to install Pygame.
> Note that in Windows I had the same situation, but I found a suitable 64bit
> Pygame 1.9.2 install for windows.
>
> I have tried compiling, but then I get compiler complaints that SDL is not
> installed (although the directories exist in /Library/frameworks).
>
> I have the entire Pygame code directory that I downloaded using SVN -- but I
> am baffled at how to install this. All attempts have lead to errors. I also
> installed MacPorts, which was suggested by some post I read - this also did
> not help (at least as far as I was able to get).
>
> I cannot be the only Mac user who is attempting to install pygame for 64bit
> python 2.7. I cannot be alone! Is there anyone who can help out with clear
> instructions of what to do? I'd appreciate it.
>
> Thanks,
> Jeff
>
>
>
> --
> View this message in context: 
> http://pygame-users.25799.x6.nabble.com/Pygame-for-python-2-7-64bit-Yosemite-Help-tp1790.html
> Sent from the pygame-users mailing list archive at Nabble.com.


Re: [pygame] made a game

2015-03-17 Thread jcupitt
Thank you all for your kind words. I fixed it up a bit, it works
slightly better now.

I did a webgl version too, which is quite fun:
http://jcupitt.github.io/argh-steroids-webgl

I still need help to register though. I'll try another mail with a
better subject line.

John


[pygame] need help to register on pygame.org

2015-03-17 Thread jcupitt
Hi, I made a tiny game and I'd like to upload it on pygame:

  https://github.com/jcupitt/argh-steroids

I think I need a login on the pygame site. Could someone help me?

John


Re: [pygame] made a game

2015-03-13 Thread jcupitt
Thank you for you kind words, Dillup and Bartosz!

You're right, some sound effects would be nice.

Does it work OK on Windows? Hold down 'I' on the start screen to see
an FPS counter. I've tried a few machines:

Ubuntu laptop: 85 fps
iMac: 30 fps ( terrible)
Raspberry-pi 2: 17 fps
r-pi 2 with pypy and pygame_cffi: 5 fps
r-pi 2 with cpython and pygame_cffi: 1 fps

I suppose the pygame_cffi call overhead is too high for pypy to be
worthwhile in this case, sadly.

John


[pygame] made a game

2015-03-12 Thread jcupitt
I made an arcade game using pygame:

  https://github.com/jcupitt/argh-steroids

I think I need to register to post it on the pygame site, could I have
the secret link please?

John