Games-Irrlicht

 view release on metacpan or  search on metacpan

lib/Games/Irrlicht.pm  view on Meta::CPAN

  {
  my ($self,$w,$h) = @_;

  # can resize?
  return if $self->{_app}->{options}->{resizeable} == 0;

  my $app = $self->{_app};
  
  # XXX TODO: 
  # resize
  $app->{app}->resize($w,$h);
  # cache new size
  $app->{width} = $app->{app}->width();
  $app->{height} = $app->{app}->height();
  }

sub _resized
  {
  # called when the app was resized
  my ($self,$handler,$event) = @_;

  my $app = $self->{_app};
  my $opt = $app->{options};

  $app->{app}->resize($app->{width},$app->{height});

 # # register new height/widht with all our 2D fonts 
 # foreach my $font (@{$app->{fonts}})
 #   {
 #   $font->screen_width($app->{width});
 #   $font->screen_height($app->{height});
 #   }
 # if ($opt->{useconsole})
 #   {
 ##   $app->{console}->screen_width($app->{width});
 #   $app->{console}->screen_height($app->{height});
 #   }

  $self->resize_handler();
  }

sub width
  {
  my $self = shift;

  $self->{_app}->{width};
  }

sub height
  {
  my $self = shift;
  $self->{_app}->{height};
  }

sub depth
  {
  my $self = shift;
  $self->{_app}->{depth};
  }

#sub update
#  {
#  my $self = shift;
#  $self->{_app}->{app}->update(@_);
#  }

#sub app
#  {
#  my $self = shift;
#  $self->{_app}->{app};
#  }

sub in_fullscreen
  {
  # returns true for in fullscreen, false for in window
  my $self = shift;

  $self->{_app}->{in_fullscreen};
  }

sub fullscreen
  {
  # toggle the application into and out of fullscreen
  # if given an argument, and this is true, switches to fullscreen
  # if given an argument, and this is fals, switches to windowed
  # returns true for in fullscreen, false for in window
  my $self = shift;

  my $app = $self->{_app};
  if (@_ > 0)
    {
    my $t = shift || 0; $t = 1 if $t != 0;
    return $app->{in_fullscreen} if ($t == $app->{in_fullscreen});
    }
  $app->{in_fullscreen} = 1 - $app->{in_fullscreen};	# toggle
 # XXX TODO
#  $app->{app}->fullscreen();				# switch
  $app->{in_fullscreen};
  }

##############################################################################

sub add_group
  {
  my ($self) = @_;

  Games::Irrlicht::Group->new($self);
  }

##############################################################################

sub _deactivated_thing
  {
  # When a thing (timer, event handler, button etc) is deactivated, it
  # notifies the app by calling this routine with itself as argument
  my ($self,$thing) = @_;

  # do nothing for timers and buttons yet
  return unless ref($thing) && $thing->isa('SDL::App::FPS::EventHandler');

  # remove it from the group of handlers that will be checked, it will



( run in 0.782 second using v1.01-cache-2.11-cpan-5c0b1e786e0 )