Games-RolePlay-MapGen

 view release on metacpan or  search on metacpan

META.json  view on Meta::CPAN

      },
      "runtime" : {
         "requires" : {
            "Algorithm::Diff" : 0,
            "Data::Dump" : 0,
            "Data::Dumper" : 0,
            "File::Slurp" : 0,
            "GD" : 0,
            "Gtk2" : 0,
            "Gtk2::Ex::Dialogs" : 0,
            "Gtk2::Ex::Simple::Menu" : 0,
            "HTTP::Status" : 0,
            "List::Util" : 0,
            "Math::Round" : 0,
            "Math::Trig" : 0,
            "Memoize" : 0,
            "POE" : 0,
            "POE::Component::Server::HTTP" : 0,
            "Storable" : 0,
            "Test" : "1.25",
            "Tie::IxHash" : 0,

META.yml  view on Meta::CPAN

    - t
    - inc
requires:
  Algorithm::Diff: 0
  Data::Dump: 0
  Data::Dumper: 0
  File::Slurp: 0
  GD: 0
  Gtk2: 0
  Gtk2::Ex::Dialogs: 0
  Gtk2::Ex::Simple::Menu: 0
  HTTP::Status: 0
  List::Util: 0
  Math::Round: 0
  Math::Trig: 0
  Memoize: 0
  POE: 0
  POE::Component::Server::HTTP: 0
  Storable: 0
  Test: 1.25
  Tie::IxHash: 0

Makefile.PL  view on Meta::CPAN

# }}}
# prompt_more_modules {{{
sub prompt_more_modules {
    my @image_exporters = (
        GD => 0,
    );

    my @editor_prereqs = (
        'Gtk2'                         => 0,
        'Gtk2::Ex::Dialogs'            => 0,
        'Gtk2::Ex::Simple::Menu'       => 0,
        Storable                       => 0,
        'Data::Dump'                   => 0,
        'HTTP::Status'                 => 0,
        POE                            => 0,
        'POE::Component::Server::HTTP' => 0,
        @image_exporters,
    );

    my $res = "y";
    unless( -f "MANIFEST.SKIP" ) {

MapGen/Editor.pm  view on Meta::CPAN

# NOTE: I'm aware this is monolithic and heinous, please don't judge me.  I
# intend to split this up into manageable chunks (aka modules) later.  I'm new
# to GUI code and I'm surprised how big it gets.
#
# -Paul

use common::sense;
use GD;
use Glib qw(TRUE FALSE);
use Gtk2 -init; # -init tells import to ->init() your app
use Gtk2::Ex::Simple::Menu;
use Gtk2::Ex::Dialogs::ErrorMsg;
use Gtk2::Ex::Dialogs::Question;
use Gtk2::Ex::PodViewer;
use Gtk2::SimpleList;
use Games::RolePlay::MapGen;
use File::HomeDir;
use File::Spec;
use DB_File;
use Storable qw(freeze thaw);
use Data::Dump qw(dump);

MapGen/Editor.pm  view on Meta::CPAN

our @GENERATOR_PLUGINS         = (qw( BasicDoors FiveSplit ));
our @DEFAULT_GENERATOR_PLUGINS = (qw( BasicDoors ));
our @FILTERS                   = (qw( BasicDoors FiveSplit ClearDoors ));

use vars qw($x); # like our, but at compile time so these constants work
use constant {
    # the per-object index constants {{{
    MAP       => $x++, # the Games::RolePlay::MapGen object, the actual map arrays are in [MAP]{_the_map}
    MQ        => $x++, # the Games::RolePlay::MapGen::MapQueue object
    WINDOW    => $x++, # the Gtk2 window (Gtk2::Window)
    MENU      => $x++, # the main menubar (Gtk2::Ex::Simple::Menu)
    MAREA     => $x++, # the map area Gtk2::Image
    VP_DIM    => $x++, # the current dimensions (changes on resizes and things) of the Gtk2::Viewport holding the [MAREA]
    SETTINGS  => $x++, # a tied DB_File hashref full of settings
    FNAME     => $x++, # the current file name or undef
    STAT      => $x++, # the statusbar (Gtk2::Statusbar)
    MP        => $x++, # the current map pixbufs, cell size, and pixbuf dimensions
    RCCM      => $x++, # the right click context menus (there are two: [RCCM][0] for tiles and [RCCM][1] for closures)
    O_LT      => $x++, # the tile location currently moused-overed, O_ is for old, during the motion-notify, O_LT is the
                       #  old location and LT is the new one, although, LT isn't a constant
    SEL_S     => $x++, # the selection start, set to O_LT when a button is pressed

MapGen/Editor.pm  view on Meta::CPAN

                },
                _About => {
                    item_type  => '<StockItem>',
                    callback   => sub { $this->about },
                    extra_data => 'gtk-about',
                },
            ],
        },
    ];

    my $menu = $this->[MENU] = Gtk2::Ex::Simple::Menu->new (
        menu_tree        => $menu_tree,
        default_callback => sub { $this->unknown_menu_callback },
    );

    $vbox->pack_start($menu->{widget}, 0,0,0);
    $window->add_accel_group($menu->{accel_group});

    my $marea = $this->[MAREA] = new Gtk2::Image;
    my $scwin = Gtk2::ScrolledWindow->new;
    my $vp    = Gtk2::Viewport->new(undef,undef);

MapGen/Editor.pm  view on Meta::CPAN

                @_
            },
            activate => sub { $this->closure_door_properties(@{$_[1]{result}}) },
        },
    );
}
# }}}
# _build_context_menu {{{
sub _build_context_menu {
    my $this = shift;
    my $menu = new Gtk2::Menu->new;

    @_ = @{$_[0]} if ref $_[0];

    # TODO: this should become a module like _MForm.pm

    my @a;
    while( my($name, $opts) = splice @_, 0, 2 ) {
        my $item = Gtk2::MenuItem->new_with_mnemonic($name);

        push @a, sub { my @r =  $opts->{enable}->(@_); $item->set_sensitive( $r[-1] ? 1 : 0 ); $opts->{result} = \@r; } if $opts->{enable};
        push @a, sub { my @r = $opts->{disable}->(@_); $item->set_sensitive( $r[-1] ? 0 : 1 ); $opts->{result} = \@r; } if $opts->{disable};

        $item->signal_connect( activate => $opts->{activate}, $opts ) if exists $opts->{activate};
        $menu->append( $item );
    }

    $menu->{_a} = \@a;
    $menu->show_all;



( run in 0.601 second using v1.01-cache-2.11-cpan-49f99fa48dc )