99 |
PopAttrib |
PopAttrib |
100 |
""" % locals()) |
""" % locals()) |
101 |
|
|
102 |
|
fontsize = 32 |
103 |
def getFont(): |
def getFont(): |
104 |
global font |
global font |
105 |
try: |
try: |
106 |
a=font |
a=font |
107 |
except: |
except: |
108 |
font = GL.createFont("gfx/fonts/a010013l.pfb", 32); |
font = GL.createFont("gfx/fonts/a010013l.pfb", fontsize); |
109 |
return font |
return font |
110 |
|
|
111 |
|
def getText(text, x = 0, y = 0, z = 0, w = 1, h = 1): |
112 |
|
return GLRen.createHorizText(getFont(), text, x, y, z, w,h) |
113 |
|
|
114 |
|
def putText(vs, cs1, text, color = None, x = 0, y = 0, z = 0, w = 1, h = 1): |
115 |
|
if color != None: |
116 |
|
putnoc(vs, getDListNocoords("Color " + js(color))) |
117 |
|
putnoc(vs, getDListNocoords(""" |
118 |
|
PushAttrib ENABLE_BIT |
119 |
|
Disable ALPHA_TEST |
120 |
|
Disable DEPTH_TEST |
121 |
|
Enable TEXTURE_2D |
122 |
|
Enable BLEND |
123 |
|
BlendFunc SRC_ALPHA ONE_MINUS_SRC_ALPHA |
124 |
|
""")) |
125 |
|
|
126 |
|
t = getText(text, x, y, z, w, h) |
127 |
|
vs.map.put(t, cs1) |
128 |
|
|
129 |
|
putnoc(vs, getDListNocoords(""" |
130 |
|
PopAttrib |
131 |
|
""")) |
132 |
|
|
133 |
|
|
134 |
def js(list): |
def js(list): |
135 |
return " ".join([str(el) for el in list]) |
return " ".join([str(el) for el in list]) |