Deliantra-Client
view release on metacpan or search on metacpan
};
for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ-- > const_iv; )
newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv));
assert (SDLK_MODIFIER_MIN == SDLK_NUMLOCK);
assert (SDLK_MODIFIER_MAX == SDLK_COMPOSE);
}
void
weaken (SV *rv)
PROTOTYPE: $
CODE:
sv_rvweaken (rv);
int
in_destruct ()
CODE:
RETVAL = PL_main_cv == Nullcv;
OUTPUT:
RETVAL
NV floor (NV x)
$w->show;
}
my $bg_cursed = [1 , 0 , 0, 0.5];
my $bg_magic = [0.2, 0.2, 1, 0.5];
sub update_widgets {
my ($self) = @_;
# necessary to avoid cyclic references
DC::weaken $self;
my $button_cb = sub {
my (undef, $ev, $x, $y) = @_;
my $targ = $::CONN->{player}{tag};
if ($self->{container} == $::CONN->{player}{tag}) {
$targ = $::CONN->{open_container};
}
DC/Protocol.pm view on Meta::CPAN
y => 'center',
name => "npc_dialog",
force_w => $::WIDTH * 0.7,
force_h => $::HEIGHT * 0.7,
title => "NPC Dialog",
kw => { hi => 0, yes => 0, no => 0 },
has_close_button => 1,
@_,
);
DC::weaken (my $this = $self);
$self->connect (delete => sub { $this->destroy; 1 });
# better use a pane...
$self->add (my $hbox = new DC::UI::HBox);
$hbox->add ($self->{textview} = new DC::UI::TextScroller expand => 1);
$hbox->add (my $vbox = new DC::UI::VBox);
$vbox->add (new DC::UI::Label text => "Message Entry:");
DC/Protocol.pm view on Meta::CPAN
markup => "<small>[starting conversation with <b>$self->{title}</b>]</small>\n\n",
});
$self->show;
$self
};
sub update_options {
my ($self) = @_;
DC::weaken $self;
$self->{options}->clear;
$self->{options}->add ($self->{bye_button});
for my $kw (sort keys %{ $self->{kw} }) {
$self->{options}->add (new DC::UI::Button
text => $kw,
on_activate => sub {
$self->send ($kw);
0
},
);
}
}
sub feed {
my ($self, $type, @arg) = @_;
DC::weaken $self;
if ($type eq "update") {
my (%info) = @arg;
$self->{kw}{$_} = 1 for @{$info{add_topics} || []};
$self->{kw}{$_} = 0 for @{$info{del_topics} || []};
if (exists $info{msg}) {
my $text = "\n" . DC::Protocol::sanitise_xml $info{msg};
my $match = join "|", map "\\b\Q$_\E\\b", sort { (length $b) <=> (length $a) } keys %{ $self->{kw} };
DC/Texture.pm view on Meta::CPAN
sub new {
my ($class, %data) = @_;
my $self = bless {
internalformat => GL_RGBA,
format => GL_RGBA,
type => GL_UNSIGNED_BYTE,
%data,
}, $class;
DC::weaken ($TEXTURES{$self+0} = $self);
$self->upload
unless delete $self->{delay};
$self
}
sub new_from_image {
my ($class, $image, %arg) = @_;
my $self = bless {
x => "center",
y => "center",
z => 0,
w => undef,
h => undef,
can_events => 1,
@_
}, $class;
DC::weaken ($DC::UI::WIDGET{$self+0} = $self);
for (keys %$self) {
if (/^on_(.*)$/) {
$self->connect ($1 => delete $self->{$_});
}
}
if (my $layout = $DC::UI::LAYOUT->{$self->{name}}) {
$self->{x} = $layout->{x} * $DC::UI::ROOT->{alloc_w} if exists $layout->{x};
$self->{y} = $layout->{y} * $DC::UI::ROOT->{alloc_h} if exists $layout->{y};
# parent
$self->{parent} && $self->{parent}->emit ($signal, @args)
}
#sub find_widget {
# in .xs
sub set_parent {
my ($self, $parent) = @_;
DC::weaken ($self->{parent} = $parent);
$self->set_visible if $parent->{visible};
}
sub realloc {
my ($self) = @_;
if ($self->{visible}) {
return if $self->{root}{realloc}{$self+0};
$self->{root}{realloc}{$self+0} = $self;
scale => 1,
@_,
);
$self->{path} || $self->{tex}
or Carp::croak "'path' or 'tex' attributes required";
$self->{tex} ||= $texture_cache{$self->{path}} ||=
new_from_resource DC::Texture $self->{path}, mipmap => 1;
DC::weaken $texture_cache{$self->{path}};
$self->{aspect} ||= $self->{tex}{w} / $self->{tex}{h};
$self
}
sub STORABLE_freeze {
my ($self, $cloning) = @_;
$self->{path}
}
}
}
}
}
sub update_anim {
my ($self) = @_;
if ($self->{anim} && $self->{animspeed}) {
DC::weaken (my $widget = $self);
$self->{animspeed} = List::Util::max 0.05, $self->{animspeed};
$self->{timer} = EV::periodic_ns 0, $self->{animspeed}, undef, sub {
return unless $::CONN;
my $w = $widget
or return;
++$w->{frame};
$w->update_face;
multiplexer => (new DC::UI::Multiplexer expand => 1),
active_outline => [.7, .7, 0.2],
# filter => # will be put between multiplexer and $self
@_,
);
$self->{filter}->add ($self->{multiplexer}) if $self->{filter};
$self->SUPER::add ($self->{buttonbar}, $self->{filter} || $self->{multiplexer});
{
Scalar::Util::weaken (my $wself = $self);
$self->{multiplexer}->connect (c_add => sub {
my ($mplex, $widgets) = @_;
for my $child (@$widgets) {
Scalar::Util::weaken $child;
$child->{c_tab_} ||= do {
my $tab =
(UNIVERSAL::isa $child->{c_tab}, "DC::UI::Base")
? $child->{c_tab}
: new DC::UI::Button markup => $child->{c_tab}[0], tooltip => $child->{c_tab}[1];
$tab->connect (activate => sub {
$wself->set_current_page ($child);
});
our @ISA = DC::UI::VBox::;
sub new {
my $class = shift;
my $self = $class->SUPER::new (
fontsize => 0.8,
@_,
);
DC::weaken (my $this = $self);
$self->{timer} = EV::timer 1, 1, sub { $this->reorder };
$self
}
sub reorder {
my ($self) = @_;
my $NOW = EV::time;
use DC::OpenGL;
sub new {
my $class = shift;
my $self = $class->SUPER::new (
visible => 1,
@_,
);
DC::weaken ($self->{root} = $self);
$self
}
sub size_request {
my ($self) = @_;
($self->{w}, $self->{h})
}
DC/UI/Dockable.pm view on Meta::CPAN
$self->{inactive_fg} = $fg;
$self->update_tab;
}
# (private) This method is used by the Dockbar to tell the Dockable which
# Dockbar it belongs to. Do not call this method yourself, use the dockbars
# add_dock and remove_dock methods instead.
sub set_dockbar {
my ($self, $dockbar) = @_;
$self->{dockbar} = $dockbar;
Scalar::Util::weaken $self->{dockbar};
}
# This method is called when someone wants to 'activate' the dockable,
# the meaning of being 'activated' is given by subclasses that inherit
# from Dockable. Eg. In ChatView the 'activation' means that the entry field
# of for chat is activated for input.
sub activate {
my ($self) = @_;
$self->emit ("activate");
}
( run in 0.359 second using v1.01-cache-2.11-cpan-65fba6d93b7 )