gltail 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +6 -0
- data/lib/gl_tail/element.rb +5 -6
- data/lib/gl_tail/engine.rb +2 -2
- data/lib/gl_tail/font_store.rb +31 -12
- data/lib/gl_tail.rb +1 -1
- data.tar.gz.sig +0 -0
- metadata +2 -2
- metadata.gz.sig +0 -0
data/History.txt
CHANGED
data/lib/gl_tail/element.rb
CHANGED
@@ -225,31 +225,30 @@ class Element
|
|
225
225
|
if @rate < 0.0001
|
226
226
|
txt = " r/m "
|
227
227
|
else
|
228
|
-
txt = "#{sprintf("%
|
228
|
+
txt = "#{sprintf("%8.2f",@rate * 60)} "
|
229
229
|
end
|
230
230
|
when 1
|
231
231
|
if @total == 0
|
232
232
|
txt = " total "
|
233
233
|
else
|
234
|
-
txt = "#{sprintf("%
|
234
|
+
txt = "#{sprintf("%8d",@total)} "
|
235
235
|
end
|
236
236
|
when 2
|
237
237
|
if @average == 0
|
238
238
|
txt = " avg "
|
239
239
|
else
|
240
|
-
txt = "#{sprintf("%
|
240
|
+
txt = "#{sprintf("%8.2f",@average)} "
|
241
241
|
end
|
242
242
|
else
|
243
243
|
raise "unknown block type #{self.inspect}"
|
244
244
|
end
|
245
245
|
|
246
246
|
if @x < 0
|
247
|
-
|
247
|
+
engine.render_string(sprintf("%#{@block.width}s", @name.length > @block.width ? @name[-@block.width..-1] : @name), txt)
|
248
248
|
else
|
249
|
-
|
249
|
+
engine.render_string(txt[1..-1], @name[0..@block.width-1])
|
250
250
|
end
|
251
251
|
|
252
|
-
engine.render_string(str)
|
253
252
|
|
254
253
|
glPopMatrix()
|
255
254
|
|
data/lib/gl_tail/engine.rb
CHANGED
data/lib/gl_tail/font_store.rb
CHANGED
@@ -5,6 +5,10 @@ class FontStore
|
|
5
5
|
|
6
6
|
@font_texture = nil
|
7
7
|
|
8
|
+
WIDTH = 8 / 256.0
|
9
|
+
HEIGHT = 13 / 256.0
|
10
|
+
|
11
|
+
|
8
12
|
def self.generate_textures
|
9
13
|
if @font_texture.nil?
|
10
14
|
@font_texture = glGenTextures(1)[0]
|
@@ -112,8 +116,6 @@ class FontStore
|
|
112
116
|
offsetx = ((base%16) ) / (32.0)
|
113
117
|
offsety = ((base/16) * 16) / (256.0)
|
114
118
|
|
115
|
-
width = 8 / 256.0
|
116
|
-
height = 13 / 256.0
|
117
119
|
|
118
120
|
pos_offset = char_size * pos
|
119
121
|
|
@@ -121,41 +123,58 @@ class FontStore
|
|
121
123
|
glNormal3f(1.0, 1.0, 0.0)
|
122
124
|
glVertex3f(pos_offset, 0, 0.0)
|
123
125
|
|
124
|
-
glTexCoord2f(offsetx+
|
126
|
+
glTexCoord2f(offsetx+WIDTH,offsety)
|
125
127
|
glNormal3f(1.0, 1.0, 0.0)
|
126
128
|
glVertex3f(pos_offset + char_size, 0.0, 0.0)
|
127
129
|
|
128
|
-
glTexCoord2f(offsetx+
|
130
|
+
glTexCoord2f(offsetx+WIDTH,offsety + HEIGHT)
|
129
131
|
glNormal3f(1.0, 1.0, 0.0)
|
130
132
|
glVertex3f(pos_offset + char_size, engine.line_size, 0.0)
|
131
133
|
|
132
|
-
glTexCoord2f(offsetx,offsety +
|
134
|
+
glTexCoord2f(offsetx,offsety + HEIGHT)
|
133
135
|
glNormal3f(1.0, 1.0, 0.0)
|
134
136
|
glVertex3f(pos_offset, engine.line_size, 0.0)
|
135
137
|
end
|
136
138
|
|
137
139
|
|
138
|
-
def self.render_string(engine,
|
140
|
+
def self.render_string(engine, left, right = nil)
|
139
141
|
glPushMatrix
|
140
142
|
glEnable(GL_BLEND)
|
141
143
|
glBlendFunc(GL_ONE, GL_ONE)
|
142
144
|
glBindTexture(GL_TEXTURE_2D, @font_texture)
|
143
145
|
|
144
|
-
|
146
|
+
pos = 0
|
147
|
+
|
148
|
+
unless BlobStore.has(left)
|
145
149
|
list = glGenLists(1)
|
146
150
|
glNewList(list, GL_COMPILE)
|
147
151
|
glBegin(GL_QUADS)
|
148
|
-
|
149
|
-
|
152
|
+
left.each_byte do |c|
|
153
|
+
self.render_char(engine, c, pos) unless c == 32
|
154
|
+
pos += 1
|
155
|
+
end
|
156
|
+
glEnd
|
157
|
+
glEndList
|
158
|
+
BlobStore.put(left,list)
|
159
|
+
else
|
160
|
+
pos += left.length
|
161
|
+
end
|
162
|
+
glCallList(BlobStore.get(left))
|
163
|
+
|
164
|
+
unless BlobStore.has(right) || right.nil?
|
165
|
+
list = glGenLists(1)
|
166
|
+
glNewList(list, GL_COMPILE)
|
167
|
+
glBegin(GL_QUADS)
|
168
|
+
right.each_byte do |c|
|
150
169
|
self.render_char(engine, c, pos)
|
151
170
|
pos += 1
|
152
171
|
end
|
153
172
|
glEnd
|
154
173
|
glEndList
|
155
|
-
BlobStore.put(
|
174
|
+
BlobStore.put(right,list)
|
156
175
|
end
|
157
|
-
glCallList(BlobStore.get(
|
158
|
-
|
176
|
+
glCallList(BlobStore.get(right)) unless right.nil?
|
177
|
+
|
159
178
|
glBindTexture(GL_TEXTURE_2D, 0)
|
160
179
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
|
161
180
|
glDisable(GL_BLEND)
|
data/lib/gl_tail.rb
CHANGED
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gltail
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ""
|
6
6
|
authors:
|
7
7
|
- Erlend Simonsen
|
@@ -29,7 +29,7 @@ cert_chain:
|
|
29
29
|
/UfNqVgtDGy57Xw9DBNRbUm92FVILwpudQs3SX1z2Gik08RrKReELwpRciY=
|
30
30
|
-----END CERTIFICATE-----
|
31
31
|
|
32
|
-
date: 2008-03-
|
32
|
+
date: 2008-03-28 00:00:00 +01:00
|
33
33
|
default_executable:
|
34
34
|
dependencies:
|
35
35
|
- !ruby/object:Gem::Dependency
|
metadata.gz.sig
CHANGED
Binary file
|