/[gzz]/gzz/gfx/demo/text.py
ViewVC logotype

Diff of /gzz/gfx/demo/text.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.2 by tjl, Mon Oct 7 17:47:55 2002 UTC revision 1.3 by tjl, Tue Oct 8 07:30:12 2002 UTC
# Line 6  fonts = [ GL.createFont("gfx/fonts/a0100 Line 6  fonts = [ GL.createFont("gfx/fonts/a0100
6    
7  textstyle = GLTextStyle.create("sans", 0, 1)  textstyle = GLTextStyle.create("sans", 0, 1)
8    
9    for f in fonts:
10        print f.getHeight(), f.getYOffs()
11    
12  A = [GLRen.createHorizText2(f, "ABCgabcg", 1, 1, 1, 0) for f in fonts]  A = [GLRen.createHorizText2(f, "ABCgabcg", 1, 1, 1, 0) for f in fonts]
13  B = [TextVob(textstyle, "ABCgabcg") for f in fonts]  B = TextVob(textstyle, "ABCgabcg", 0)
14    C = TextVob(textstyle, "ABCgabcg", 1)
15    
16    cq = coloredQuad((1,1,1))
17    
18  class TextScene:  class TextScene:
19      def __init__(self):      def __init__(self):
20          self.fontind = len(A)-1          self.fontind = len(A)-1
21          self.offset = [(0,0),(1.5,1.5),(0,1.5),(1.5,0)]          self.offset = [(0,0),(1.5,1.5),(0,1.5),(1.5,0)]
22          self.regcomb = 0          self.regcomb = 0
23            self.textvobs = [B, C]
24            
25      def key(self, key):      def key(self, key):
26            if key == "b":
27                rotatelist(self.textvobs)
28                AbstractUpdateManager.setNoAnimation()
29                AbstractUpdateManager.chg()
30          if key == "c":          if key == "c":
31              self.regcomb = not self.regcomb              self.regcomb = not self.regcomb
32              AbstractUpdateManager.setNoAnimation()              AbstractUpdateManager.setNoAnimation()
# Line 37  class TextScene: Line 48  class TextScene:
48          vs.map.put(background((0.3,0.5,0.6)))          vs.map.put(background((0.3,0.5,0.6)))
49    
50          vs.map.put(getDListNocoords("""          vs.map.put(getDListNocoords("""
51                Color 0 0 0
52              Enable BLEND              Enable BLEND
53              Disable ALPHA_TEST              Disable ALPHA_TEST
             Color 0 0 0  
54              PushAttrib ENABLE_BIT TEXTURE_BIT              PushAttrib ENABLE_BIT TEXTURE_BIT
55                Disable TEXTURE_2D
56          """))          """))
57    
58          if self.regcomb:          if self.regcomb:
# Line 62  class TextScene: Line 74  class TextScene:
74    
75          y = 20          y = 20
76          sizes = (5, 6, 7, 8, 9, 10, 12, 15, 16, 20, 24, 32, 64, 100, 200)          sizes = (5, 6, 7, 8, 9, 10, 12, 15, 16, 20, 24, 32, 64, 100, 200)
77    
78          for s in sizes:          for s in sizes:
79              y += s              y += s
80              for i in (self.fontind,): # range(0,len(A)):              for i in (self.fontind,): # range(0,len(A)):
# Line 73  class TextScene: Line 86  class TextScene:
86    
87            
88          y = 20          y = 20
         sizes = (5, 6, 7, 8, 9, 10, 12, 15, 16, 20, 24, 32, 64, 100, 200)  
89          for s in sizes:          for s in sizes:
90              y += s              y += s
91              for i in (self.fontind,): # range(0,len(A)):              cs = vs.coords.coordsys(0, 0, 500 + self.offset[0][0], y + self.offset[0][1], s, s)
92                  vs.put(B[i], "B"+str((s,i)), 0, 500 + self.offset[0][0], y + self.offset[0][1], s, s)              vs.matcher.add(cs, "B"+str(s))
93                vs.map.put(getDListNocoords("""
94                    Disable TEXTURE_2D
95                """))
96                vs.map.put(cq, cs)
97                vs.map.put(getDListNocoords("""
98                    Color 0 0 0
99                    Enable TEXTURE_2D
100                """))
101                vs.map.put(self.textvobs[0], cs)
102                # print "T: ",cs
103    
104  currentScene = TextScene()  currentScene = TextScene()
105    

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26