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
|
Based on upstream patch:
http://www.frozen-bubble.org/perl-SDL.patch
This version of the patch works with both sdl-perl-1.x and sdl-perl-2.x
--- c_stuff/lib/FBLE.pm
+++ c_stuff/lib/FBLE.pm
@@ -86,6 +86,25 @@
#- ----------- bubbles processing/drawing -----------------------------------------
+sub surf {
+ my ($surface) = @_;
+ if (ref($surface) eq 'HASH') {
+ return $surface->{-surface};
+ } else {
+ return $$surface;
+ }
+}
+
+sub rect {
+ my ($rect) = @_;
+ if (ref($rect) eq 'HASH') {
+ return $rect->{-rect};
+ } else {
+ return $$rect;
+ }
+}
+
+
# subroutine to calculate the left corner x of the given bubble option column (based on 0 start)
sub bubble_optionx {
my ($col) = @_;
@@ -1094,11 +1113,11 @@
$rect{screenshot} = SDL::Rect->new(-x => $POS_1P{p1}{left_limit} - 40, '-y' => 0,
-width => $POS_1P{p1}{right_limit} - $POS_1P{p1}{left_limit} + 80,
-height => $POS_1P{bottom_limit} - $POS_1P{init_top_limit} + 190);
- fb_c_stuff::shrink($app->{-surface},
- $file_browser_screenshots[$list_browser_highlight_offset]->display_format()->{-surface},
+ fb_c_stuff::shrink(surf($app),
+ surf($file_browser_screenshots[$list_browser_highlight_offset]->display_format()),
$rect{middle}->x + $rect{middle}->width - $rect{screenshot}->width/4 - 12,
$rect{middle}->y + $rect{middle}->height/2 - $rect{screenshot}->height/8 - 3,
- $rect{screenshot}{-rect}, 4);
+ rect($rect{screenshot}), 4);
}
@@ -1366,6 +1366,14 @@
print_dialog_list_arrow($do_highlight, 'up');
}
+sub SDL_TEXTWIDTH {
+ if (defined(&SDL::App::SDL_TEXTWIDTH)) {
+ SDL::App::SDL_TEXTWIDTH(@_); # perl-sdl-1.x
+ } else {
+ SDL::SFont::SDL_TEXTWIDTH(@_); # perl-sdl-2.x
+ }
+}
+
# subroutine to print out the levelset name at the top of the screen
sub print_levelset_name {
$rect{ls_name_erase} = SDL::Rect->new(-x => 195, '-y' => 0, -width => 445-195, -height => 35);
|