Class: Roglew::Gdi32::PIXELFORMATDESCRIPTOR
- Inherits:
-
FFI::Struct
- Object
- FFI::Struct
- Roglew::Gdi32::PIXELFORMATDESCRIPTOR
- Defined in:
- lib/roglew/platform/windows/gdi32.rb
Constant Summary collapse
- FLAGS_INV =
PFDFlags.to_hash.reduce(Hash.new{ |h,k| h[k] = [] }){ |h,(k,v)| h[v] << k; h }.freeze
Instance Method Summary collapse
- #dwFlags ⇒ Object
- #dwFlags=(flags) ⇒ Object
-
#initialize ⇒ PIXELFORMATDESCRIPTOR
constructor
undef_method :nSize=.
- #to_s ⇒ Object
Methods inherited from FFI::Struct
Constructor Details
#initialize ⇒ PIXELFORMATDESCRIPTOR
undef_method :nSize=
150 151 152 153 |
# File 'lib/roglew/platform/windows/gdi32.rb', line 150 def initialize super self[:nSize] = self.size end |
Instance Method Details
#dwFlags ⇒ Object
155 156 157 158 |
# File 'lib/roglew/platform/windows/gdi32.rb', line 155 def dwFlags val = self[:dwFlags] Set.new(FLAGS_INV.select { |k,_| val & k != 0 }.reduce([]) {|a,(_,v)| a << v}.flatten) end |
#dwFlags=(flags) ⇒ Object
160 161 162 |
# File 'lib/roglew/platform/windows/gdi32.rb', line 160 def dwFlags=(flags) self[:dwFlags] = [*flags].reduce(0) {|a,f| a | PFDFlags[f].to_i} end |
#to_s ⇒ Object
164 165 166 |
# File 'lib/roglew/platform/windows/gdi32.rb', line 164 def to_s [:iPixelType, :cColorBits, :cAccumBits, :cDepthBits, :iLayerType, :dwFlags].map{|n| "#{n} = #{send(n).inspect}"}.join(', ') end |