Skip to content

Commit

Permalink
- Set default color to white unless otherwise defined.
Browse files Browse the repository at this point in the history
  • Loading branch information
erlends committed Oct 30, 2007
1 parent cb3a2bf commit 6288d97
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions lib/gl_tail/element.rb
Expand Up @@ -35,6 +35,7 @@ def initialize(block, name, color, start_position = nil)
@step = 0, @updates = 0
@active = false
@color = color
@color ||= [1.0, 1.0, 1.0, 1.0]
@type = (@block.activity_type == "blobs" ? :blobs : :bars)
end

Expand Down Expand Up @@ -130,13 +131,13 @@ def render(engine, options = { })

if( rate > 0.0 )
glBegin(GL_QUADS)

if @x >= 0
y2 = 0.0
@x1 = 7*8.0 / (engine.screen.window_width / 2.0)
y1 = engine.screen.line_size * 0.9
x2 = @x1 + ((@block.width+1) * 8.0 / (engine.screen.window_width / 2.0) ) * (rate / @block.max_rate)

@x2 ||= @x1
d = (@x2 - x2)
if d.abs < 0.001
Expand All @@ -154,19 +155,19 @@ def render(engine, options = { })
glVertex3f(@x1, y2, @z)

else
@x2 = (@block.width+1)*8.0 / (engine.screen.window_width / 2.0)
@x2 = (@block.width+1)*8.0 / (engine.screen.window_width / 2.0)
y2 = 0.0
y1 = engine.screen.line_size * 0.9
x1 = ((@block.width * 8.0) / (engine.screen.window_width / 2.0) ) * (1.0 - rate / @block.max_rate)

@x1 ||= @x2
d = (@x1 - x1)
if d.abs < 0.001
@x1 = x1
else
@x1 -= d / 20
end

glColor(@bar_color)
glVertex3f(@x1, y1, @z)
glColor(@bar_color)
Expand All @@ -175,18 +176,18 @@ def render(engine, options = { })
glVertex3f(@x2, y2, @z)
glColor([0.0, 0.0, 0.0, 0.0])
glVertex3f(@x1, y2, @z)

end


glEnd

end


# glTranslate(@x, @y, @z)

glColor( (@queue.size > 0 ? (engine.screen.highlight_color || [1.0, 0.0, 0.0, 1.0]) : @color ) )
glColor( (@queue.size > 0 ? (engine.screen.highlight_color || [1.0, 0.0, 0.0, 1.0]) : @color) )

case @block.show
when 0
Expand Down Expand Up @@ -223,18 +224,18 @@ def render(engine, options = { })

t = glutGet(GLUT_ELAPSED_TIME)
while( (@queue.size > 0) && (@last_time < t ) )

@bar_color[0] = @bar_color[0] + (@color[0] - @bar_color[0]) / 5
@bar_color[1] = @bar_color[1] + (@color[1] - @bar_color[1]) / 5
@bar_color[2] = @bar_color[2] + (@color[2] - @bar_color[2]) / 5

@last_time += @step
item = @queue.pop
url = item.message
color = item.color
size = item.size
type = item.type

if type == 2
@activities.push Activity.new(url, 0.0 - (0.008 * url.length), engine.screen.top, 0.0, color, size, type)
elsif type == 5
Expand Down Expand Up @@ -264,6 +265,6 @@ def render(engine, options = { })
@bar_color[0] = @bar_color[0] + (0.15 - @bar_color[0]) / 100
@bar_color[1] = @bar_color[1] + (0.15 - @bar_color[1]) / 100
@bar_color[2] = @bar_color[2] + (0.15 - @bar_color[2]) / 100

end
end

0 comments on commit 6288d97

Please sign in to comment.