Re: [pygame] Drawing efficiency question

2022-03-01 Thread Greg Ewing
On 2/03/22 12:02 pm, Irv Kalb wrote:> I'm wondering if my code to check if an element is within the viewable area, is actually doing more work than not bothering to check at all. If the drawing of each object is just a blit call, then your checks are probably just duplicating what pygame is

Re: [pygame] Time to load font with pygame.font.SysFont on Mac

2021-04-04 Thread Greg Ewing
On 5/04/21 9:29 am, Irv Kalb wrote: If I load a font like the system font using None with a call to pygame.font.font, it happens almost immediately. But if I load a font by name using pygame.font.SysFont, it's taking over 7 seconds on my Mac to load. It doesn't seem to matter which font I

Re: [pygame] Confusing values from mixer.Channel.get_sound()

2020-12-26 Thread Greg Ewing
On 26/12/20 10:57 pm, Pavils Jurjans wrote: As you can see, in my case the channels point to different addresses, but still behave as if they are linked. Maybe it is important on what platform I am running this code? Perhaps. I suspect they still refer to the same channel id, even though

Re: [pygame] Confusing values from mixer.Channel.get_sound()

2020-12-25 Thread Greg Ewing
On 26/12/20 3:38 am, Pavils Jurjans wrote: I first play a sound (get the channel object in return), and let it play until the end. channel.get_sound() returns None, as it should. Then I play this sound a second time (storing the returned channel object in another variable). While the sound is

Re: [pygame] Bug: Circle tearing with mouse clicks within the window.

2020-12-14 Thread Greg Ewing
On 15/12/20 4:00 pm, Michael Baca wrote: The following code, when run, causes an issue where the circle starts to tear as it moves across the screen You could try screen = pg.display.set_mode((600, 400), flags = pg.HWSURFACE | pg.DOUBLEBUF) According to the docs, this will cause

Re: [pygame] Can the pygame infrastructure be used for non-graphical text-mode games?

2020-07-11 Thread Greg Ewing
You might like to look at these: https://pythonhosted.org/tale/ https://github.com/lordmauve/adventurelib -- Greg

Re: [pygame] Can the pygame infrastructure be used for non-graphical text-mode games?

2020-06-18 Thread Greg Ewing
On 18/06/20 12:40 pm, pjfarl...@earthlink.net wrote: Is it possible to use the pygame infrastructure to implement text-mode-only games? Without having to pick window sizes and resolutions and set fonts and font sizes, etc., etc., on a graphical surface? Or am I just looking at the wrong

Re: [pygame] Python/pygame version compatibility

2020-03-23 Thread Greg Ewing
On 24/03/20 5:52 pm, Irv Kalb wrote: But I've read here that Python 3.8 doesn't, or at least didn't, work with the current version of Pygame. Is this still true? I've just been through the process of trying to get pygame 1.9.6 working with python 3.8 (mainly because they're the current

Re: [pygame] pygame.display.flip slow

2020-02-20 Thread Greg Ewing
On 20/02/20 8:57 am, Nuno Maltez wrote: when I run my test program, Machine B reports FPS > 200, and pygame.display.flip taking 0.002 per call, while machine A reports FPS < 60, and pygame.display.flip taking 0.016 per call. This looks to me like machine A is synchronising its flips with the

Re: [pygame] Initializing and Reinitializing Instance variables

2019-05-27 Thread Greg Ewing
Irv Kalb wrote: I hadn't thought of the extra "Session" object, it sounds like an interesting approach. However, I'm looking for a clear solution that I can teach to students who are just learning about OOP. Don't think of it as an extra session object, rather think of it as creating a new

Re: [pygame] Initializing and Reinitializing Instance variables

2019-05-27 Thread Greg Ewing
mspaintmaes...@gmail.com wrote: class ApplicationContext: def __init__(self): self.session = GameSession() def reset(self): self.session = GameSession() Nope, this doesn't solve your fundamental problem of getting rid of a duplicate assignment, I'd probably do it like this:

Re: [pygame] Practice Game code ?

2019-04-23 Thread Greg Ewing
You could also try PyWeek competition entries. -- Greg

Re: [pygame] Some way to pickle or otherwise save a pygame.mixer.Sound object?

2018-06-07 Thread Greg Ewing
Alec Bennett wrote: 16 bit wav files. 1411 kbps. About 5 megs each but one is very long (a 13 minute medley of all of them, 133 megs). Okay, I didn't realise they were that big -- I was thinking short horn sounds, not substantial pieces of music! You bring up a good point, I can certainly

Re: [pygame] Some way to pickle or otherwise save a pygame.mixer.Sound object?

2018-06-07 Thread Greg Ewing
Alec Bennett wrote: since it needs to load each of the 20 sounds on startup it takes about 30 seconds to load. I'm running it on a Raspberry Pi, which doesn't help of course. How big are the sound files? Unless they're really enormous, that sounds excessive, even for an R. Pi. What format

Re: [pygame] Only first call to Sound.play() is working

2018-04-20 Thread Greg Ewing
Pablo Moleri wrote: import time import pygame pygame.mixer.init() sound = pygame.mixer.Sound("my_sound_file.wav") sound.play() time.sleep(10) sound.play() If that's you're entire program, I'd say it's finishing before the second sound gets a chance to play. The

Re: [pygame] pygame.key.get_pressed() works unpredictably

2018-04-05 Thread Greg Ewing
gmail aprekates wrote: The problem i get with the following code is that the rect moves as if i pressed a key more than one times. For me, it works the way I would expect from the code, i.e. the rect continues to move as long as an arrow key is held down. If instead you want it to move one

Re: [SPAM: 6.600] Re: [pygame] Re: removing 'experimental' notice from pygame.math

2018-03-03 Thread Greg Ewing
Russell Jones wrote: IDK about physics, but AIUI, Z points from side to side, Y points down and X points diagonally; it's Λ that points up. Only if your computer screen is oriented vertically. If you're using a tablet in your lap, Λ points forward and Y points backwards. So obviously the code

Re: [SPAM: 5.011] [pygame] Re: removing 'experimental' notice from pygame.math

2018-03-03 Thread Greg Ewing
René Dudfield wrote: Length is also confusing because... length of the container. Yes, in Python terms the "length" of a vector should really be the number of components it has. (BTW, there's a similar problem in Python itself with using len() for the size of containers in general. I find

Re: [SPAM: 5.011] Re: [SPAM: 6.600] Re: [pygame] Re: removing 'experimental' notice from pygame.math

2018-03-02 Thread Greg Ewing
René Dudfield wrote: So it might be nice to return the length(magnitude) there? BTW, I don't really like the name "length" for a function that returns the magnitude of an arbitrary vector. It only makes sense for vectors representing a physical distance; it's nonsense for anything else

Re: [SPAM: 6.600] Re: [pygame] Re: removing 'experimental' notice from pygame.math

2018-03-01 Thread Greg Ewing
Daniel Pope wrote: Y points up in real physics? No, no, no. Z points up in real physics! -- Greg

Re: [pygame] Opening Python project in PyCharm - Mac

2018-02-06 Thread Greg Ewing
Alex Nordlund wrote: No, that's the toolbox, the toolbox app is free. It's also confusingly named :-) But does it do anything on its own? According to the web page about it, it's just something for managing their other tools, which are not free. If I'm wrong about that, and it actually has

Re: [pygame] Opening Python project in PyCharm - Mac

2018-02-03 Thread Greg Ewing
Alex Nordlund wrote: The toolbox app from jetbrains already does that but better :-) Also a LOT more expensively, from the looks of their web site. -- Greg

Re: [pygame] Opening Python project in PyCharm - Mac

2018-02-02 Thread Greg Ewing
Leif Theden wrote: you could maybe create a context menu helper (i'm not familar enough with os x to advise how to do that) that launches pycharm with the correct path appended to the pycharm launcher. It looks like you should be able to do this using Automator:

Re: [pygame] Building paths & pygame.image.load documentation

2017-11-25 Thread Greg Ewing
Ian Mallett wrote: Hmm I didn't know this, never really viewing Macs as suitable for development. Classic MacOS wasn't great for development, but MacOSX is a flavour of Unix, so you get all the usual developer comforts. -- Greg

Re: [pygame] Building paths & pygame.image.load documentation

2017-11-25 Thread Greg Ewing
Irv Kalb wrote: I started working in that environment in the days of Mac OS9. At that time, the Mac folder separator character was the ":" colon character. Yes, in those days it was vitally necessary to use the os.path functions for cross-platform code. VMS is another example of a system

Re: [pygame] Building paths & pygame.image.load documentation

2017-11-25 Thread Greg Ewing
Ian Mallett wrote: As far as I know, the os.path version does a string conversion to the platform-preferred way of specifying paths. No, it doesn't -- that only happens if you use normpath(): >>> os.path.join("abc/def", "ghi") 'abc/def\\ghi' >>> os.path.normpath('abc/def\\ghi')

Re: [pygame] Building paths & pygame.image.load documentation

2017-11-25 Thread Greg Ewing
Irv Kalb wrote: But then I point out how Python solves this issue by allowing programmers to use the "/" character as the folder separator character - and how Python maps that character into the appropriate character for the operating system on which the program is running. This is WRONG.

Re: [pygame] Line Collision

2017-11-18 Thread Greg Ewing
gabrielslo...@gmail.com wrote: Hey, supose i have a Rect and a Line, i just want to see if the line intercepts the rect, is that possible somehow in a kind of optimized way For axis-aligned rectangles you probably want the Cohen-Sutherland algorithm:

Re: [pygame] How to prevent mouse initialization in Pygame

2017-07-05 Thread Greg Ewing
Роман Мещеряков wrote: I instruct pygame to not use X Window server (which, if I understand right, should set $DISPLAY environment variable), but to use framebuffer. Probably the framebuffer device is owned by root and only allows access by root. Changing the permissions on /dev/fb might

Re: [pygame] take screenshots of desktop and any app running (even with direct3d, opengl, sdl, ...)

2017-06-20 Thread Greg Ewing
Martin Kühne wrote: There appears to be a glReadPixels(0, 0, width, height, GL_RGB, GL_UNSIGNED_BYTE, pixels) function for that purpose in the OpenGL C library, maybe pyopengl has an equivalent function? That will only give you a snapshot of your own OpenGL drawing area, not anything else on

Re: [pygame] Pygame for SDL 2, and how it may look.

2017-04-20 Thread Greg Ewing
Lenard Lindstrom wrote: I was certain I had read about restrictions regarding a window's surface and a renderer. But I can't find anything in the SDL API docs. I don't know about SDL, but as far as OpenGL goes, usually the way it works is that a context can only be bound to one window (or part

Re: [pygame] Pygame for SDL 2, and how it may look.

2017-04-20 Thread Greg Ewing
Lenard Lindstrom wrote: Unfortunately, the special parser machinery to support Cython includes is only implemented at the module level. It was never generalized to work in any code block. The include statement in Pyrex was something of a hack that I used for sharing declarations before the

Re: [SPAM: 5.011] Re: [pygame] Pygame for SDL 2, and how it may look.

2017-04-20 Thread Greg Ewing
Ian Mallett wrote: ​I like this idea a lot, modulo that you should also store the reference to the window. The Renderer would hold a reference to the window itself, so you would only need to keep a separate reference to the window if you wanted to use different renderers with it at different

Re: [pygame] Pygame for SDL 2, and how it may look.

2017-04-20 Thread Greg Ewing
Leif Theden wrote: While I have not personally tested it, there seems to be more evidence that windows can contain (use? manage?) more than one Renderer: If that's true, then it might make sense for the Renderer to have a 'window' attribute. The Renderer would then be the thing you keep a

Re: [pygame] Pygame for SDL 2, and how it may look.

2017-04-20 Thread Greg Ewing
Lenard Lindstrom wrote: However, after a bit of experimenting I find a window can have both a renderer and a display surface. In that case, I'd suggest the Window object should have 'renderer' and 'surface' attributes. If the Renderer or Surface keeps a reference back to the window, it should

Re: [pygame] Pygame for SDL 2, and how it may look.

2017-04-20 Thread Greg Ewing
Lenard Lindstrom wrote: Extension type WindowSurface would add an SDL window C pointer to its pygame.Surface parent. This window pointer cannot be factored out into a separate WindowBase parent class. And any methods which access that pointer will be specific to WindowSurface's C structure

Re: [pygame] Dirty rect overlapping optimizations

2017-03-27 Thread Greg Ewing
Ian Mallett wrote: ​I mean this in a fundamental, mathematical sense. With O(n) rectangles, you can produce O(n^2) regions that cannot be decomposed into fewer than O(n^2) disjoint rectangles. True, but that's a worst case, unlikely to be approached in practice. Also, for this application,

Re: [pygame] Dirty rect overlapping optimizations

2017-03-27 Thread Greg Ewing
Ian Mallett wrote: Unfortunately, computing those rectangles is annoying, and also O(n^2) in the number of rectangles With the right data structures and algorithms, it doesn't have to be. Apple's Quickdraw had some very efficient ways of representing and operating on regions made up of

Re: [SPAM: 9.600] Re: [pygame] pygame with SDL2 proposal

2017-03-20 Thread Greg Ewing
Leif Theden wrote: For those just reading the thread and haven't voiced your opinion, please do so now. It would be nice if pygame 2 could have a pygame 1 compatible subset, because of the aforementioned tutorial materal etc. out there, and in the interests of users not having to relearn more

Re: [pygame] timer callback into object?

2017-02-11 Thread Greg Ewing
Irv Kalb wrote: So, my specific question is this: Is there any way for an object to create a timer, that results to a callback within the same object? There's nothing built into pygame for doing that as far as I know. You'll have to build something yourself. -- Greg

Re: [pygame] New pygame.org website

2016-12-23 Thread Greg Ewing
Luke Paireepinart wrote: Regarding Angular, it's a bit of a mischaraterization to say there's equivalence between an angular search of content and ctrl+f. For one, with angular only matching content could be shown, and different metadata could be used for searching (search on title,

Re: [pygame] Registration disabled.

2016-04-28 Thread Greg Ewing
Ian Mallett wrote: As has been explained before, the reason is due to a historical deluge of spam. Perhaps some explanation of the reason could be included in the message? As it is, this looks like a bug, so you can't blame people for reporting it as such, or for getting a bit frustrated when

Re: [pygame] Faster blitting

2016-03-14 Thread Greg Ewing
Ian Mallett wrote: ​I think the point is that in the case where you have a lot of small blits, the proportional overhead of the checks is more significant. If you have a lot of small blits, I'd expect the general overhead of Python code overhead to swamp everything else. -- Greg

Re: [pygame] Faster blitting

2016-03-13 Thread Greg Ewing
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

Re: [pygame] pygame Event

2016-03-04 Thread Greg Ewing
Stuart Laatsc wrote: Well I don't really /need/ the __dict__ functionality, but it would be /convenient/ to have /and it is included/ in the official documentation. Are you sure you're not using an older version of pygame? If I remember rightly, Event used not to have '__dict__', only 'dict'.

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

2015-11-10 Thread Greg Ewing
jcup...@gmail.com wrote: Have you looked at cffi? It's a modern replacement for ctypes which automates a lot of this stuff. Other possible approaches: * Write a C wrapper around the C++ API and call that using ctypes. * Use Cython to wrap the C++ API. -- Greg

Re: [pygame] display.set_mode opens oversized window.

2015-08-03 Thread Greg Ewing
mspaintmaes...@gmail.com wrote: I'm not an expert, but I think the idea is that you're not supposed to worry about having to scale your game up for people with super high resolution displays, which is why it does this. i.e. picking something that looks comfortable on your display will look

Re: [SPAM: 8.411] [pygame] GUI for pygame : ThorPy

2015-06-24 Thread Greg Ewing
Yann Thorimbert wrote: As many people did, I have been looking for a GUI for pygame. Naturally, I have found this page : http://www.pygame.org/tags/gui. Did you look at Albow? It doesn't seem to be listed on that page: http://www.cosc.canterbury.ac.nz/greg.ewing/python/Albow/ -- Greg

Re: [pygame] Noob question: playing sounds

2015-06-03 Thread Greg Ewing
Philip Le Riche wrote: Well, this is strange. In /usr/lib/python2.7/dist-packages/pygame/examples there is sound.py. This must have worked for someone once, It still works for me, using pygame 1.9.2 with Python 2.7 on MacOSX 10.6. -- Greg

Re: [pygame] Re: SDL for Pygame Mac 64 - Almost there... Please help!

2015-04-08 Thread Greg Ewing
On 04/08/2015 05:53 PM, JeffreyDanowitz wrote: However, in my PATH I have /usr/local/lib and both libpng.dylib and libjpeg.dylib are there. In that case I would expect things to be able to find it without any help. I'm out of ideas at the moment, sorry, other than my earlier suggestion to try

Re: [SPAM: 10.000] [pygame] Re: SDL for Pygame Mac 64 - Almost there... Please help!

2015-04-07 Thread Greg Ewing
JeffreyDanowitz wrote: When I remove the stuff from Homebrew I get: Using Darwin configuration... sh: sdl-config: command not found sh: sdl-config: command not found sh: sdl-config: command not found WARNING: sdl-config failed! /usr/local/bin/smpeg-config: line 45:

Re: [pygame] SDL for Pygame Mac 64 - Almost there... Please help!

2015-04-06 Thread Greg Ewing
JeffreyDanowitz wrote: When I look at config.py and config_darwin.py and setup and setup.py, there are references to includes and stuff from where the SDL was installed by brew. However, there are references to the Framework in /Library/Framework. Can you show us the output you got from

Re: [pygame] Re: SDL for Pygame Mac 64 - Almost there... Please help!

2015-04-06 Thread Greg Ewing
JeffreyDanowitz wrote: IMAGE : found Framework SDL_image found PNG : found JPEG: found It seems to be finding both the framework and non-framework versions of the SDL libraries. Maybe that's confusing it? You could try removing the non-framework SDL libraries and see if that helps.

Re: [pygame] Feature discussion, proposals

2015-03-18 Thread Greg Ewing
Mikhail V wrote: 1. It turns out that 32 bit surfaces is an overkill in most cases. Good that there is 8 bit mode. What evidence do you have of that? Have you done any benchmarking? - how does the indexed image is generally rendered? Is it like: it sends index array to video card and the

Re: [pygame] pyg_mixer.music.load doesn't take non ascii chars

2015-02-14 Thread Greg Ewing
Bo Jangeborg wrote: According to the documentation one should be able to pass an object as a parameter but I am not sure if I am doing it the right way. I think it means a file object, not the file contents: file_path = 07-Boabdil, Bulerías.ogg fi = open(file_path, 'rb')

Re: [pygame] pyg_mixer.music.load doesn't take non ascii chars

2015-02-13 Thread Greg Ewing
Bo Jangeborg wrote: file_path = 07-Boabdil, Bulerías.ogg fi = open(file_path, 'rb').read() pygame.mixer.music.load(fi) But that gets me the Error: File path 'OggS' contains null characters music.load() expects to be passed the name of a file, not the contents of the file. Just do this:

Re: [pygame] Pygame blitting 8-bit surfaces doesn't ignore palettes?

2014-12-02 Thread Greg Ewing
Brian Madden wrote: I'm seeing that that when blitting, Pygame will use the source surface's palette to get the 24-bit entry for each pixel, then look for that 24-bit value in the destination surface's palette, and then write the 8-bit integer value from the destination surface's palette as

Re: [pygame] immutable vectors in math package

2014-10-30 Thread Greg Ewing
Lorenz Quack wrote: I guess, using PyQt4 lately I followed their convention. Also using methods makes it more explicit that the values are read-only. I think that in a pure Python library it's more important to follow Python conventions than those of some other language or library. If PyQT has

Re: [pygame] immutable vectors in math package

2014-10-29 Thread Greg Ewing
Lorenz Quack wrote: * you cannot access the components x/y/z directly... use ... new accessor methods x()/y()/z() Is this change really necessary? It will be a big backward step for code readability. There shouldn't be any reason you can't provide read-only access using attribute notation.

Re: [pygame] OpenGL stretch of a pygame.Surface

2014-08-04 Thread Greg Ewing
Berlioz Silver wrote: You want pixels2d, which gives you a variable which _references_ the data. Yes, sorry, I got it the wrong way round. You need to start with a normal surface that you can blit into, and then use pixels2d to create a numpy view of it that you can pass directly to OpenGL.

Re: [pygame] OpenGL stretch of a pygame.Surface

2014-07-29 Thread Greg Ewing
sylvain.boussekey wrote: I managed to do it in opengl but perfs are poor. A few things to consider: textureData = pygame.image.tostring(textureSurface, RGBA, 1) * You're creating an extra copy of the texture data here. To avoid that, you could use surfarray to create a surface backed

Re: [pygame] OpenGL stretch of a pygame.Surface

2014-07-29 Thread Greg Ewing
Jeffrey Kleykamp wrote: On my not so fast computer, I acheive 400FPS, which is useless but a good indicator to know how many sprites I can draw simultaneously. Are you clearing and redrawing the whole screen each frame, or just drawing the areas where sprites have moved? If the

Re: [pygame] Re: Pygame not handling keyboard tracking correctly

2014-06-23 Thread Greg Ewing
diliup gabadamudalige wrote: for event in pygame.event.get([KEYDOWN, KEYUP, MOUSEMOTION, MOUSEBUTTONUP]): so far works well. I also noted a slight increase in speed. Is that my imagination or could specifying the events looked at speed up the process? It's almost certainly your imagination.

Re: [pygame] Re: Pygame not handling keyboard tracking correctly

2014-06-23 Thread Greg Ewing
diliup gabadamudalige wrote: Can someone please explain why if event.type is KEYUP: is bad and if event.type == KEYUP: is correct? The 'is' operator tests whether two expressions refer to the *same* object. It's possible for two different int objects to have the same value, in which case

Re: [pygame] Re: Pygame not handling keyboard tracking correctly

2014-06-23 Thread Greg Ewing
is correct. You should just be doing if x: ... There might be some very rare cases where comparing something directly with True or False is justified, but then whether to use 'is' or '==' will depend on why you are doing it. -- Greg On Mon, Jun 23, 2014 at 11:34 AM, Greg Ewing

Re: [pygame] Re: Pygame not handling keyboard tracking correctly

2014-06-22 Thread Greg Ewing
Sam Bull wrote: I don't know if SDL/Pygame is supposed to guarantee these events or not, it could also be possible that it's just overflowing the keyboard buffer or something. Also keep in mind that computer keyboards often don't handle multiple keys being pressed at once very well,

Re: [pygame] Re: Pygame not handling keyboard tracking correctly

2014-06-22 Thread Greg Ewing
Jeffrey Kleykamp wrote: Although it looks like the KEYUP events don't have a unicode That is very true, which means this won't work at all: if event.type is KEYUP: x = event.unicode Also, it's a bad idea to use 'is' to compare ints. It may appear to work in this case, but it's

Re: [pygame] preview of new pygame website... HiFi part

2014-04-07 Thread Greg Ewing
Al Sweigart wrote: Oh, also, we should keep the Pygame logo. It's familiar branding, and it doesn't look bad at all. I second that. The old site design has an air of playfulness about it that the new one currently lacks. It looks bland and doesn't convey that pygame is about having *fun*. --

Re: [SPAM: 8.000] [pygame] Pygame 2.0 software blits

2014-03-04 Thread Greg Ewing
Lenard Lindstrom wrote: If the bytecode is exposed at the Python end then any expression can be encoded, a different one for each channel if desired. Conceivably, a Python expression, or function, could be compiled into a blit operation. That would be even more awesome! -- Greg

Re: [SPAM: 8.000] [pygame] Pygame 2.0 software blits

2014-03-03 Thread Greg Ewing
Lenard Lindstrom wrote: A Pygame level production blitter would extend the simple bytecode language to support basic arithmetic operations, different integer sizes, as well as higher level operations such as pixel encoding/decoding and alpha blitting. It would replace code in alphablit.c,

Re: [pygame] Quick OS survey - 2013

2013-12-06 Thread Greg Ewing
Jason Marshall wrote: pygamers, which computer operating system(s) have you used this year? 70% MacOSX 10.6, for fun 25% Windows (various flavours), not for fun 5% Fedora Linux, for moderately cool stuff -- Greg

Re: [pygame] Pygame look and feel

2013-10-05 Thread Greg Ewing
I don't think I like the stripes. They make it look to me like the whole thing is flying through the air in an awkward manner. If that's not what you're trying to convey, maybe a solid shadow would be better. -- Greg

Re: [pygame] Pygame container for rectangles

2013-09-04 Thread Greg Ewing
Paul Vincent Craven wrote: If you are not using sprites, you can just iterate through a list If you are using sprites, you can create an update() method Or you can directly move them in a loop Another approach is not to move the rectangles at all, but leave them relative to some origin and

[pygame] ANN: Albow 2.2.0

2013-04-21 Thread Greg Ewing
ALBOW - A Little Bit of Widgetry for PyGame Version 2.2 is now available. http://www.cosc.canterbury.ac.nz/greg.ewing/python/Albow/ Highlights of this version: * Multichoice control * Powerful new facilities for hot-linking controls to application data There are also many other

Re: [pygame] Professional games made with Pygame?

2013-02-18 Thread Greg Ewing
Lin Parkh wrote: Hi everyone, I'm compiling a list of professional-quality games made using Pygame. The Witch's Yarn -- Greg

Re: [pygame] Alternate to graphics modules

2013-02-07 Thread Greg Ewing
Ian Mallett wrote: At some level, you need to interface with the graphics drivers. Since Python is an abstraction layer over C, this means either writing in C (not Python), or using a package that does that for you. Not necessarily -- you can use ctypes to wrap a C library. -- Greg

Re: [pygame] [Pygame] Smooth Animation

2012-11-22 Thread Greg Ewing
yannisv wrote: Yes, I am. The problem is when I set the FPS to ~12, and use clock.tick(FPS) inside the loop, that movement looks terrible (as expected). When I set the FPS to 30 or 60, the movement does look better, but the frames change extremely fast. If you want smooth animation, you will

Re: [pygame] Importing Graphics

2012-10-06 Thread Greg Ewing
Ian Mallett wrote: On Sat, Oct 6, 2012 at 4:13 AM, shane shanevansh...@yahoo.com mailto:shanevansh...@yahoo.com wrote: can graphics from shareware etc be imported Do you mean like pygame.image.load(...)? To be a bit more explicit, if you can get hold of the graphics in any of the

Re: [pygame] Python comparing float

2012-08-22 Thread Greg Ewing
Ricardo Franco wrote: That's why when you are comparing floating point numbers, you always have to check if they are within some small error value from each other. How large that value is depends on your particular use case. It's even better if you can avoid comparing floats for

Re: [SPAM: 4.500] Re: [pygame] Easy networking module - feedback needed

2012-07-03 Thread Greg Ewing
Ryan Hope wrote: Can someone explain to me why integrating network packets with pygame events is a good idea? It was my understanding that the pygame event buffer can only hold a limited number of events before events get lost. If this turns out to be a problem, it could be addressed by

Re: [SPAM: 3.000] Re: [pygame] Monospaced fonts are meant to be mono-spaced, right?

2012-06-04 Thread Greg Ewing
Weeble wrote: To get the very best positioning of a text cursor, I think you want to calculate the width of the string on its left, then *subtract* the overhang of the character immediately to the left, if any. For the *very* best results with italic fonts, you really need a slanted cursor.

Re: [pygame] GUI toolkit for Python for Android

2012-05-30 Thread Greg Ewing
Brian Bull wrote: I need to add some GUI elements and I'm not aware of any resources that make it easy for me to do this in pgs4a. I don't want to write my own dialogs, choosers, HTML renderers or scrolling boxes from scratch if I can possibly avoid it. You could try Albow:

Re: [pygame] Issue with pygame.mask

2012-05-14 Thread Greg Ewing
Peter Finlayson wrote: I expected the default threshold (0,0,0) of this function to have it match only that the exact color specified (ie within 0 values of the color). However, it seems that it instead matches NO pixels. The third comment about that function here seems to explain what's

Re: [pygame] Monospaced fonts are meant to be mono-spaced, right?

2012-05-14 Thread Greg Ewing
Nicholas Seward wrote: The letters may be different lengths. However, the letters should be spaced equally. For example,i will be shorter than w but hit and hot should be the same length. No, that's not the way it should work. I just tried an experiment: f = Font(VeraMono.ttf, 12)

Re: [pygame] Extending OpenGL support in Pygame

2012-04-05 Thread Greg Ewing
Sam Bull wrote: If this is something of interest to other people, I'm wondering whether there might be some interest in integrating this code into Pygame (sometime after GSoC). I'm interested! This sounds like it could be very useful. If done properly, it would make it very easy to use

Re: [pygame] Making Games with Python Pygame free book

2012-03-20 Thread Greg Ewing
Lee Buckingham wrote: I think the iphone 5 can see in ultraviolet. There's some indication that humans might be able to as well if our lenses didn't filter it out. I saw a story a while ago about someone who had the lens and cornea of one eye replaced by a prosthesis. He claimed to be able to

Re: [pygame] Making Games with Python Pygame free book

2012-03-19 Thread Greg Ewing
Christopher Night wrote: The idea is that if we could independently stimulate each of the three colors receptors (cones) in our eyes, then we could reproduce any visual sensation and thereby any color. The problem is ... there's no such thing as a wavelength of light that stimulates the

Re: [pygame] Making Games with Python Pygame free book

2012-03-19 Thread Greg Ewing
Miriam English wrote: The red, blue, yellow that people have been using for centuries are now often called magenta, cyan, yellow. But many people still call them red, blue, yellow. They aren't wrong to do so, but it can make color stuff confusing. Massively confusing, I would say. The

Re: [pygame] Declaring variables in function as if at code's line-level

2012-03-14 Thread Greg Ewing
Brian Brown wrote: Anyways, I think I should just continue being a solo programmer. lol I'm too wild when it comes to programming that I think I need my own space. Writing well-organised code is not just about communicating with other programmers. It also helps *you* to understand the code

Re: [pygame] Surface.blit() BLEND_ADD vs. BLEND_RGBA_ADD

2011-12-23 Thread Greg Ewing
Florian Berger wrote: Would it be better to have a BLEND_ADD_PREMULT blit mode instead, i.e. put the premultiplication in the blitting code? Not sure that would be the best name for it, since it could be taken as meaning that the image you give it is already premultiplied. Also, it would

Re: [pygame] Help with pygame

2011-12-14 Thread Greg Ewing
Zack Baker wrote: With fink I'm on OSX, and I find it's generally less hassle in the long run to compile everything from source myself rather than rely on things like fink and macports, so I don't have much experience with them. But you could look into whether there is a fink version of

Re: [pygame] Help with pygame

2011-12-14 Thread Greg Ewing
On 15/12/11 10:51, Zack Baker wrote: Ok, I have deleted everything pygame I could find an now I'm going to reinstall it. Along with python 3.2 because I guess now they are compatible on OSX which would be great. Btw in case it doesn't could you point me too a link that shows how to compile

Re: [pygame] Help with pygame

2011-12-14 Thread Greg Ewing
Zack Baker wrote: Traceback (most recent call last): File green-car-test.py, line 10, in module car=pygame.image.load('green-car.png') pygame.error: File is not a Windows BMP file It looks to me as though your PyGame installation doesn't have support for PNG files. It seems to fall back

Re: [pygame] man oh man Java is painful

2011-11-05 Thread Greg Ewing
Russell Jones wrote: Well, there is jython http://www.jython.org/. It's a version of Python that runs under the JVM with, roughly, Python 2.5 syntax. Unfortunately it appears that Android uses a different Java VM bytecode from everyone else, and Jython would have to be reworked to generate

Re: [pygame] man oh man Java is painful

2011-11-05 Thread Greg Ewing
Mac Ryan wrote: Absolutely not sure it fits the bill... but have you had a look at go? http://golang.org/ I looked at it. My first impression was this is ugly. I'm pretty sure it's not the language I was talking about. -- Greg

Re: [pygame] man oh man Java is painful

2011-11-02 Thread Greg Ewing
On 03/11/11 03:45, Sean Wolfe wrote: I'm getting into the wonderful world of Android which means Java. Dear lord I remember now why I hate this language. I love the pythonic philosophy that there should be an obvious way to get things done. There's at least one project afoot to enable pygame

Re: [pygame] man oh man Java is painful

2011-11-02 Thread Greg Ewing
On 03/11/11 04:28, Sean Wolfe wrote: I have been thinking that since I want to eventually port my game to iphone, I'll have to learn obj-c, so why not java first... how hard can it be? haha. Can't see how that would help -- ObjC is nothing at all like Java. Learning Smalltalk would actually be

Re: [pygame] man oh man Java is painful

2011-11-02 Thread Greg Ewing
On 03/11/11 04:31, Ian Mallett wrote: C++ is a pain to learn, but it's definitely worth it. In my opinion it's the best compiled language. I'm afraid I can't share your opinion of C++. I liked it myself at first, but after 10 years or so of experience I came to the conclusion that it goes to

Re: [pygame] Fast method for pixellated animation

2011-10-25 Thread Greg Ewing
Ian Mallett wrote: Not sampling in a scaling operation doesn't make sense. You need at least one sample to get a reconstruction. Yes, it's a slightly odd way of phrasing it. I take it to mean that only one source pixel is sampled for each destination pixel, rather than interpolating between

Re: [pygame] Fast method for pixellated animation

2011-10-24 Thread Greg Ewing
John Jameson wrote: Hi, I would like an efficient way to generate an animated grey-scale pixellated image... Another way might be to just generate the image as a 100X100 image but magnified and thus automatically obtaining the same result. Is this possible? You could try using

  1   2   3   4   5   >