-
Notifications
You must be signed in to change notification settings - Fork 0
/
flashchat_comp.py
77 lines (59 loc) · 1.67 KB
/
flashchat_comp.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
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
# import cv2 as cv
import pygame
import sys
import random
from pygame.locals import *
import convert
FRAME_RATE = 1000./180 #1000./80
Clock = pygame.time.Clock
# print "Using OpenCV v" + cv.__version__
print "Using pygame v" + pygame.__version__
# # currently broken on OS X
# def toggle_fullscreen():
# screen = pygame.display.get_surface()
# tmp = screen.convert()
# caption = pygame.display.get_caption()
# cursor = pygame.mouse.get_cursor() # Duoas 16-04-2007
# w,h = screen.get_width(),screen.get_height()
# flags = screen.get_flags()
# bits = screen.get_bitsize()
# #pygame.display.quit()
# pygame.display.init()
# screen = pygame.display.set_mode((w,h),flags^FULLSCREEN,bits)
# screen.blit(tmp,(0,0))
# pygame.display.set_caption(*caption)
# pygame.key.set_mods(0) #HACK: work-a-round for a SDL bug??
# pygame.mouse.set_cursor( *cursor ) # Duoas 16-04-2007
# return screen
if __name__ == "__main__":
pygame.init()
size = width, height = 1000, 600
upZero = 255, 0,0
downZero = 0, 200,0
upOne = 255, 0,255
downOne = 0, 0,255
black = 0, 0, 0
white = 255, 255, 255
screen = pygame.display.set_mode(size)
clock = Clock()
# isBlack = True
isUp = False
bits = convert.makeMessage("m","Testing")
while True:
for bit in bits:
for event in pygame.event.get():
if event.type == pygame.QUIT: sys.exit()
time = clock.tick_busy_loop(FRAME_RATE)
print float(time)
if isUp:
if bit == '1':
screen.fill(upOne)
else:
screen.fill(upZero)
else:
if bit == '1':
screen.fill(downOne)
else:
screen.fill(downZero)
isUp = not isUp
pygame.display.flip()