I'm building a different game based on the pong example. There seems to be
some strangeness with regards to the positioning of GL_LINES so I did the
border using polygons:
GAME_WIDTH = 800
GAME_HEIGHT = 600
class ScreenBorder:
def __init__(self):
self.thickness = 2
self.color = (255, 255, 255, 255)
self.border = batch.add(16, GL_QUADS, None, ('v2i', (
0, 0,
GAME_WIDTH, 0,
GAME_WIDTH, self.thickness,
0, self.thickness,
0, GAME_HEIGHT - self.thickness,
GAME_WIDTH, GAME_HEIGHT - self.thickness,
GAME_WIDTH, GAME_HEIGHT,
0, GAME_HEIGHT,
0, 0,
self.thickness, 0,
self.thickness, GAME_HEIGHT,
0, GAME_HEIGHT,
GAME_WIDTH, 0,
GAME_WIDTH - self.thickness, 0,
GAME_WIDTH - self.thickness, GAME_HEIGHT,
GAME_WIDTH, GAME_HEIGHT,
)),('c4B', self.color * 16))
This seems to work well, with the border an even thickness around the
screen.
Paul
On Wed, Dec 10, 2008 at 11:18 AM, Tristam MacDonald <[EMAIL PROTECTED]>wrote:
> Where I was originally drawing the divider:
> # setup the divider between the play area and the score area
> batch.add(2, GL_LINES, None, ('v2i', (0,500, 800,500)))
>
> I am now attempting to draw a border as well:
>
> # setup the border
> batch.add(8, GL_LINES, None, ('v2i', (800,600, 800,0, 800, 0, 0,0, 0,0,
> 0,600, 0,600, 800,600)))
>
> But for some reason, only the right and lower edges display. If I modify
> the coordinates like this:
>
> # setup the border
> batch.add(8, GL_LINES, None, ('v2i', (800,600, 800,0, 800, 0, 0,0, 1,0,
> 1,600, 0,599, 800,599)))
>
> Everything renders fine (except for the border being in the wrong place). I
> don't really get why this would make a difference, seeing as the other two
> edges render fine, and there is no clipping going on (lines are still within
> window bounds, scissor test is disabled).
>
> In case anyone can shed light on the problem, the sample is attached.
>
> - Tristam
>
> On Tue, Dec 9, 2008 at 5:55 PM, Paul <[EMAIL PROTECTED]> wrote:
>
>> On Tue, Dec 9, 2008 at 2:19 PM, Tristam MacDonald <[EMAIL PROTECTED]>wrote:
>>
>>> Nice work! I was thinking of adapting the drawing code to accomplish the
>>> same effect, but that is far simpler. Mind if I include that change in the
>>> updated version next week?
>>>
>>>
>> Sure. In addition it might be a good idea to draw a border around the
>> edges of the playing field so the edges can still be identified when the
>> window is resized.
>>
>>
>>
>>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"pyglet-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/pyglet-users?hl=en
-~----------~----~----~----~------~----~------~--~---