/usr/share/perl5/Games/FrozenBubble/CStuff.pm is in frozen-bubble 2.212-7build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | package Games::FrozenBubble::CStuff;
use strict;
use vars qw(@ISA);
use Games::FrozenBubble;
use SDL::Pango;
use SDL::Pango::Context;
use Alien::SDL;
require DynaLoader;
@ISA = qw(DynaLoader);
# Dynaloader dark magic implemented by kmx, this is needed as we are
# using Alien::SDL and required dynamic libraries are saved in Alien::SDL's
# distribution share dir - therefore we need to load them explicitely
# for more details see SDL::Internal::Loader (code stolen from there)
my $shlib_map = Alien::SDL->config('ld_shlib_map');
if($shlib_map) {
foreach my $n (qw(SDL SDL_mixer)) {
my $file = $shlib_map->{$n};
next unless $file;
my $libref = DynaLoader::dl_load_file($file, 0);
push(@DynaLoader::dl_librefs, $libref) if $libref;
}
}
bootstrap Games::FrozenBubble::CStuff $Games::FrozenBubble::VERSION;
sub sdlpango_init{ SDL::Pango::init(); }
sub sdlpango_createcontext{
my $color = shift || '';
my $font_desc = shift;
my $context = SDL::Pango::Context->new($font_desc);
#context, fr, fg, fb, fa, br, bg, bb, ba
if ($color eq "white")
{
SDL::Pango::set_default_color($context, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00)
}
else
{
SDL::Pango::set_default_color($context, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00)
}
return $context;
}
sub sdlpango_getsize{
my $context = shift;
my $text = shift;
my $width = shift;
SDL::Pango::set_minimum_size($context, $width, 0);
SDL::Pango::set_text($context, $text, -1);
my $w = SDL::Pango::get_layout_width($context);
my $h = SDL::Pango::get_layout_height($context);
return [$w, $h];
}
sub sdlpango_draw{ return sdlpango_draw_givenalignment(shift, shift, shift, "left"); }
sub sdlpango_draw_givenalignment{
my $context = shift;
my $text = shift;
my $width = shift;
my $alignment = shift || '';
SDL::Pango::set_minimum_size($context, $width, 0);
SDL::Pango::set_text($context, $text, -1, $alignment eq "left" ? SDLPANGO_ALIGN_LEFT
: $alignment eq "center" ? SDLPANGO_ALIGN_CENTER
: SDLPANGO_ALIGN_RIGHT );
return SDL::Pango::create_surface_draw($context);
}
1;
|