Class: GGLib::Themes::RubygooTheme

Inherits:
DrawnTheme show all
Defined in:
lib/ext/themes.rb

Constant Summary collapse

@@textbox =
nil

Instance Attribute Summary

Attributes inherited from DrawnTheme

#font

Attributes inherited from GGLib::Theme

#name

Instance Method Summary collapse

Methods inherited from DrawnTheme

#height, #newInstance, #width

Methods inherited from GGLib::Theme

#height, #setDefaultState, #setDownState, #setOverState, #width

Constructor Details

#initializeRubygooTheme

Returns a new instance of RubygooTheme.



33
34
35
36
# File 'lib/ext/themes.rb', line 33

def initialize
  font = ThemeFontGroup.new( Gosu::Font.new($window, Gosu::default_font_name, 17), Gosu::Font.new($window, Gosu::default_font_name, 25), Gosu::Font.new($window, Gosu::default_font_name, 20), 0xff000000, 0xff848484)
  super("Rubygoo.Generic", font)
end

Instance Method Details

#draw(x1, y1, x2, y2, state) ⇒ Object



49
50
51
52
53
54
55
56
57
# File 'lib/ext/themes.rb', line 49

def draw(x1,y1, x2, y2, state)
  if state == 1
    $window.draw_quad(x1, y1, 0xffb22222, x2, y1, 0xffb22222, x1, y2, 0xffb22222, x2, y2, 0xffb22222, ZOrder::Widget) 
    $window.draw_quad(x1+1, y1+1, 0xff6e6e6e, x2-1, y1+1, 0xff6e6e6e, x1+1, y2-1, 0xff6e6e6e, x2-1, y2-1, 0xff6e6e6e, ZOrder::Widget) 
  else
    $window.draw_quad(x1, y1, 0xffb22222, x2, y1, 0xffb22222, x1, y2, 0xffb22222, x2, y2, 0xffb22222, ZOrder::Widget) 
    $window.draw_quad(x1+1, y1+1, 0xff808080, x2-1, y1+1, 0xff808080, x1+1, y2-1, 0xff808080, x2-1, y2-1, 0xff808080, ZOrder::Widget) 
  end
end

#request(obj) ⇒ Object



37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/ext/themes.rb', line 37

def request(obj)
  if @@textbox == nil #Can't initialize atglobal scope because $window may not have been set
    @@textbox = RubygooTextTheme.new
    @@label = RubygooLabelTheme.new
  end
  if obj.kind_of?(TextBox)
    return @@textbox
  elsif obj.kind_of?(Label)
    return @@label
  end
  return self
end