-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtext.py
134 lines (109 loc) · 4.36 KB
/
text.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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
# coding=UTF-8
'''
Created on 25 janv. 2015
@author: pclf
'''
import gstt
import vectors
from globalVars import *
ZOOM_PLAYING = .5
ZOOM_GAMEOVER = 5.0
DZOOM_PLAYING = -.4
DZOOM_GAMEOVER = .1
# Finalement, on implémente le score ici
ASCII_GRAPHICS = [
#implementé
[[(-10,10), (10,-10), (10,10), (0,20), (-10,10), (-10,-10), (0,-20), (10,-10)]],#0
[[(-10,-10), (0,-20), (0,20)], [(-10,20), (10,20)]], #1
[[(-10,-10), (0,-20), (10,-10), (10,0), (-10,20), (10,20)]], #2
[[(-10,-20), (0,-20), (10,-10), (0,0), (10,10), (0,20), (-10,20)]], #3
[[(10,10), (-10,10), (0,-20), (0,20)]], #4
[[(10,-20), (-10,-20), (-10,0), (0,0), (10,10), (0,20), (-10,20)]], #5
[[(10,-20), (0,-20), (-10,-10), (-10,20), (0,20), (10,10), (10,0), (-10,0)]], #6
[[(-10,-20), (10,-20), (-10,20)]], #7
[[(-10,10), (10,-10), (0,-20), (-10,-10), (10,10), (0,20), (-10,10)]], #8
[[(10,0), (-10,0), (-10,-10), (0,-20), (10,-20), (10,10), (0,20), (-10,20)]], #9
# A implementer
[[(-10,10), (10,-10), (10,10), (0,20), (-10,10), (-10,-10), (0,-20), (10,-10)]], #:
[[(-10,-10), (0,-20), (0,20)], [(-10,20), (10,20)]], #;
[[(-10,-10), (0,-20), (10,-10), (10,0), (-10,20), (10,20)]], #<
[[(-10,-20), (0,-20), (10,-10), (0,0), (10,10), (0,20), (-10,20)]], #=
[[(10,10), (-10,10), (0,-20), (0,20)]], #>
[[(10,-20), (-10,-20), (-10,0), (0,0), (10,10), (0,20), (-10,20)]], #?
[[(10,-20), (0,-20), (-10,-10), (-10,20), (0,20), (10,10), (10,0), (-10,0)]], #@
# Implementé
[[(-10,20), (-10,-20), (10,-20), (10,20), (10,0), (-10,0)]], #A
[[(-10,20), (-10,-20), (10,-20), (10,20), (10,0), (-10,0)]], #A
[[(-10,20), (-10,-20), (10,-20), (10,20), (-10,20), (-10,0), (10,0)]], #B
[[(10,20), (-10,20), (-10,-20), (10,-20)]], #C
[[(-10,20), (-10,-20), (10,-20), (10,20), (-10,20)]], #D
[[(10,20), (-10,20), (-10,-0), (10,0), (-10,0), (-10,-20), (10,-20)]], #E
[[(-10,20), (-10,-0), (10,0), (-10,0), (-10,-20), (10,-20)]], #F
[[(0,0), (10,0), (10,20), (-10,20), (-10,-20),(10,-20)]], #G
[[(-10,-20), (-10,20), (-10,0), (10,0), (10,20), (10,-20)]], #H
[[(0,20), (0,-20)]], #I
[[(-10,20), (0,-20), (0,-20), (-10,-20), (10,-20)]], #J
[[(-10,-20), (-10,20), (-10,0), (10,-20), (-10,0), (10,20)]], #K
[[(10,20), (-10,20), (-10,-20)]], #L
[[(-10,20), (-10,-20), (0,0), (10,-20), (10,20)]], #M
[[(-10,20), (-10,-20), (10,20), (10,-20)]], #N
[[(-10,20), (-10,-20), (10,-20), (10,20), (-10,20)]], #O
[[(-10,0), (10,0), (10,-20), (-10,-20), (-10,20)]], #P
[[(10,20), (10,-20), (-10,-20), (-10,20), (10,20),(15,25)]], #Q
[[(-10,20), (-10,-20), (10,-20), (10,0), (-10,0), (10,20)]], #R
[[(10,-20), (-10,-20), (-10,0), (10,0), (10,20), (-10,20)]], #S
[[(0,20), (0,-20), (-10,-20), (10,-20)]], #T
[[(-10,-20), (-10,20), (10,20), (10,-20)]], #U
[[(-10,-20), (0,20), (10,-20)]], #V
[[(-10,-20), (-10,20), (0,0), (10,20), (10,-20)]], #W
[[(-10,20), (10,-20)], [(-10,-20), (10,20)]], #X
[[(0,20), (0,0), (10,-20), (0,0), (-10,-20)]], #Y
[[(10,20), (-10,20), (10,-20), (-10,-20)]], #Z
[[(-2,15), (2,15)]] # Point
]
class Text(object):
'''
classdocs
'''
def __init__(self):
'''
Constructor
'''
self.value = "TEAM LASER TMPLAB"
self.zoom = ZOOM_PLAYING
def Reset(self):
self.value = 111
def ZoomIn(self):
self.zoom += DZOOM_GAMEOVER
if self.zoom > ZOOM_GAMEOVER:
self.zoom = ZOOM_GAMEOVER
def ZoomOut(self):
self.zoom += DZOOM_PLAYING
if self.zoom < ZOOM_PLAYING:
self.zoom = ZOOM_PLAYING
def ZoomReset(self):
self.zoom = ZOOM_PLAYING
def Draw(self, f):
value_temp = self.value
rg_digit = 0
chars = []
while rg_digit < 3 or value_temp:
chars.append(value_temp % 10)
value_temp //= 10
rg_digit += 1
#if gstt.fs == GAME_FS_PLAY:
# del chars[0]
self.DrawChars(f, chars)
def DrawChars(self, f, chars):
#TODO : gérer correctement les coordonnées
l = len(chars)
f.LineTo((text_pos[0],text_pos[1]), 0x80000000)
for i, ch in enumerate(chars):
x_offset = 12 * (l - 3*i)
digit_pl_list = ASCII_GRAPHICS[ch+10]
for pl in digit_pl_list:
pl_draw = []
for xy in pl:
xy_draw = vectors.Vector2D(text_pos[0],text_pos[1]) + vectors.Vector2D(xy[0] + x_offset,xy[1]) * self.zoom
pl_draw.append(xy_draw.ToTuple())
f.PolyLineOneColor(pl_draw, 0xFFFFFF)