-
Notifications
You must be signed in to change notification settings - Fork 0
/
testvectorspeed.py
executable file
·54 lines (47 loc) · 1.49 KB
/
testvectorspeed.py
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
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from random import *
from libavg import *
global Player
XRANGE = (20, 1024-20)
YRANGE = (20, 768-20)
def addLines():
canvas = Player.getElementByID("canvas")
for i in xrange(200):
# line = Player.createNode("line",
# {"x1":0, "y1":10, "x2":10, "y2":10,
# "strokewidth": 1})
line = Player.createNode("line",
{"x1":randrange(XRANGE[0], XRANGE[1]),
"y1":randrange(YRANGE[0], YRANGE[1]),
"x2":randrange(XRANGE[0], XRANGE[1]),
"y2":randrange(YRANGE[0], YRANGE[1]),
"texhref":"rgb24-64x64.png",
"strokewidth":randrange(1,5)})
canvas.appendChild(line)
print canvas.getNumChildren()
if canvas.getNumChildren() > 2000:
for i in xrange(200):
canvas.removeChild(0)
Player = avg.Player()
Log = avg.Logger.get()
Log.setCategories(Log.APP |
Log.WARNING |
Log.PROFILE |
# Log.PROFILE_LATEFRAMES |
Log.CONFIG
# Log.MEMORY |
# Log.BLTS
# Log.EVENTS|
# Log.EVENTS2
)
Player.loadString("""
<?xml version="1.0"?>
<!DOCTYPE avg SYSTEM "../../doc/avg.dtd">
<avg width="1024" height="768">
<div id="canvas" width="1024" height="768"/>
</avg>
""")
Player.setOnFrameHandler(addLines)
Player.setFramerate(1000)
Player.play()