| 1 | package Ogre::BetaGUI::Callback; | ||
| 2 | |||
| 3 | ### Note: this was ported to Perl from: | ||
| 4 | # /// Betajaen's GUI 016 Uncompressed | ||
| 5 | # /// Written by Robin "Betajaen" Southern 07-Nov-2006, http://www.ogre3d.org/wiki/index.php/BetaGUI | ||
| 6 | # /// This code is under the Whatevar! licence. Do what you want; but keep the original copyright header. | ||
| 7 | ### | ||
| 8 | |||
| 9 | use strict; | ||
| 10 | use warnings; | ||
| 11 | use Scalar::Util qw(blessed); | ||
| 12 | |||
| 13 | use Ogre 0.33; | ||
| 14 | |||
| 15 | |||
| 16 | sub new { | ||
| 17 | my ($pkg, $arg) = @_; | ||
| 18 | |||
| 19 | my $self = bless { | ||
| 20 | t => 0, | ||
| 21 | fp => undef, | ||
| 22 | LS => undef, | ||
| 23 | }, $pkg; | ||
| 24 | |||
| 25 | if (defined $arg) { | ||
| 26 | # this code ref has to accept two args (see BetaGUIListener onButtonPress) | ||
| 27 | if (ref($arg) eq 'CODE') { | ||
| 28 | $self->{t} = 1; | ||
| 29 | $self->{fp} = $arg; | ||
| 30 | } | ||
| 31 | elsif (blessed($arg) && $arg->isa('Ogre::BetaGUI::BetaGUIListener')) { | ||
| 32 | $self->{t} = 2; | ||
| 33 | $self->{LS} = $arg; | ||
| 34 | } | ||
| 35 | } | ||
| 36 | |||
| 37 | return $self; | ||
| 38 | } | ||
| 39 | |||
| 40 | |||
| 41 | 1; |