Class: GGLib::Themes::RubygooTheme

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

Overview

RUBYGOO THEME                             #

++

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.



113
114
115
116
117
118
119
120
121
122
# File 'lib/ext/themes.rb', line 113

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



135
136
137
138
139
140
141
142
143
# File 'lib/ext/themes.rb', line 135

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



123
124
125
126
127
128
129
130
131
132
133
134
# File 'lib/ext/themes.rb', line 123

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