Re: [pygame] Newbie performance question

2018-07-17 Thread Christopher Night
It runs fine for me. What sort of framerate are you getting (self.clock.get_fps())? If it really is significantly less than 60, my only suggestion would be to try running it in windowed mode instead of fullscreen and see if that makes any difference. On Tue, Jul 17, 2018 at 2:53 PM Andreas Zielke

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

2018-06-09 Thread Christopher Night
Python > under Linux that would do it reliably? I suppose I could slave two > instances of mplayer, but I'd of course prefer to not be forking out > processes. > > If anyone's curious about the files I'm trying to load, I posted some test > files here: > &g

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

2018-06-07 Thread Christopher Night
I recommend saving the sound as a raw buffer. First in a separate script: sound = pygame.mixer.Sound("music1.wav") open("music1.buf", "wb").write(sound.get_raw()) Then in your game: sound = pygame.mixer.Sound(buffer=open("music1.buf", "rb").read()) I found about 4x speedup of reading a large fil

Re: [pygame] pygame awesome libraries?

2018-04-10 Thread Christopher Night
For what it's worth, I did finally get around to removing the numpy dependency from ptext after your feedback. As far as I know, the current version doesn't require numpy, but let me know if you find that's not the case. (Of course, if you prefer your version, that's perfectly fine too.) On Tue, A

Re: [pygame] Color shift when blitting

2017-11-05 Thread Christopher Night
In the past I've found this to be an issue with PNGs on Mac. The PNG specification apparently allows for color correction on image load, based on your display settings, which means it's going to be very inconsistent between platforms (although it should look more consistent to the eye). If you requ

Re: [pygame] New pygame.org website

2016-12-16 Thread Christopher Night
Sign me up to help, please. I would like to humbly vote against using github or anything similar to submit games. I think there should be a dead-simple web interface. Yes making a pull request is easy for you and me, and yes I think that all game developers need to learn github sooner or later, b

Re: [pygame] blit-add to white bug?

2015-08-05 Thread Christopher Night
Pretty sure that's the expected/desired behavior. When you do this, for each pixel, any of the rgb channels that's 0 will remain at 0, and any that's nonzero will get maxed out to 255. The orange starts at r,g,b = 255,102,0. When you blit it over itself 255 times, the green channel gets maxed out t

[pygame] Module I made for drawing text with pygame

2015-03-16 Thread Christopher Night
Please let me know if you have any feedback or criticism on the module I have written here: https://github.com/cosmologicon/pygame-text This module provides what is, for me, a more convenient interface to drawing text with pygame.font. It also provides a few effects, such as outlines and drop shad

Re: [pygame] immutable vectors in math package

2014-10-29 Thread Christopher Night
I have not used either the original API nor yours, so this suggestion may be off base, but if they're going to be immutable, why not subclass collections.namedtuple("Vector2", "x y"), and get a few handy methods defined for free? -Christopher On Wed Oct 29 2014 at 7:41:54 PM Greg Ewing wrote: >

Re: [pygame] Pygame surface

2014-09-10 Thread Christopher Night
Hence the question. > So looks like my best option is the save to disk and load which is also > the fastest. > > Thanks to everyone all for the support which is invaluable. > > > > -- > > > On Wed, Sep 10, 2014 at 9:11 PM, Christopher Night > wrote: > >> F

Re: [pygame] Pygame surface

2014-09-10 Thread Christopher Night
For reference, here's the discussion from the last time Diliup asked this same question, a month ago: https://groups.google.com/forum/#!topic/pygame-mirror-on-google-groups/WIuIlmXvqow On Tue, Sep 9, 2014 at 7:57 AM, diliup gabadamudalige wrote: > How can a Pygame surface be converted to an ima

Re: [pygame] image conversion in memory

2014-08-08 Thread Christopher Night
It depends on what precisely you mean when you say that a python variable is a jpeg image. Do you mean that it's a string containing the contents of a jpeg image file? So if you wrote it to disk you'd get a jpeg image file? If that's what you mean, you can do it with PIL and StringIO. (There might

Re: [pygame] Circle cut off at 60+fps, fixed by display.flip

2014-06-12 Thread Christopher Night
I get that you want to understand what's going on, but beyond that, is there some problem with just using display.flip? On Thu, Jun 12, 2014 at 3:31 AM, Abhas Bhattacharya < abhasbhattachar...@gmail.com> wrote: > The following code draws a circle and moves it by 4px to left every step. > > Probl

Re: [pygame] Scaling the hitbox/rect of a sprite

2014-05-22 Thread Christopher Night
You don't need to do that. rect.inflate already preserves the center. The question is more about how to use a separate rect for hitbox than you do for blitting. On Thu, May 22, 2014 at 12:30 PM, Jake b wrote: > To preserve the center: > > > pos = self.rect.center > self.rect = self.rect

[pygame] help subscribing to pygame-users

2014-01-27 Thread Christopher Night
Hi, I'm talking with someone on the /r/pygame subreddit who's having trouble signing up for this mailing list (link). They say they followed the subscribe process but their emails are still not showing up on

Re: [pygame] Python3 version packaged?

2013-12-31 Thread Christopher Night
That's all well and good for development, but if I want to distribute my game to other Ubuntu users I'm not going to tell players they have to comment out part of the setup file for one of my dependencies and install it from source. I'm not complaining or anything. Set whatever priorities you thin

Re: [pygame] Using pygame.transform.rotozoom()

2013-06-14 Thread Christopher Night
I don't know how to fix your problem, but it seems to me that using an alpha channel instead of a colorkey would be one solution. It might be easier than blitting the surface twice, anyway. On Fri, Jun 14, 2013 at 6:09 AM, Aikiman wrote: > Well Im close but still no cigar on this issue and its

Re: [pygame] Fonts

2013-02-24 Thread Christopher Night
Do os.path.exists(filename) to make sure the file exists. It could be your working directory is wrong, or the capitalization doesn't match. -Christopher On Sun, Feb 24, 2013 at 2:45 PM, myles broomes wrote: > Hi, > I loaded a .ttf file into the pygame folder but I can't use it in pygame. > The

Re: [pygame] Professional games made with Pygame?

2013-02-16 Thread Christopher Night
There are a number of PyWeek games made with pygame that I would consider at least as polished as Nelly's Rooftop Garden. Looking down the list of highest-rated games , I notice that Which Way is Up, Sudo Science, Walkway, Trip on the Funny Boat, 20,000 Light Years

Re: [pygame] Merge: rect optimisation

2012-10-17 Thread Christopher Night
Yeah your new test is correct. I'm surprised it wasn't done that way to begin with, actually. The inequality comparisons you have are correct for pygame's definition of a rectangle. FWIW, I would swap the ordering of the 2nd and 3rd test as you have them. >From a probabilistic argument, this will

Re: [pygame] rotate around point

2012-08-20 Thread Christopher Night
Right, but note that performing step 2 with pygame.transform.rotate is not trivial, since it doesn't rotate about the origin, or any particular point for that matter: the fixed point of rotation depends on the surface dimensions and the rotation angle. So your step 2 is itself 3 steps. For this re

Re: [pygame] Red-to-violet color palette

2012-07-13 Thread Christopher Night
rst values) are red or orange and the values > far (the last values) will be green, blue or violet. > By near and far, I mean the iterations of i (0 to 255) > > 2012/7/13 Christopher Night > >> According to Wikipedia, violet is (127, 0, 255), so this should work: >> &g

Re: [pygame] Red-to-violet color palette

2012-07-13 Thread Christopher Night
According to Wikipedia, violet is (127, 0, 255), so this should work: tuple((255-(i+1)//2, 0, i) for i in range(256)) -Christopher On Fri, Jul 13, 2012 at 12:20 PM, Ricardo Franco wrote: > I would like to know how to build a specifc color palette, its the > red-to-violet color palette. > To bui

Re: [pygame] Improved Sprites System - Call for Suggestions

2012-06-02 Thread Christopher Night
On Sat, Jun 2, 2012 at 1:50 PM, DR0ID wrote: > On 02.06.2012 16:46, Christopher Night wrote: > > On Fri, Jun 1, 2012 at 2:29 PM, DR0ID wrote: > >> On 01.06.2012 15:29, Sagie Maoz wrote: >> >>> 2. Setting a sprite's anchor points for handling in movemen

Re: [pygame] Improved Sprites System - Call for Suggestions

2012-06-02 Thread Christopher Night
On Fri, Jun 1, 2012 at 2:29 PM, DR0ID wrote: > On 01.06.2012 15:29, Sagie Maoz wrote: > >> 2. Setting a sprite's anchor points for handling in movement, animation, >> collision etc. >> 5. New visual attributes for sprites: >>- Rotation angle >>- Scale > > 2. the sprites anchor point shoul

Re: [pygame] Best practices for creating multiple resolution 2D pixel-art games?

2012-04-05 Thread Christopher Night
On Thu, Apr 5, 2012 at 5:36 PM, Santiago Romero wrote: > > I just was hoping that everybody would already faced this problem before > me with alternatives different to: > > a.- Render the display with OpenGL. > b.- Force fullscreen fixed resolution. > c.- Force windowed fixed resolution. > d.- S

Re: [pygame] Best practices for creating multiple resolution 2D pixel-art games?

2012-04-05 Thread Christopher Night
On Thu, Apr 5, 2012 at 12:24 PM, Santiago Romero wrote: > > - Game graphics (pixel-art, not vector or 3d graphics): What's the best > way to create the graphics? Do them "high-res", try to ask always for the > highest resolution and downscale if not (losing quality)? Do them "mid-res" > and upscal

Re: [pygame] Anyone want to critique my platform game prototype?

2012-04-01 Thread Christopher Night
On Sun, Apr 1, 2012 at 7:47 PM, Ian Mallett wrote: > On Sun, Apr 1, 2012 at 10:46 AM, Christopher Night > wrote: > >> Thanks very much for trying it! If you get a chance, I'd be very >> interested in how it feels to you after tweaking the keypress time >> interva

Re: [pygame] Anyone want to critique my platform game prototype?

2012-04-01 Thread Christopher Night
On Sun, Apr 1, 2012 at 12:32 PM, Ian Mallett wrote: > On Sun, Apr 1, 2012 at 1:48 AM, Christopher Night > wrote: > >> I made a pygame prototype for a platforming game I'm planning. As we all >> know, platform games require meticulously tuned mechanics. I finally go

[pygame] Anyone want to critique my platform game prototype?

2012-04-01 Thread Christopher Night
I made a pygame prototype for a platforming game I'm planning. As we all know, platform games require meticulously tuned mechanics. I finally got it to where I like it, but that probably means it's still pretty terrible. If anyone wants to try it out and offer suggestions, I'd be very interested.

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

2012-03-20 Thread Christopher Night
On Tue, Mar 20, 2012 at 12:57 AM, Greg Ewing wrote: > 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 p

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

2012-03-19 Thread Christopher Night
On Mon, Mar 19, 2012 at 5:05 PM, Miriam English wrote: > Because we only have 3 color detector cells in our eyes we can imitate any > color with various combinations of red, green, and blue lights mixed > together in varying amounts. Unfortunately it's not that simple. The idea is that if we cou

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

2012-03-19 Thread Christopher Night
It's complicated, but red, yellow, and blue are a "good enough" set of primary colors that they were used for a long time. CMYK is superior, but neither of them can reproduce every color that the human eye can see. Neither can RGB light, for that matter. http://en.wikipedia.org/wiki/RYB_color_mode

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

2012-03-12 Thread Christopher Night
On Mon, Mar 12, 2012 at 3:27 PM, Brian Brown wrote: > Thanks for the replies everyone. > I guess Python just doesn't have a > "declare-variable-as-global-for-whole-module" feature. > > (I don't generally have problems with variable overlap because I'm very > careful with naming my global variable

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

2012-03-10 Thread Christopher Night
On Sat, Mar 10, 2012 at 6:30 PM, Brian Brown wrote: > Hi pygame users, just a simple question-- How can one cause variables > at "function-level" to behave like variables at "line-level"? (With > basic python code) I just want to avoid using "global" over and over > again (in many different funct

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

2012-03-10 Thread Christopher Night
ecessarily. > Chart out the functions. Don't put any functions inside of others > unnecessarily. > Simplify everything. Don't give unnecessary fancy names to anything > that shouldn't even be there in the first place. > Give everything sensible and technically accurate

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

2012-03-10 Thread Christopher Night
It's not clear at all what you mean by "line-level". It sounds like you mean variables that are at the global scope, ie, you want to declare global variables. The answer is you use the "global" keyword within the function. Sorry if this seems like a lot of extra work, but I doubt you'll find much s

Re: [pygame] Re: Pygame, pyglet, 2d, 3d, and performance (reflexions/discussion)

2012-02-13 Thread Christopher Night
On Mon, Feb 13, 2012 at 6:04 AM, Santiago Romero wrote: > > > Some do have used OpenGL with Pygame for ever, with PyOpenGL etc. I > think .. > > Can pygame (event system, "game loop", etc) can be used among with > PyOpenGl, using the last one just for "the blitting"? > > I mean: can an already wor

Re: [pygame] Substantial Lag

2012-02-12 Thread Christopher Night
You're only updating 5 frames a second, so yu should expect delays of up to 0.2s, and if you tap the key fast enough it won't register. Why not change the 5 to 50 or something? -Christopher On Feb 12, 2012 8:02 PM, "Ryan Strunk" wrote: > Hi everyone, > I apologize in advance for posting 43 lines

Re: [pygame] Antialiased circle

2012-01-18 Thread Christopher Night
On Wed, Jan 18, 2012 at 4:49 AM, Florian Krause wrote: > Maybe someone could translate from Java? > http://www.databasesandlife.com/anti-aliased-polygon-filling-algorithm/ If that person's solution is acceptable for us, I don't think any translation is needed. It's pretty straightforward: *Wha

Re: [pygame] Antialiased circle

2012-01-17 Thread Christopher Night
On Tue, Jan 17, 2012 at 8:42 PM, Lenard Lindstrom wrote: > If someone can provide an algorithm that everyone is happy with then I > will look at adding > filled anti-aliased circles to Pygame. Personally, I am tired of searching > the web for such > an algorithm myself. I haven't really thought

Re: [pygame] Capabilities of Pygame

2012-01-13 Thread Christopher Night
On Fri, Jan 13, 2012 at 9:15 PM, Lenard Lindstrom wrote: > On 13/01/12 01:43 PM, Julian Marchant wrote: > >> --- On Fri, 1/13/12, Lenard Lindstrom wrote: >> >> Also, >>> though SDL does support streaming, Pygame does not. >>> Everything must be loaded before played. >>> >> Um... that's not true

Re: [pygame] Capabilities of Pygame

2012-01-13 Thread Christopher Night
On Thu, Jan 12, 2012 at 9:04 PM, Ryan Strunk wrote: > > If you're working on a game that you could conceivably write by > yourself or with a small team, python will probably be up for the job. > > That’s good to know. With as much as critics of Python harp on the speed, > I was worried that resul

Re: [pygame] Capabilities of Pygame

2012-01-12 Thread Christopher Night
If you set out to remake World of Warcraft in python, then by the time you finish in 200 years, computers will be more than fast enough that your program will run just fine. Seriously, what kind of game do you want to make? If you want to work on an MMORPG, you'll have to be working for a company,

Re: [pygame] pyWeek? (Bit OT)

2012-01-11 Thread Christopher Night
On Fri, Jan 6, 2012 at 2:26 PM, Davy Mitchell wrote: > Apologies if this is a bit off topic... > > I was was wondering if the date for the next PyWeek has been announced? > No it hasn't. The latest announced competition is generally found on the front page of pyweek.org. The previous even-numbe

Re: [pygame] New way for drawing an arc

2012-01-05 Thread Christopher Night
Cool! When I needed to draw an arc more than a couple of pixels wide, I approximated it with a polygon. I think it gave pretty good results. I'm not sure how it would compare performance-wise, but it should involve a lot fewer trig function calls. Have you tried this method? -Christopher On Thu,

Re: [pygame] squeezing a little fun out of java ... meh

2012-01-03 Thread Christopher Night
On Tue, Jan 3, 2012 at 12:52 PM, Ian Mallett wrote: > I suppose you could do things like: > def my_func(in): > if type(in) != type(""): raise ValueError() > . . . which emulate static types, but is still not a compile-time error. > In my early Python libraries, I found I was doing something

Re: [pygame] setting + modifying a variable for use across the entire application

2011-12-17 Thread Christopher Night
On Sat, Dec 17, 2011 at 10:15 AM, Sean Wolfe wrote: > I'll have to dig in more to see the differences between our code. > here's what was happening though in general -- the problem > > 1. main module imports settings as blank > 2. main module imports child modules > 3. when imported, child modul

Re: [pygame] setting + modifying a variable for use across the entire application

2011-12-16 Thread Christopher Night
Huh, that's really weird. I use this technique all the time, and I never worry about import order or having app-level values pre-set, and it always works perfectly as expected for me. $ cat settings.py sound_volume = 1000 $ cat module.py import settings def printvolume(): print settings.sound

Re: [pygame] Help with pygame

2011-12-14 Thread Christopher Night
On Mon, Dec 12, 2011 at 6:06 PM, Christopher Night wrote: > Try putting this in the python interpreter and tell us what you get. (Copy > and paste the output exactly as you get it. Don't try to summarize): > > open("images.BMP") ; import pygame ; pygame.image.get_exten

Re: [pygame] Help with pygame

2011-12-12 Thread Christopher Night
011 at 5:45 PM, Zack Baker wrote: > Just because I keep switching it around and trying different images with > different extensions. I get the same error with all though > > -Zack > > > On Dec 12, 2011, at 4:40 PM, Christopher Night > wrote: > > Okay obvious

Re: [pygame] [Pygame] Joystick Inputs

2011-12-07 Thread Christopher Night
On Thu, Dec 8, 2011 at 12:36 AM, Ian Mallett wrote: > Except in the trivial case, the rotated image will still be a different > size, of course. Remember to offset the image correctly (I recommend > calling .get_width() and .get_height()) and then subtracting half that from > your player's posit

Re: [pygame] pygame performance limits

2011-11-23 Thread Christopher Night
ound that Python (and Ruby) are too slow for making games. > > yours truly > armornick > > > 2011/11/23 Christopher Night > >> I don't know why you would be concerned about performance in a visual >> novel game. Aren't they pretty undemanding? I haven'

Re: [pygame] pygame performance limits

2011-11-23 Thread Christopher Night
I don't know why you would be concerned about performance in a visual novel game. Aren't they pretty undemanding? I haven't played these games very much, but isn't it just a series of still images (no animations) and a simple GUI? You might want to look at a pyweek entry called Gregor Samsa. I kno

Re: [pygame] Re: more basic python lists question

2011-11-17 Thread Christopher Night
On Thu, Nov 17, 2011 at 1:32 PM, Sean Wolfe wrote: > if not f.endswith('.png') > for f in filenames: > filenames.remove(f) > > Along with lots of warnings to copy from one list to another rather > than delete on an iterating list. But really how much harm could it > do? lol... I think

Re: [pygame] more basic python lists question

2011-11-17 Thread Christopher Night
This is more pythonic (also more efficient): filenames = [f for f in filenames if f.endswith(".png")] Your method with the loop won't work in general. Do it like this. -Christopher On Thu, Nov 17, 2011 at 1:24 PM, Sean Wolfe wrote: > I find myself often iterating a list looking to remove the

Re: [pygame] Save files

2011-11-14 Thread Christopher Night
Some of the responses so far are making things harder than they need to be. You don't need to use encryption. Just add a secure checksum. Something like this: import hashlib salt = "salt used by the whole game" playersalt = "salt specific to this player (optional)" def checksum(obj): return ha

Re: [pygame] Fast method for pixellated animation

2011-10-24 Thread Christopher Night
The obvious solution is pygame.transform.scale. Whether this is the most efficient method or not depends on how you're generating the image in the first place. But if you've already got a 100x100 image as a pygame.Surface object, and you want to create a 400x400 image out of it, it's clearly the wa

Re: [pygame] Surprising result of applying pygame.sndarray.make_sound() to output of numpy.fft.rfft()

2011-10-08 Thread Christopher Night
On Sat, Oct 8, 2011 at 5:04 PM, Russell Jones wrote: > Hello all, > > I had a look in the mailing list archives for FFT and Fourier, and couldn't > find anything that looked relevant. > > The following code has a surprising result: it outputs sound.wav twice. I'd > expect some random sounding nois

Re: [pygame] Native PyGame method for automatically scaling inputs to a surface resolution?

2011-09-30 Thread Christopher Night
On Fri, Sep 30, 2011 at 10:38 AM, Mac Ryan wrote: > If you are going to use scaled surface you *must* specify the dimension > of what you are drawing. There are plenty of good reasons you might need a line that's visible regardless of the dimensions. Here's a screenshot from a game I made wher

Re: [pygame] Native PyGame method for automatically scaling inputs to a surface resolution?

2011-09-30 Thread Christopher Night
On Fri, Sep 30, 2011 at 5:43 AM, Mac Ryan wrote: > On Thu, 29 Sep 2011 18:18:48 -0400 > Christopher Night wrote: > > > If I have a 100x100 pixel window, and I want to put a dot at a > > position (x,x), it seems to me like the dot should appear in the > > window if 0 &

Re: [pygame] Native PyGame method for automatically scaling inputs to a surface resolution?

2011-09-29 Thread Christopher Night
On Thu, Sep 29, 2011 at 5:50 PM, Greg Ewing wrote: > Christopher Night wrote: > > I actually think the correct behavior is to truncate. This makes sense if >> you consider the pixel "at" (0,0) to actually occupy a 1x1 rectangle, >> extending from (0,0) to (1,1).

Re: [pygame] Native PyGame method for automatically scaling inputs to a surface resolution?

2011-09-29 Thread Christopher Night
On Wed, Sep 28, 2011 at 6:26 PM, Greg Ewing wrote: > Lenard Lindstrom wrote: > > Would you be interested in adding a feature request for a float based rect >> class in the issue tracker? >> > > What *would* be useful right now is if the drawing functions would > accept tuples of floats and round

Re: [pygame] Native PyGame method for automatically scaling inputs to a surface resolution?

2011-09-27 Thread Christopher Night
On Tue, Sep 27, 2011 at 3:39 PM, Mac Ryan wrote: > On Tue, 27 Sep 2011 11:28:34 -0400 > Christopher Night wrote: > > > How can I use your system to draw a rectangle of a solid color onto a > > surface? With the regular pygame system, I would use surf.fill and > > pas

Re: [pygame] Native PyGame method for automatically scaling inputs to a surface resolution?

2011-09-27 Thread Christopher Night
On Tue, Sep 27, 2011 at 11:21 AM, Mac Ryan wrote: > One thing that might have further confused the discussion is that > somewhere in an earlier mail I mentioned "rects". But all I meant was > really just the rects returned by this kind of operations. I was not > thinking to a new class of rects w

Re: [pygame] Native PyGame method for automatically scaling inputs to a surface resolution?

2011-09-27 Thread Christopher Night
On Tue, Sep 27, 2011 at 2:13 AM, Mac Ryan wrote: > On Sun, 25 Sep 2011 11:41:19 -0400 > Christopher Night wrote: > > > Suppose the current transformation is (x, y) -> (0.1x, 0.1y). What > > pygame Rect will the following correspond to (after all the > > c

Re: [pygame] Native PyGame method for automatically scaling inputs to a surface resolution?

2011-09-25 Thread Christopher Night
On Sun, Sep 25, 2011 at 7:31 AM, Mac Ryan wrote: > On Sun, 25 Sep 2011 12:36:50 +0200 > René Dudfield wrote: > > > Maybe it would be possible to implement easily in C, without too much > > code, but maybe not. I'm not interested in it myself, since I think > > it's not too hard to layer on top

Re: [pygame] Native PyGame method for automatically scaling inputs to a surface resolution?

2011-09-23 Thread Christopher Night
On Fri, Sep 23, 2011 at 7:04 PM, Greg Ewing wrote: > Christopher Night wrote: > > I use wrappers. Let me point out there's a total of 9 functions in >> pygame.draw. You seem to be going to a lot of effort to avoid writing 9 >> one-line functions. >> > >

Re: [pygame] Native PyGame method for automatically scaling inputs to a surface resolution?

2011-09-23 Thread Christopher Night
Yeah short answer no. However, I think the answers you've gotten from StackOverflow have not been terribly helpful. They seem to suggest "don't do scaling in pygame". This is silly, I do scaling in pygame all the time. There's no reason you'd need to work in screen coordinates. I use wrappers. Let

Re: [pygame] Memory leak in surfarray.pixels3d?

2011-09-20 Thread Christopher Night
Thanks you, Lenard! And thanks for looking into this, everyone! -Christopher On Wed, Sep 21, 2011 at 12:19 AM, Lenard Lindstrom wrote: > Fixed in changeset 7866ddf0ec0d. > > Lenard Lindstrom > > > > On Sep 20, 2011, *Lenard Lindstrom* wrote: > > Hello, > > There is definitely a leak. I know th

[pygame] Memory leak in surfarray.pixels3d?

2011-09-19 Thread Christopher Night
Hi, one of the players of my pyweek game got a memory leak that seems to depend on the pygame version. We've reduced it to this script: import pygame pygame.init() x = pygame.Surface((1000, 1000), pygame.SRCALPHA) while True: a = pygame.surfarray.pixels3d(x) When I run it on Ubuntu with pytho

Re: [pygame] car game mechanics

2011-09-01 Thread Christopher Night
On Tue, Aug 30, 2011 at 10:33 AM, Joe Ranalli wrote: > The article that Nathan linked does provide a method for more complex > treatment of a car. Instead of treating the car as simply rotating about > its center, they're accounting for the fact that a real car steers using its > front wheels wh

Re: [pygame] car game mechanics

2011-08-30 Thread Christopher Night
peedy #rotate the car self.sprite = pygame.transform.rotate(self.original, self.angle * -1) self.rect = self.sprite.get_rect(center = (self.x, self.y)) Sorry for the confusion! -Christopher On Tue, Aug 30, 2011 at 10:22 AM, Christopher Night wrote: &g

Re: [pygame] car game mechanics

2011-08-30 Thread Christopher Night
Three things you can do to make this more realistic. 1. use self.angle as the argument to pygame.transform.rotate instead of a_deg, as Joe suggested. 2. use separate variables to keep the car's position. Don't store it in self.rect.center. This is because rect positions are coerced to ints, so if

Re: [pygame] very slow pygame.init() under Snow Leopard

2011-08-26 Thread Christopher Night
On Fri, Aug 26, 2011 at 2:28 PM, Lenard Lindstrom wrote: > The "pygame.init('display', ...) is redundant. The exclude list would be > useful for omitting an unused, costly, module. But in general I agree that > calling init() only on those modules that are used is good programming > practice. The

Re: [pygame] FULLSCREEN or ~FULLSCREEN?

2011-07-04 Thread Christopher Night
Nope, that has not been my experience at all! I've always found that fullscreen makes a big difference. I just tried one of my old pygame+GL test scripts that was written to test the effect of varying the resolution. Here's what it gave me for fullscreen modes and windowed modes: FULLSCREEN: 1920x

Re: [SPAM: 3.000] [pygame] thinking of changing gfxdraw module...

2011-06-01 Thread Christopher Night
On Wed, Jun 1, 2011 at 2:47 AM, René Dudfield wrote: > On Tue, May 31, 2011 at 10:02 PM, Greg Ewing > wrote: > >> René Dudfield wrote: >> >> I'm thinking of removing the single calls, and only having multiple ones >>> available - to force people into using the more efficient methods. >>> >> >>

Re: [pygame] Resolution for a 2d game

2011-05-16 Thread Christopher Night
On Mon, May 16, 2011 at 3:00 AM, Daniel Pope wrote: > Please don't force a fullscreen resolution. It doesn't restore properly on > dual-head setups. > > This was discussed here: > > http://www.pyweek.org/d/3953/ I asked in that thread but I never heard an answer: is there no way to fix this? It

Re: [pygame] OBJ loader using VBOs

2010-12-04 Thread Christopher Night
On Sat, Dec 4, 2010 at 5:49 PM, Ian Mallett wrote: > Buffer binding is one of the slowest GL calls you can do, short of > transferring huge chunks of data around (glTexImage2D, glReadPixels, etc.). > State changing is one of the worst things you can do for efficiency, > especially on top of a scr

Re: [pygame] OBJ loader using VBOs

2010-12-04 Thread Christopher Night
On Sat, Dec 4, 2010 at 4:05 PM, Ian Mallett wrote: > > On Sat, Dec 4, 2010 at 1:21 PM, Christopher Night > wrote: > >> Hi, I'm working on a standalone OBJ loader based on the well-known one on >> the pygame wiki: >> http://www.pygame.org/wiki/OBJFileLoade

[pygame] OBJ loader using VBOs

2010-12-04 Thread Christopher Night
Hi, I'm working on a standalone OBJ loader based on the well-known one on the pygame wiki: http://www.pygame.org/wiki/OBJFileLoader My goal is to speed up load times by making the model objects picklable, so the OBJ file doesn't have to be read every time you start up. Here's my current version: h

Re: [pygame] fixed the image resizing on website, and added rel="nofollow" to all external links

2010-11-28 Thread Christopher Night
On Sun, Nov 28, 2010 at 9:12 AM, René Dudfield wrote: > I fixed the image resizing on website, > Thank you! I had no idea why my entry's image wasn't showing up! -Christopher

[pygame] pygame2exe

2010-10-23 Thread Christopher Night
I'm completely unfamiliar with Windows, and I'm finding it so much harder to use than Linux. I feel like a complete idiot trying to compile something to exe. I did manage to get a Hello World script compiled okay, but I can't get a simple test pygame script to compile. I used the pygame2exe script

Re: [pygame] Faster OBJ loader

2010-09-28 Thread Christopher Night
On Tue, Sep 28, 2010 at 3:05 PM, Devon Scott-Tunkin < devon.scotttun...@gmail.com> wrote: > It should be noted that display lists are deprecated (but for all intents > and purposes still there) in the anti-fixed function opengl 3.1+ (and > perhaps completely unavailable in open gl es 2.0?). So lea

Re: [pygame] Faster OBJ loader

2010-09-28 Thread Christopher Night
On Tue, Sep 28, 2010 at 2:05 PM, Ian Mallett wrote: > On Mon, Sep 27, 2010 at 8:05 PM, Christopher Night > wrote: > >> I was able to improve the rendering performance significantly using vertex >> arrays in the test I did a few months ago. I was still using a display l

Re: [pygame] Faster OBJ loader

2010-09-27 Thread Christopher Night
On Mon, Sep 27, 2010 at 7:52 PM, Ian Mallett wrote: > > On Mon, Sep 27, 2010 at 4:49 PM, Christopher Night > wrote: > >> Hi, I'm looking into modifying the well-known objloader.py on the pygame >> wiki: >> >> http://www.pygame.org/wiki/OBJFileLoader >

[pygame] Faster OBJ loader

2010-09-27 Thread Christopher Night
Hi, I'm looking into modifying the well-known objloader.py on the pygame wiki: http://www.pygame.org/wiki/OBJFileLoader I would modify it to use vertex arrays. I think this could improve efficiency of loading and rendering the models, based on some tests I did a few months ago on the pyweek messa

Re: [pygame] moving a filled circle from top to bottom

2010-09-27 Thread Christopher Night
It's extremely minor. Change the center of your circle from (320, 0) to (25, 25). The coordinates are with respect to self.image, not to screen. -Christopher On Mon, Sep 27, 2010 at 4:32 PM, kevin hayes wrote: > Hi, > This is my attempt at sending a circle(Sprite) vertically from the >

Re: [pygame] frame independant movement

2010-08-27 Thread Christopher Night
game prohibits me from running it faster than 20fps, no matter how fast my computer is capable of running it. Just my opinion, though. -Christopher On Fri, Aug 27, 2010 at 12:22 PM, Brian Fisher wrote: > On Fri, Aug 27, 2010 at 9:10 AM, Christopher Night > wrote: > >> Sure.

Re: [pygame] frame independant movement

2010-08-27 Thread Christopher Night
Here's what I always do: dt = clock.tick() * 0.001 x += vx * dt y += vy * dt And all the sprites have a think(dt) method that updates them as if dt seconds have passed. What else do you need? -Christopher On Fri, Aug 27, 2010 at 11:19 AM, James Paige wrote: > On Fri, Aug 27, 2010 at 10:59:09AM

Re: [pygame] frame independant movement

2010-08-27 Thread Christopher Night
the acceleration component (which is linear with > time) is consistent and accurate with both timestep sizes. > > So you asked "what else do you need?" well the answer is if you want > consistent non-linear physics (like say you want the players to jump the > same all the time