File: window_util.py

package info (click to toggle)
pyglet 2.0.17%2Bds-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 15,560 kB
  • sloc: python: 80,579; xml: 50,988; ansic: 171; makefile: 146
file content (27 lines) | stat: -rwxr-xr-x 647 bytes parent folder | download | duplicates (3)
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
from pyglet.gl import *


def draw_client_border(window):
    glClearColor(0, 0, 0, 1)
    glClear(GL_COLOR_BUFFER_BIT)

    glMatrixMode(GL_PROJECTION)
    glLoadIdentity()
    glOrtho(0, window.width, 0, window.height, -1, 1)

    glMatrixMode(GL_MODELVIEW)
    glLoadIdentity()

    def rect(x1, y1, x2, y2):
        glBegin(GL_LINE_LOOP)
        glVertex2f(x1, y1)
        glVertex2f(x2, y1)
        glVertex2f(x2, y2)
        glVertex2f(x1, y2)
        glEnd()

    glColor3f(1, 0, 0)
    rect(-2, -2, window.width + 2, window.height + 2)

    glColor3f(0, 1, 0)
    rect(1, 1, window.width - 2, window.height - 2)