Giter Site home page Giter Site logo

pygame_cffi's People

Contributors

ajoubertza avatar arigo avatar drnlm avatar fijal avatar gertburger avatar hodgestar avatar jcupitt avatar jerith avatar onpon4 avatar pidelport avatar rizziepit avatar stefanor avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pygame_cffi's Issues

incorrect cffi call in time.py

Python 2.7.10 (f3ad1e1e1d62, Sep 07 2015, 21:46:51)
[PyPy 2.6.1 with GCC 5.2.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>> import pygame
>>>> pygame.init()
(5, 0)
>>>> pygame.time.set_timer(pygame.USEREVENT,1000)
From cffi callback <function _timer_callback at 0x00007fedc97ec098>:
Traceback (most recent call last):
File "/opt/pypy/site-packages/pygame_cffi-0.1.0-py2.7-linux-x86_64.egg/pygame/time.py", line 115, in _timer_callback
event = ffi.new("SDL_Event")
TypeError: expected a pointer or array ctype, got 'union SDL_Event'
>>>> 

Consider using "SDL_Event *" instead.

Add LGPL notices to pygame files

While most of the files we've imported from pygame (excluding those in tests) have the appropriate LGPL license notices, we've been rather lack about adding them and appropriate copyright holder notes to the rest of the project. This should be fixed.

"event post blocked" when music finishes playing

My game uses pygame.mixer.music.set_endevent() to register an event type to be used when music playback is complete. Running my game with pygame_cffi and PyPy, the following traceback was logged when the queued music file finished playing, and the registered event was never observed. I don't get this traceback with standard pygame in cPython.

Traceback (most recent call last):
  File "/home/josh/.local/lib/pypy2.7/site-packages/pygame/mixer_music.py", line 207, in _endmusic_callback
    event.post(event.Event(_endmusic_event))
  File "/home/josh/.local/lib/pypy2.7/site-packages/pygame/event.py", line 226, in post
    raise RuntimeError("event post blocked for %s" % event_name(event.type))
RuntimeError: event post blocked for Unknown

Segfault

Hi!
So have been using pygame_cffi for a while and one day noticed that one of my programs using pygame_cffi would segfault once in a while.
I figured out what causes it and how to reproduce:

import pygame
import time

pygame.init()
surface = pygame.display.set_mode((800, 800))

color = [255, 127, 0]
pos = (656, 800)
radius = 0
width = 0

pygame.draw.circle(surface, color, pos, radius, width)

objects in my program would get smaller with distance sometimes their radius would reach zero, not often though. so initially i did not pick it up.

if width > radius it throws width greater then radius.
and if radius > width it would work fine.
so it is only in the case of radius = width = 0
that it would segfault.

for me it's an easy fix i can live with

    if radius == 0:
        radius = 1

but it shouldn't segfault.

Too many open files error (fonts related).

A lot of games written with pygame uses functions like this:

    @staticmethod
    def display_single_line(line, x, y, screen):
        """Displays a single line of text on Battle screen"""
        txt = pygame.font.Font(None, 36)
        render = txt.render(line[0:13], 0, (255, 255, 255))
        screen.blit(render, (x, y))

So font file being opened every time when function is called. But this error doesn't happen in PyGame.
Maybe we should add caching or something like it?

event.unicode is sometimes an int

Which is a bit unexpected.

To reproduce: clone pypy, go to directory (like rpython/jit/metainterp)
and run py.test --view test/test_loop.py

then once pygame pops in press "/" to search

pygame.joystick

Clearly this is not implemented yet. Is there an eta on this?

Add an AUTHORS file.

A bunch of different people have now contributed to pygame_cffi. We should give them credit.

Adding missing pygame.draw functions

pygame_cffi currently doesn't support

  • pygame.draw.aaline
  • pygame.draw.aalines
  • pygame.draw.arc

There's also a TODO item in the surface checks that should be completed.

ImportError: No module named pygame._sdl_c

I seem to have a problem with this module on Mac OS X 10.11 Golden Master.

Running "import pygame" causes the following error:

Python 2.7.10 (f3ad1e1e1d6215e20d34bb65ab85ff9188c9f559, Sep 21 2015, 15:59:29)
[PyPy 2.6.1 with GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.0.72)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>> import pygame
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/Cellar/pypy/2.6.1/libexec/site-packages/pygame_cffi-0.0.1-py2.7-macosx-10.11-x86_64.egg/pygame/__init__.py", line 3, in <module>
    from pygame.color import Color
  File "/usr/local/Cellar/pypy/2.6.1/libexec/site-packages/pygame_cffi-0.0.1-py2.7-macosx-10.11-x86_64.egg/pygame/color.py", line 3, in <module>
    from pygame._sdl import ffi, sdl
  File "/usr/local/Cellar/pypy/2.6.1/libexec/site-packages/pygame_cffi-0.0.1-py2.7-macosx-10.11-x86_64.egg/pygame/_sdl.py", line 1, in <module>
    from pygame._sdl_c import ffi
ImportError: No module named pygame._sdl_c
>>>>

To install it, I ran:

brew install pypy cairo jpeg
git clone https://github.com/CTPUG/pygame_cffi.git
cd pygame_cffi
pypy setup.py build build_ext -n -I/usr/local/include
sudo pypy setup.py install build_ext -n -I/usr/local/include

I included "/usr/local/include" because it couldn't find "jpeglib.h"

pygame_cff unpack_rect is too restrictive

with stock pygame:

>> pygame.surface.Surface((120.0, 122.8)) <Surface(120x122x32 SW)>

With pygame_cffi

``>> pygame.surface.Surface((122.0, 122.8))
....
TypeError: expected tuple of two integers but got <type 'tuple'>`

This causes problems with programs that pass floats (usually created by some mathematical operation) when creating surfaces

OverflowError: integer 32769 does not fit 'int16_t'

i encountered this error/bug when running my pygame code.
i think it happens where a to big value for x is entered and can not be stored in a int16_t.
in my case it was a entity in my code going far offscreen.

this is the full traceback:
http://pastebin.com/hf1g75Fn

to reproduce:

>>> import pygame

>>> pygame.init()
(5, 0)

>>> screen = pygame.display.set_mode((300, 400))

>>> pygame.draw.circle(screen, (0xff, 0xff, 0xff), (((2**16)/2), 0), 1)
<rect(32767, 0, -32466, 2)>

>>> pygame.draw.circle(screen, (0xff, 0xff, 0xff), (((2**16)/2)+1, 0), 1)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/duality/.pyvenvs/pypyvenv/site-packages/pygame/draw.py", line 375, in circle
    _fillellipse(surface, pos, radius, radius, color)
  File "/home/duality/.pyvenvs/pypyvenv/site-packages/pygame/draw.py", line 587, in _fillellipse
    c_x - k, c_x + k - 1, c_y - h - 1)
  File "/home/duality/.pyvenvs/pypyvenv/site-packages/pygame/draw.py", line 127, in _drawhorizline
    sdlrect.x = start_x
OverflowError: integer 32768 does not fit 'int16_t'
integer 32768 does not fit 'int16_t'

>>>

Finish pygame.transform

The following functions from pygame.transform aren't complete

  • threshold
  • average_color
  • average_surfaces
  • laplacian

Should test with pypy

Since one of the goals is to provide pygame for pypy, we really should run the test suite against pypy.

Since travis only has horribly outdated versions of pypy available, this will require rolling our own logic for setting up pypy.

We should also try using the travis OSX target sometime.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.