Port
Jr. Member

Offline
Posts: 67
|
 |
« Reply #750 on: May 04, 2012, 08:04:09 am » |
|
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
|
 |
« Reply #751 on: May 04, 2012, 08:04:44 am » |
|
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 » |
|
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_yBut I managed to do it 
|
|
|
|
|
Logged
|
|
|
|
|
nightcracker
|
 |
« 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_yBut I managed to do it  https://github.com/nightcracker/PyGG2/blob/ad5b9ad09665b8c20b0df1c52e6db5d3c3fd940c/function.py#L23
|
|
|
|
|
Logged
|
|
|
|
|
Machidro
|
 |
« 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_yBut I managed to do it  https://github.com/nightcracker/PyGG2/blob/ad5b9ad09665b8c20b0df1c52e6db5d3c3fd940c/function.py#L23Your code makes no sense, I'm keeping my code :U
|
|
|
|
|
Logged
|
|
|
|
|
|
|
Phantom Brave
|
 |
« Reply #758 on: May 07, 2012, 09:22:21 am » |
|
|
|
|
|
|
Logged
|
 Linkin Park lyrics here
|
|
|
|
notajf
Guest
|
 |
« Reply #759 on: May 07, 2012, 09:25:30 am » |
|
Huh, apparently Orpheon is most active. Makes sense.
|
|
|
|
|
Logged
|
|
|
|
|
Orpheon
|
 |
« Reply #760 on: May 07, 2012, 10:51:01 am » |
|
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 » |
|
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
|
 |
« Reply #762 on: May 07, 2012, 11:11:26 am » |
|
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 
|
|
|
|
|
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 » |
|
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  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
|
 |
« Reply #764 on: May 07, 2012, 11:15:29 am » |
|
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  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.
|
|
|
|