ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/Deliantra-Client/DC/UI.pm
(Generate patch)

Comparing deliantra/Deliantra-Client/DC/UI.pm (file contents):
Revision 1.260 by elmex, Tue May 30 14:35:09 2006 UTC vs.
Revision 1.265 by root, Thu Jun 1 02:59:46 2006 UTC

1522} 1522}
1523 1523
1524sub size_allocate { 1524sub size_allocate {
1525 my ($self, $w, $h) = @_; 1525 my ($self, $w, $h) = @_;
1526 1526
1527 delete $self->{texture}; 1527 delete $self->{texture}
1528 ;#d#
1528} 1529}
1529 1530
1530sub set_fontsize { 1531sub set_fontsize {
1531 my ($self, $fontsize) = @_; 1532 my ($self, $fontsize) = @_;
1532 1533
2776 2777
2777 $self->{timer}->cancel 2778 $self->{timer}->cancel
2778 if $self->{timer}; 2779 if $self->{timer};
2779 2780
2780 $self->SUPER::DESTROY; 2781 $self->SUPER::DESTROY;
2781}
2782
2783#############################################################################
2784
2785package CFClient::UI::Inventory;
2786
2787our @ISA = CFClient::UI::ScrolledWindow::;
2788
2789sub new {
2790 my $class = shift;
2791
2792 my $self = $class->SUPER::new (
2793 scrolled => (new CFClient::UI::Table col_expand => [0, 1, 0]),
2794 @_,
2795 );
2796
2797 $self
2798}
2799
2800sub set_items {
2801 my ($self, $items) = @_;
2802
2803 $self->{scrolled}->clear;
2804 return unless $items;
2805
2806 my @items = sort {
2807 ($a->{type} <=> $b->{type})
2808 or ($a->{name} cmp $b->{name})
2809 } @$items;
2810
2811 $self->{real_items} = \@items;
2812
2813 my $row = 0;
2814 for my $item (@items) {
2815 CFClient::Item::update_widgets $item;
2816
2817 $self->{scrolled}->add (0, $row, $item->{face_widget});
2818 $self->{scrolled}->add (1, $row, $item->{desc_widget});
2819 $self->{scrolled}->add (2, $row, $item->{weight_widget});
2820
2821 $row++;
2822 }
2823} 2782}
2824 2783
2825############################################################################# 2784#############################################################################
2826 2785
2827package CFClient::UI::Menu; 2786package CFClient::UI::Menu;
3004 $self->SUPER::reconfigure; 2963 $self->SUPER::reconfigure;
3005} 2964}
3006 2965
3007############################################################################# 2966#############################################################################
3008 2967
3009package CFClient::UI::Root; 2968package CFClient::UI::Inventory;
3010 2969
3011our @ISA = CFClient::UI::Container::; 2970our @ISA = CFClient::UI::ScrolledWindow::;
3012
3013use CFClient::OpenGL;
3014 2971
3015sub new { 2972sub new {
3016 my $class = shift; 2973 my $class = shift;
3017 2974
3018 my $self = $class->SUPER::new ( 2975 my $self = $class->SUPER::new (
3019 visible => 1, 2976 scrolled => (new CFClient::UI::Table col_expand => [0, 1, 0]),
3020 @_, 2977 @_,
3021 ); 2978 );
3022 2979
3023 Scalar::Util::weaken ($self->{root} = $self);
3024
3025 $self 2980 $self
3026} 2981}
3027 2982
3028sub size_request { 2983sub set_items {
3029 my ($self) = @_; 2984 my ($self, $items) = @_;
3030 2985
3031 ($self->{w}, $self->{h}) 2986 $self->{scrolled}->clear;
3032} 2987 return unless $items;
3033 2988
3034sub _to_pixel { 2989 my @items = sort {
3035 my ($coord, $size, $max) = @_; 2990 ($a->{type} <=> $b->{type})
2991 or ($a->{name} cmp $b->{name})
2992 } @$items;
3036 2993
3037 $coord = 2994 $self->{real_items} = \@items;
3038 $coord eq "center" ? ($max - $size) * 0.5
3039 : $coord eq "max" ? $max
3040 : $coord;
3041 2995
3042 $coord = 0 if $coord < 0; 2996 my $row = 0;
3043 $coord = $max - $size if $coord > $max - $size; 2997 for my $item (@items) {
2998 CFClient::Item::update_widgets $item;
3044 2999
3045 int $coord + 0.5 3000 $self->{scrolled}->add (0, $row, $item->{face_widget});
3046} 3001 $self->{scrolled}->add (1, $row, $item->{desc_widget});
3002 $self->{scrolled}->add (2, $row, $item->{weight_widget});
3047 3003
3048sub size_allocate { 3004 $row++;
3049 my ($self, $w, $h) = @_;
3050
3051 for my $child ($self->children) {
3052 my ($X, $Y, $W, $H) = @$child{qw(x y req_w req_h)};
3053
3054 $X = $child->{force_x} if exists $child->{force_x};
3055 $Y = $child->{force_y} if exists $child->{force_y};
3056
3057 $X = _to_pixel $X, $W, $self->{w};
3058 $Y = _to_pixel $Y, $H, $self->{h};
3059
3060 $child->configure ($X, $Y, $W, $H);
3061 } 3005 }
3062}
3063
3064sub coord2local {
3065 my ($self, $x, $y) = @_;
3066
3067 ($x, $y)
3068}
3069
3070sub coord2global {
3071 my ($self, $x, $y) = @_;
3072
3073 ($x, $y)
3074}
3075
3076sub update {
3077 my ($self) = @_;
3078
3079 $::WANT_REFRESH++;
3080}
3081
3082sub add {
3083 my ($self, @children) = @_;
3084
3085 $_->{is_toplevel} = 1
3086 for @children;
3087
3088 $self->SUPER::add (@children);
3089}
3090
3091sub remove {
3092 my ($self, @children) = @_;
3093
3094 $self->SUPER::remove (@children);
3095
3096 delete $self->{is_toplevel}
3097 for @children;
3098
3099 while (@children) {
3100 my $w = pop @children;
3101 push @children, $w->children;
3102 $w->set_invisible;
3103 }
3104}
3105
3106sub on_refresh {
3107 my ($self, $id, $cb) = @_;
3108
3109 $self->{refresh_hook}{$id} = $cb;
3110}
3111
3112sub on_post_alloc {
3113 my ($self, $id, $cb) = @_;
3114
3115 $self->{post_alloc_hook}{$id} = $cb;
3116}
3117
3118sub draw {
3119 my ($self) = @_;
3120
3121 while ($self->{refresh_hook}) {
3122 $_->()
3123 for values %{delete $self->{refresh_hook}};
3124 }
3125
3126 if ($self->{realloc}) {
3127 my @queue;
3128
3129 while () {
3130 if ($self->{realloc}) {
3131 #TODO use array-of-depth approach
3132
3133 use sort 'stable';
3134
3135 @queue = sort { $a->{visible} <=> $b->{visible} }
3136 @queue, values %{delete $self->{realloc}};
3137 }
3138
3139 my $widget = pop @queue || last;
3140
3141 $widget->{visible} or last; # do not resize invisible widgets
3142
3143 my ($w, $h) = $widget->size_request;
3144
3145 $w = List::Util::max $widget->{min_w}, $w + $widget->{padding_x} * 2;
3146 $h = List::Util::max $widget->{min_h}, $h + $widget->{padding_y} * 2;
3147
3148 $w = $widget->{force_w} if exists $widget->{force_w};
3149 $h = $widget->{force_h} if exists $widget->{force_h};
3150
3151 if ($widget->{req_w} != $w || $widget->{req_h} != $h
3152 || delete $widget->{force_realloc}) {
3153 $widget->{req_w} = $w;
3154 $widget->{req_h} = $h;
3155
3156 $self->{size_alloc}{$widget+0} = $widget;
3157
3158 if (my $parent = $widget->{parent}) {
3159 $self->{realloc}{$parent+0} = $parent;
3160 #unshift @queue, $parent;
3161 $parent->{force_size_alloc} = 1;
3162 $self->{size_alloc}{$parent+0} = $parent;
3163 }
3164 }
3165
3166 delete $self->{realloc}{$widget+0};
3167 }
3168 }
3169
3170 while (my $size_alloc = delete $self->{size_alloc}) {
3171 my @queue = sort { $b->{visible} <=> $a->{visible} }
3172 values %$size_alloc;
3173
3174 while () {
3175 my $widget = pop @queue || last;
3176
3177 my ($w, $h) = @$widget{qw(alloc_w alloc_h)};
3178
3179 $w = 0 if $w < 0;
3180 $h = 0 if $h < 0;
3181
3182 $w = int $w + 0.5;
3183 $h = int $h + 0.5;
3184
3185 if ($widget->{w} != $w || $widget->{h} != $h || delete $widget->{force_size_alloc}) {
3186 $widget->{w} = $w;
3187 $widget->{h} = $h;
3188
3189 $widget->emit (size_allocate => $w, $h);
3190 }
3191 }
3192 }
3193
3194 while ($self->{post_alloc_hook}) {
3195 $_->()
3196 for values %{delete $self->{post_alloc_hook}};
3197 }
3198
3199
3200 glViewport 0, 0, $::WIDTH, $::HEIGHT;
3201 glClearColor +($::CFG->{fow_intensity}) x 3, 1;
3202 glClear GL_COLOR_BUFFER_BIT;
3203
3204 glMatrixMode GL_PROJECTION;
3205 glLoadIdentity;
3206 glOrtho 0, $::WIDTH, $::HEIGHT, 0, -10000, 10000;
3207 glMatrixMode GL_MODELVIEW;
3208 glLoadIdentity;
3209
3210 $self->_draw;
3211} 3006}
3212 3007
3213############################################################################# 3008#############################################################################
3214 3009
3215package CFClient::UI::BindEditor; 3010package CFClient::UI::BindEditor;
3221 3016
3222 my $self = $class->SUPER::new (binding => [], commands => [], @_); 3017 my $self = $class->SUPER::new (binding => [], commands => [], @_);
3223 3018
3224 $self->add (my $vb = new CFClient::UI::VBox); 3019 $self->add (my $vb = new CFClient::UI::VBox);
3225 3020
3226 $vb->add (my $hb = new CFClient::UI::HBox);
3227 $hb->add (new CFClient::UI::Label text => "Key: ");
3228 $hb->add ($self->{keylbl} = new CFClient::UI::Label);
3229 $hb->add (new CFClient::UI::Button
3230 text => "bind",
3231 tooltip => "This opens a query where you have to press the key combination to bind the recorded actions",
3232 on_activate => sub {
3233 $self->ask_for_bind;
3234 });
3235 3021
3236 $vb->add (new CFClient::UI::Label text => "Actions:");
3237 $vb->add ($self->{rec_btn} = new CFClient::UI::Button 3022 $vb->add ($self->{rec_btn} = new CFClient::UI::Button
3238 text => "start recording", 3023 text => "start recording",
3239 tooltip => "Start/Stops recording of actions." 3024 tooltip => "Start/Stops recording of actions."
3240 ."All subsequent actions after the recording started will be captured." 3025 ."All subsequent actions after the recording started will be captured."
3241 ."The actions are displayed after the record was stopped." 3026 ."The actions are displayed after the record was stopped."
3246 } else { 3031 } else {
3247 $self->stop; 3032 $self->stop;
3248 } 3033 }
3249 }); 3034 });
3250 3035
3036 $vb->add (new CFClient::UI::Label text => "Actions:");
3251 $vb->add ($self->{cmdbox} = new CFClient::UI::VBox); 3037 $vb->add ($self->{cmdbox} = new CFClient::UI::VBox);
3038
3039 $vb->add (new CFClient::UI::Label text => "Bound to: ");
3040 $vb->add (my $hb = new CFClient::UI::HBox);
3041 $hb->add ($self->{keylbl} = new CFClient::UI::Label expand => 1);
3042 $hb->add (new CFClient::UI::Button
3043 text => "bind",
3044 tooltip => "This opens a query where you have to press the key combination to bind the recorded actions",
3045 on_activate => sub {
3046 $self->ask_for_bind;
3047 });
3252 3048
3253 $vb->add (my $hb = new CFClient::UI::HBox); 3049 $vb->add (my $hb = new CFClient::UI::HBox);
3254 $hb->add (new CFClient::UI::Button 3050 $hb->add (new CFClient::UI::Button
3255 text => "ok", 3051 text => "ok",
3052 expand => 1,
3256 tooltip => "This closes the binding editor and saves the binding", 3053 tooltip => "This closes the binding editor and saves the binding",
3257 on_activate => sub { 3054 on_activate => sub {
3258 $self->hide; 3055 $self->hide;
3259 $self->commit; 3056 $self->commit;
3260 }); 3057 });
3261 3058
3262 $hb->add (new CFClient::UI::Button 3059 $hb->add (new CFClient::UI::Button
3263 text => "cancel", 3060 text => "cancel",
3061 expand => 1,
3264 tooltip => "This closes the binding editor without saving", 3062 tooltip => "This closes the binding editor without saving",
3265 on_activate => sub { 3063 on_activate => sub {
3266 $self->hide; 3064 $self->hide;
3267 $self->{binding_cancel}->() 3065 $self->{binding_cancel}->()
3268 if $self->{binding_cancel}; 3066 if $self->{binding_cancel};
3280 $::STATUSBOX->add ("Bound actions to '".CFClient::Binder::keycombo_to_name ($mod, $sym) 3078 $::STATUSBOX->add ("Bound actions to '".CFClient::Binder::keycombo_to_name ($mod, $sym)
3281 ."'. Don't forget 'Save Config'!"); 3079 ."'. Don't forget 'Save Config'!");
3282 $self->{binding_change}->($mod, $sym, $cmds) 3080 $self->{binding_change}->($mod, $sym, $cmds)
3283 if $self->{binding_change}; 3081 if $self->{binding_change};
3284 } else { 3082 } else {
3285 $::STATUSBOX->add ("No action bound, no keys specified!"); 3083 $::STATUSBOX->add ("No action bound, no key or action specified!");
3286 $self->{binding_cancel}->() 3084 $self->{binding_cancel}->()
3287 if $self->{binding_cancel}; 3085 if $self->{binding_cancel};
3288 } 3086 }
3289} 3087}
3290 3088
3307 $rec = $::CONN->stop_record if $::CONN; 3105 $rec = $::CONN->stop_record if $::CONN;
3308 return unless ref $rec eq 'ARRAY'; 3106 return unless ref $rec eq 'ARRAY';
3309 $self->set_command_list ($rec); 3107 $self->set_command_list ($rec);
3310} 3108}
3311 3109
3110# if $commit is true, the binding will be set after the user entered a key combo
3312sub ask_for_bind { 3111sub ask_for_bind {
3313 my ($self, $commit) = @_; 3112 my ($self, $commit) = @_;
3314 3113
3315 CFClient::Binder::open_binding_dialog (sub { 3114 CFClient::Binder::open_binding_dialog (sub {
3316 my ($mod, $sym) = @_; 3115 my ($mod, $sym) = @_;
3318 $self->update_binding_widgets; 3117 $self->update_binding_widgets;
3319 $self->commit if $commit; 3118 $self->commit if $commit;
3320 }); 3119 });
3321} 3120}
3322 3121
3122# $mod and $sym are the modifiers and key symbol
3123# $cmds is a array ref of strings (the commands)
3124# $cb is the callback that is executed on OK
3125# $ccb is the callback that is executed on CANCEL and
3126# when the binding was unsuccessful on OK
3323sub set_binding { 3127sub set_binding {
3324 my ($self, $mod, $sym, $cmds, $cb, $ccb) = @_; 3128 my ($self, $mod, $sym, $cmds, $cb, $ccb) = @_;
3325 3129
3326 $self->clear_command_list; 3130 $self->clear_command_list;
3327 $self->{recording} = 0; 3131 $self->{recording} = 0;
3332 3136
3333 $self->{binding_change} = $cb; 3137 $self->{binding_change} = $cb;
3334 $self->{binding_cancel} = $ccb; 3138 $self->{binding_cancel} = $ccb;
3335 3139
3336 $self->update_binding_widgets; 3140 $self->update_binding_widgets;
3141}
3142
3143# this is a shortcut method that asks for a binding
3144# and then just binds it.
3145sub do_quick_binding {
3146 my ($self, $cmds) = @_;
3147 $self->set_binding (undef, undef, $cmds, sub {
3148 $::CFG->{bindings}->{$_[0]}->{$_[1]} = $_[2];
3149 });
3150 $self->ask_for_bind (1);
3337} 3151}
3338 3152
3339sub update_binding_widgets { 3153sub update_binding_widgets {
3340 my ($self) = @_; 3154 my ($self) = @_;
3341 my ($mod, $sym, $cmds) = $self->get_binding; 3155 my ($mod, $sym, $cmds) = $self->get_binding;
3367 3181
3368 for (@$cmds) { 3182 for (@$cmds) {
3369 $self->{cmdbox}->add (my $hb = new CFClient::UI::HBox); 3183 $self->{cmdbox}->add (my $hb = new CFClient::UI::HBox);
3370 3184
3371 my $i = $idx; 3185 my $i = $idx;
3186 $hb->add (new CFClient::UI::Label text => $_);
3372 $hb->add (new CFClient::UI::Button 3187 $hb->add (new CFClient::UI::Button
3373 text => "delete", 3188 text => "delete",
3374 tooltip => "Deletes the action from the record", 3189 tooltip => "Deletes the action from the record",
3375 on_activate => sub { 3190 on_activate => sub {
3376 $self->{cmdbox}->remove ($hb); 3191 $self->{cmdbox}->remove ($hb);
3377 $cmds->[$i] = undef; 3192 $cmds->[$i] = undef;
3378 }); 3193 });
3379 3194
3380 $hb->add (new CFClient::UI::Label text => $_);
3381 3195
3382 $idx++ 3196 $idx++
3383 } 3197 }
3384} 3198}
3385 3199
3200#############################################################################
3201
3202package CFClient::UI::SpellList;
3203
3204our @ISA = CFClient::UI::FancyFrame::;
3205
3206sub new {
3207 my $class = shift;
3208
3209 my $self = $class->SUPER::new (binding => [], commands => [], @_);
3210
3211 $self->add (new CFClient::UI::ScrolledWindow
3212 scrolled => $self->{spellbox} = new CFClient::UI::Table);
3213
3214 $self;
3215}
3216
3217# XXX: Do sorting? Argl...
3218sub add_spell {
3219 my ($self, $spell) = @_;
3220 $self->{spells}->{$spell->{name}} = $spell;
3221
3222 $self->{spellbox}->add (0, $self->{tbl_idx}, new CFClient::UI::Face
3223 face => $spell->{face},
3224 can_hover => 1,
3225 can_events => 1,
3226 tooltip => $spell->{message});
3227
3228 $self->{spellbox}->add (1, $self->{tbl_idx}, new CFClient::UI::Label
3229 text => $spell->{name},
3230 can_hover => 1,
3231 can_events => 1,
3232 tooltip => $spell->{message},
3233 expand => 1);
3234
3235 $self->{spellbox}->add (2, $self->{tbl_idx}, new CFClient::UI::Label
3236 text => (sprintf "lvl: %2d sp: %2d dmg: %2d",
3237 $spell->{level}, ($spell->{mana} || $spell->{grace}), $spell->{damage}),
3238 expand => 1);
3239
3240 $self->{spellbox}->add (3, $self->{tbl_idx}++, new CFClient::UI::Button
3241 text => "bind to key",
3242 on_activate => sub { $::BIND_EDITOR->do_quick_binding (["cast $spell->{name}"]) });
3243}
3244
3245sub rebuild_spell_list {
3246 my ($self) = @_;
3247 $self->{tbl_idx} = 0;
3248 $self->add_spell ($_) for values %{$self->{spells}};
3249}
3250
3251sub remove_spell {
3252 my ($self, $spell) = @_;
3253 delete $self->{spells}->{$spell->{name}};
3254 $self->rebuild_spell_list;
3255}
3256
3257#############################################################################
3258
3259package CFClient::UI::Root;
3260
3261our @ISA = CFClient::UI::Container::;
3262
3263use CFClient::OpenGL;
3264
3265sub new {
3266 my $class = shift;
3267
3268 my $self = $class->SUPER::new (
3269 visible => 1,
3270 @_,
3271 );
3272
3273 Scalar::Util::weaken ($self->{root} = $self);
3274
3275 $self
3276}
3277
3278sub size_request {
3279 my ($self) = @_;
3280
3281 ($self->{w}, $self->{h})
3282}
3283
3284sub _to_pixel {
3285 my ($coord, $size, $max) = @_;
3286
3287 $coord =
3288 $coord eq "center" ? ($max - $size) * 0.5
3289 : $coord eq "max" ? $max
3290 : $coord;
3291
3292 $coord = 0 if $coord < 0;
3293 $coord = $max - $size if $coord > $max - $size;
3294
3295 int $coord + 0.5
3296}
3297
3298sub size_allocate {
3299 my ($self, $w, $h) = @_;
3300
3301 for my $child ($self->children) {
3302 my ($X, $Y, $W, $H) = @$child{qw(x y req_w req_h)};
3303
3304 $X = $child->{force_x} if exists $child->{force_x};
3305 $Y = $child->{force_y} if exists $child->{force_y};
3306
3307 $X = _to_pixel $X, $W, $self->{w};
3308 $Y = _to_pixel $Y, $H, $self->{h};
3309
3310 $child->configure ($X, $Y, $W, $H);
3311 }
3312}
3313
3314sub coord2local {
3315 my ($self, $x, $y) = @_;
3316
3317 ($x, $y)
3318}
3319
3320sub coord2global {
3321 my ($self, $x, $y) = @_;
3322
3323 ($x, $y)
3324}
3325
3326sub update {
3327 my ($self) = @_;
3328
3329 $::WANT_REFRESH++;
3330}
3331
3332sub add {
3333 my ($self, @children) = @_;
3334
3335 $_->{is_toplevel} = 1
3336 for @children;
3337
3338 $self->SUPER::add (@children);
3339}
3340
3341sub remove {
3342 my ($self, @children) = @_;
3343
3344 $self->SUPER::remove (@children);
3345
3346 delete $self->{is_toplevel}
3347 for @children;
3348
3349 while (@children) {
3350 my $w = pop @children;
3351 push @children, $w->children;
3352 $w->set_invisible;
3353 }
3354}
3355
3356sub on_refresh {
3357 my ($self, $id, $cb) = @_;
3358
3359 $self->{refresh_hook}{$id} = $cb;
3360}
3361
3362sub on_post_alloc {
3363 my ($self, $id, $cb) = @_;
3364
3365 $self->{post_alloc_hook}{$id} = $cb;
3366}
3367
3368sub draw {
3369 my ($self) = @_;
3370
3371 while ($self->{refresh_hook}) {
3372 $_->()
3373 for values %{delete $self->{refresh_hook}};
3374 }
3375
3376 if ($self->{realloc}) {
3377 my @queue;
3378
3379 while () {
3380 if ($self->{realloc}) {
3381 #TODO use array-of-depth approach
3382
3383 use sort 'stable';
3384
3385 @queue = sort { $a->{visible} <=> $b->{visible} }
3386 @queue, values %{delete $self->{realloc}};
3387 }
3388
3389 my $widget = pop @queue || last;
3390
3391 $widget->{visible} or last; # do not resize invisible widgets
3392
3393 my ($w, $h) = $widget->size_request;
3394
3395 $w = List::Util::max $widget->{min_w}, $w + $widget->{padding_x} * 2;
3396 $h = List::Util::max $widget->{min_h}, $h + $widget->{padding_y} * 2;
3397
3398 $w = $widget->{force_w} if exists $widget->{force_w};
3399 $h = $widget->{force_h} if exists $widget->{force_h};
3400
3401 if ($widget->{req_w} != $w || $widget->{req_h} != $h
3402 || delete $widget->{force_realloc}) {
3403 $widget->{req_w} = $w;
3404 $widget->{req_h} = $h;
3405
3406 $self->{size_alloc}{$widget+0} = $widget;
3407
3408 if (my $parent = $widget->{parent}) {
3409 $self->{realloc}{$parent+0} = $parent;
3410 #unshift @queue, $parent;
3411 $parent->{force_size_alloc} = 1;
3412 $self->{size_alloc}{$parent+0} = $parent;
3413 }
3414 }
3415
3416 delete $self->{realloc}{$widget+0};
3417 }
3418 }
3419
3420 while (my $size_alloc = delete $self->{size_alloc}) {
3421 my @queue = sort { $b->{visible} <=> $a->{visible} }
3422 values %$size_alloc;
3423
3424 while () {
3425 my $widget = pop @queue || last;
3426
3427 my ($w, $h) = @$widget{qw(alloc_w alloc_h)};
3428
3429 $w = 0 if $w < 0;
3430 $h = 0 if $h < 0;
3431
3432 $w = int $w + 0.5;
3433 $h = int $h + 0.5;
3434
3435 if ($widget->{w} != $w || $widget->{h} != $h || delete $widget->{force_size_alloc}) {
3436 $widget->{w} = $w;
3437 $widget->{h} = $h;
3438
3439 $widget->emit (size_allocate => $w, $h);
3440 }
3441 }
3442 }
3443
3444 while ($self->{post_alloc_hook}) {
3445 $_->()
3446 for values %{delete $self->{post_alloc_hook}};
3447 }
3448
3449
3450 glViewport 0, 0, $::WIDTH, $::HEIGHT;
3451 glClearColor +($::CFG->{fow_intensity}) x 3, 1;
3452 glClear GL_COLOR_BUFFER_BIT;
3453
3454 glMatrixMode GL_PROJECTION;
3455 glLoadIdentity;
3456 glOrtho 0, $::WIDTH, $::HEIGHT, 0, -10000, 10000;
3457 glMatrixMode GL_MODELVIEW;
3458 glLoadIdentity;
3459
3460 $self->_draw;
3461}
3386 3462
3387############################################################################# 3463#############################################################################
3388 3464
3389package CFClient::UI; 3465package CFClient::UI;
3390 3466

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines