ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/gde/GCE/Util.pm
(Generate patch)

Comparing deliantra/gde/GCE/Util.pm (file contents):
Revision 1.4 by elmex, Sun Mar 12 23:32:58 2006 UTC vs.
Revision 1.5 by elmex, Thu Mar 16 11:59:34 2006 UTC

16use List::Util qw(min max); 16use List::Util qw(min max);
17 17
18use Crossfire; 18use Crossfire;
19use Crossfire::MapWidget; 19use Crossfire::MapWidget;
20 20
21our @EXPORT = qw(insert_arch_stack_layer replace_arch_stack_layer new_arch_pb fill_pb_from_arch arch_is_floor stack_find_floor stack_find_wall stack_find arch_is_wall arch_is_monster add_table_widget); 21our @EXPORT = qw(insert_arch_stack_layer replace_arch_stack_layer new_arch_pb fill_pb_from_arch arch_is_floor stack_find_floor stack_find_wall stack_find arch_is_wall arch_is_monster add_table_widget quick_msg def);
22
23sub def($$) {
24 return defined ($_[0]) ? $_[0] : $_[1];
25}
26
27sub quick_msg {
28 my $wid = shift;
29 my $msg;
30 my $win = $::MAINWIN;
31 if (ref $wid) {
32 $win = $wid;
33 $msg = shift;
34 } else {
35 $msg = $wid;
36 }
37 my $dia = Gtk2::Dialog->new ('Message', $win, 'destroy-with-parent', 'gtk-ok' => 'none');
38
39 my $lbl = Gtk2::Label->new ($msg);
40 $dia->vbox->add ($lbl);
41 $dia->signal_connect (response => sub { $_[0]->destroy });
42
43 unless (defined $_[0]) {
44 Glib::Timeout->add (1000, sub { $dia->destroy; 0 });
45 }
46
47 $dia->show_all;
48}
22 49
23sub new_arch_pb { 50sub new_arch_pb {
24 # this is awful, is this really the best way? 51 # this is awful, is this really the best way?
25 my $pb = new Gtk2::Gdk::Pixbuf 'rgb', 1, 8, TILESIZE, TILESIZE; 52 my $pb = new Gtk2::Gdk::Pixbuf 'rgb', 1, 8, TILESIZE, TILESIZE;
26 return $pb; 53 return $pb;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines