The Gang Garrison 2 Forum
May 25, 2013, 06:45:31 pm *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Chat with us on IRC: http://ganggarrison.com/irc.html
Server: irc.esper.net, Channel: #gg2
 
   Home   Help Search Login Register  
Pages: « 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 »
  Print  
Author Topic: Official PyGG2 Development thread  (Read 37359 times)
Port
Jr. Member
**
Offline Offline

Posts: 67



« Reply #750 on: May 04, 2012, 08:04:09 am »

I'm trying to add networking and I keep getting this error:
http://pastebin.com/raw.php?i=tcajYUXQ
What on earth does that have to do with networking?

That's a pyglet error.


However it did start happening only as soon as I added the twisted reactor in a side thread.
OpenGL is not thread-safe


Then what do I do if I want to run the pyglet engine and the twisted reactor at the same time?
Logged

Orpheon
Moderator
*****
Offline Offline

Posts: 5843


Developer


« Reply #751 on: May 04, 2012, 08:04:44 am »

I'm trying to add networking and I keep getting this error:
http://pastebin.com/raw.php?i=tcajYUXQ
What on earth does that have to do with networking?

That's a pyglet error.


However it did start happening only as soon as I added the twisted reactor in a side thread.
OpenGL is not thread-safe


Then what do I do if I want to run the pyglet engine and the twisted reactor at the same time?
Not use threads, or not use Twisted. The socket module isn't SO bad.
Logged

Your mind is software. Program it.
Your body is a shell. Change it.
Death is a disease. Cure it.
Extinction is approaching. Fight it.
notajf
Guest
« Reply #752 on: May 04, 2012, 08:06:56 am »

I'm trying to add networking and I keep getting this error:
http://pastebin.com/raw.php?i=tcajYUXQ
What on earth does that have to do with networking?

That's a pyglet error.


However it did start happening only as soon as I added the twisted reactor in a side thread.
OpenGL is not thread-safe


Then what do I do if I want to run the pyglet engine and the twisted reactor at the same time?
Not use threads, or not use Twisted. The socket module isn't SO bad.
You can integrate pyglet and Twisted, there's instructions for doing so somewhere.
Logged
notajf
Guest
« Reply #753 on: May 04, 2012, 02:42:50 pm »

This is the most difficult code I've ever written:

            if self.rotation != 0:
                # get centre of image
                old_centre_x = sf.get_width() / 2
                old_centre_y = sf.get_height() / 2
               
                # rotate surface
                sf = pygame.transform.rotate(sf, 0 - self.rotation)
               
                # get centre of rotated surface
                centre_x = sf.get_width() / 2
                centre_y = sf.get_height() / 2

                # get angle in radians
                a = math.radians(self.rotation)
               
                # from anchor point and image centre, calculate distance
                x = old_centre_x - self.anchor_x
                y = old_centre_y - self.anchor_y
                r = math.sqrt(x*x + y*y)
               
                # offset image based on how much anchor has moved in rotation
                offset_x += math.cos(a) * r - centre_x
                offset_y += math.sin(a) * r - centre_y
            else:
                offset_x, offset_y = -self.anchor_x, -self.anchor_y


But I managed to do it Smiley
Logged
nightcracker
NC
Hero Member
*****
Offline Offline

Posts: 518


PyGG2 dev


WWW
« Reply #754 on: May 04, 2012, 08:47:18 pm »

This is the most difficult code I've ever written:

            if self.rotation != 0:
                # get centre of image
                old_centre_x = sf.get_width() / 2
                old_centre_y = sf.get_height() / 2
               
                # rotate surface
                sf = pygame.transform.rotate(sf, 0 - self.rotation)
               
                # get centre of rotated surface
                centre_x = sf.get_width() / 2
                centre_y = sf.get_height() / 2

                # get angle in radians
                a = math.radians(self.rotation)
               
                # from anchor point and image centre, calculate distance
                x = old_centre_x - self.anchor_x
                y = old_centre_y - self.anchor_y
                r = math.sqrt(x*x + y*y)
               
                # offset image based on how much anchor has moved in rotation
                offset_x += math.cos(a) * r - centre_x
                offset_y += math.sin(a) * r - centre_y
            else:
                offset_x, offset_y = -self.anchor_x, -self.anchor_y


But I managed to do it Smiley

https://github.com/nightcracker/PyGG2/blob/ad5b9ad09665b8c20b0df1c52e6db5d3c3fd940c/function.py#L23
Logged

Machidro
Hero Member
*****
Offline Offline

Posts: 1891


Gardicolo time is over.


« Reply #755 on: May 04, 2012, 09:51:34 pm »

That's got to sting a bit. Agonize over code. Bam. Already done.
Logged

A CHALLENGER HAS ARRIVED.
notajf
Guest
« Reply #756 on: May 05, 2012, 10:01:22 am »

This is the most difficult code I've ever written:

            if self.rotation != 0:
                # get centre of image
                old_centre_x = sf.get_width() / 2
                old_centre_y = sf.get_height() / 2
               
                # rotate surface
                sf = pygame.transform.rotate(sf, 0 - self.rotation)
               
                # get centre of rotated surface
                centre_x = sf.get_width() / 2
                centre_y = sf.get_height() / 2

                # get angle in radians
                a = math.radians(self.rotation)
               
                # from anchor point and image centre, calculate distance
                x = old_centre_x - self.anchor_x
                y = old_centre_y - self.anchor_y
                r = math.sqrt(x*x + y*y)
               
                # offset image based on how much anchor has moved in rotation
                offset_x += math.cos(a) * r - centre_x
                offset_y += math.sin(a) * r - centre_y
            else:
                offset_x, offset_y = -self.anchor_x, -self.anchor_y


But I managed to do it Smiley

https://github.com/nightcracker/PyGG2/blob/ad5b9ad09665b8c20b0df1c52e6db5d3c3fd940c/function.py#L23
Your code makes no sense, I'm keeping my code :U
Logged
notajf
Guest
« Reply #757 on: May 07, 2012, 08:51:17 am »

https://github.com/PyGG2/PyGG2/graphs/impact

Impact of different people. Note nightcracker's long streak, whilst I have occasional bumps.
Logged
Phantom Brave
All Hail Classicwell
Designer
*****
Offline Offline

Posts: 9074


Another one --


WWW
« Reply #758 on: May 07, 2012, 09:22:21 am »

https://github.com/PyGG2/PyGG2/graphs/contributors
this is easier to look at for our few people
Logged

notajf
Guest
« Reply #759 on: May 07, 2012, 09:25:30 am »

https://github.com/PyGG2/PyGG2/graphs/contributors
this is easier to look at for our few people
Huh, apparently Orpheon is most active. Makes sense.
Logged
Orpheon
Moderator
*****
Offline Offline

Posts: 5843


Developer


« Reply #760 on: May 07, 2012, 10:51:01 am »

https://github.com/PyGG2/PyGG2/graphs/contributors
this is easier to look at for our few people
Huh, apparently Orpheon is most active. Makes sense.
Actually, NC would have more if he didn't do it from separate accounts or something. I'm more of a long-distance runner here, also I'm the only person that was on the project from start to now.
Logged

Your mind is software. Program it.
Your body is a shell. Change it.
Death is a disease. Cure it.
Extinction is approaching. Fight it.
notajf
Guest
« Reply #761 on: May 07, 2012, 11:10:48 am »

https://github.com/PyGG2/PyGG2/graphs/contributors
this is easier to look at for our few people
Huh, apparently Orpheon is most active. Makes sense.
Actually, NC would have more if he didn't do it from separate accounts or something. I'm more of a long-distance runner here, also I'm the only person that was on the project from start to now.
Wasn't I here at the start? Well, close to it...
Logged
Orpheon
Moderator
*****
Offline Offline

Posts: 5843


Developer


« Reply #762 on: May 07, 2012, 11:11:26 am »

https://github.com/PyGG2/PyGG2/graphs/contributors
this is easier to look at for our few people
Huh, apparently Orpheon is most active. Makes sense.
Actually, NC would have more if he didn't do it from separate accounts or something. I'm more of a long-distance runner here, also I'm the only person that was on the project from start to now.
Wasn't I here at the start? Well, close to it...
You made a rather large pause in the middle  hehe
Logged

Your mind is software. Program it.
Your body is a shell. Change it.
Death is a disease. Cure it.
Extinction is approaching. Fight it.
notajf
Guest
« Reply #763 on: May 07, 2012, 11:12:17 am »

https://github.com/PyGG2/PyGG2/graphs/contributors
this is easier to look at for our few people
Huh, apparently Orpheon is most active. Makes sense.
Actually, NC would have more if he didn't do it from separate accounts or something. I'm more of a long-distance runner here, also I'm the only person that was on the project from start to now.
Wasn't I here at the start? Well, close to it...
You made a rather large pause in the middle  hehe
Yes. Back then it wasn't fun developing for PyGG2, it was a messy piece of shit that couldn't do anything right.
Logged
Orpheon
Moderator
*****
Offline Offline

Posts: 5843


Developer


« Reply #764 on: May 07, 2012, 11:15:29 am »

https://github.com/PyGG2/PyGG2/graphs/contributors
this is easier to look at for our few people
Huh, apparently Orpheon is most active. Makes sense.
Actually, NC would have more if he didn't do it from separate accounts or something. I'm more of a long-distance runner here, also I'm the only person that was on the project from start to now.
Wasn't I here at the start? Well, close to it...
You made a rather large pause in the middle  hehe
Yes. Back then it wasn't fun developing for PyGG2, it was a messy piece of shit that couldn't do anything right.
I think we might be nearing one of the reasons why you never finish stuff....


...
Logged

Your mind is software. Program it.
Your body is a shell. Change it.
Death is a disease. Cure it.
Extinction is approaching. Fight it.
Pages: « 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 »
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.44 seconds with 19 queries.