The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

SDL::Console - a SDL perl extension

SYNOPSIS

  use SDL::Console;
  
  my $console_rect= new SDL::Rect(
                                  -width =>$app->width, 
                                  -height=>128
                                 );

  my $console = new SDL::Console(
                                 -surface => $app,
                                 -rect  => $console_rect, 
                                 -font  => "ConsoleFont.bmp",
                                 -lines => 100,
                                );

  SDL::Console::addCommand("my_command", \&cmd_func);

  $console->topmost();    # gain focus

  while ($doStuffFlag)
  {
    # do normal event processing
    SDL::Console::event($event);    # pass SDL::Event obj
    $console->draw;                 # blit console
  }


  sub cmd_func
  {
    my $console = shift;  # SDL::Console object 
    my $rawparams= shift; # original command line, not include command
    my @params =@_;       # command line as indiviual args 
                          # (split ' ', $rawparams)

    $console->print("you called me with: $rawparams"); # print to the console
  }

DESCRIPTION

The SDL::Console module encapsulates the SDL_Console library, and many of its ancillatory functions.

new (-surface => $app, ... )

Specifies the surface on which the console will be blitted. This method takes the following additional parameters:

  • -font the font file to use, default: "ConsoleFont.bmp"

  • -lines number of lines in the console, default: 32

  • -rect a SDL::Rect which specifies the console bounding box, default: x=0, y=0, w=surface width, height=25% of surface height

topmost () give this console the keyboard focus.

draw () blit this console to the associated surface

alpha ( $alpha )

set the console alpha component (0-255)

background ( $file, $x,$y)

load a background image

position ( $x, $y)

set the console origin

resize ( SDL::Rect )

resize the console

Event ( SDL::Event )

class method to be called when events are processed.

AddCommand ( $command, sub {} )

class method to add a command to the Consoles repository

list_commands ()

display the registered commands to the console & stdout

AUTHOR

Wayne Keenan

SEE ALSO

        perl(1) SDL::Surface(3) SDL::Rect(3) SDL::App(3) SDL::Event(3).