Merge games and plugins.
[kaya.git] / lib / ext / loader.rb
blobe60683caebb26bafa6749d47324ae908731ab12a
1 begin
2   require 'ext/extensions'
3 rescue LoadError => e
4   warn "ERROR: could not load extension library, some features may be missing"
5   warn e.message
6 end
8 $ext = $qApp.findChild(Qt::Object, "kaya extensions") if $qApp
9 fake = unless $ext
10   # install fake implementations of the extension functions
11   warn "Creating fake extension library"
12   $ext = Qt::Object.new
13   class << $ext
14     def exp_blur(img, radius)
15     end
16   end
17   true
18 end
19 $ext.metaclass_eval do
20   define_method(:fake) { fake }
21 end
23 # conveniently install extension functions in the appropriate places
25 class Qt::Image
26   def exp_blur(radius)
27     $ext.exp_blur(self, radius)
28   end
29 end