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.2 by elmex, Fri Apr 7 17:37:11 2006 UTC vs.
Revision 1.9 by elmex, Fri Apr 7 20:09:52 2006 UTC

1package Client::Widget; 1package Crossfire::Client::Widget;
2
2use strict; 3use strict;
3 4
4our $FOCUS; # the widget with current focus 5our $FOCUS; # the widget with current focus
5our %ACTIVE_WIDGETS; 6our %ACTIVE_WIDGETS;
6 7
18} 19}
19 20
20sub activate { 21sub activate {
21 $ACTIVE_WIDGETS{$_[0]} = $_[0]; 22 $ACTIVE_WIDGETS{$_[0]} = $_[0];
22} 23}
24
23sub deactivate { 25sub deactivate {
24 delete $ACTIVE_WIDGETS{$_[0]}; 26 delete $ACTIVE_WIDGETS{$_[0]};
25} 27}
26 28
27sub focus_in { 29sub focus_in {
28 my ($widget) = @_; 30 my ($widget) = @_;
29 $FOCUS = $widget; 31 $FOCUS = $widget;
30} 32}
33
31sub focus_out { 34sub focus_out {
32 my ($widget) = @_; 35 my ($widget) = @_;
33} 36}
37
34sub key_down { 38sub key_down {
35 my ($widget, $sdlev) = @_; 39 my ($widget, $sdlev) = @_;
36} 40}
41
37sub key_up { 42sub key_up {
38 my ($widget, $sdlev) = @_; 43 my ($widget, $sdlev) = @_;
39} 44}
45
40sub button_down { 46sub button_down {
41 my ($widget, $sdlev) = @_; 47 my ($widget, $sdlev) = @_;
42} 48}
49
43sub button_up { 50sub button_up {
44 my ($widget, $sdlev) = @_; 51 my ($widget, $sdlev) = @_;
45} 52}
53
46sub draw { 54sub draw {
47 my ($widget) = @_; 55 my ($widget) = @_;
48} 56}
57
49sub bbox { 58sub bbox {
50 my ($widget) = @_; 59 my ($widget) = @_;
51} 60}
52 61
53package Client::MapWidget; 62package Crossfire::Client::Widget::TextView;
63
54use strict; 64use strict;
55our @ISA = qw/Client::Widget/; 65our @ISA = qw/Crossfire::Client::Widget/;
66
67use SDL::OpenGL;
68use SDL::OpenGL::Constants;
69
70sub add_line {
71 my ($self, $line) = @_;
72 push @{$self->{lines}}, $line;
73}
74
75sub draw {
76 my ($self) = @_;
77
78}
79
80package Crossfire::Client::Widget::MapWidget;
81
82use strict;
83
84our @ISA = qw/Crossfire::Client::Widget/;
56 85
57use SDL::OpenGL; 86use SDL::OpenGL;
58use SDL::OpenGL::Constants; 87use SDL::OpenGL::Constants;
59 88
60sub key_down { 89sub key_down {
78 107
79 my $darkness = $cell->[3] * (1 / 255); 108 my $darkness = $cell->[3] * (1 / 255);
80 glColor $darkness, $darkness, $darkness; 109 glColor $darkness, $darkness, $darkness;
81 110
82 for my $num (grep $_, $cell->[0], $cell->[1], $cell->[2]) { 111 for my $num (grep $_, $cell->[0], $cell->[1], $cell->[2]) {
83 my $tex = $::CONN->{face}[$num]{texture} || 0; 112 my $tex = $::CONN->{face}[$num]{texture} || next;
84 113
85 glBindTexture GL_TEXTURE_2D, $tex; 114 glBindTexture GL_TEXTURE_2D, $tex->{name};
86 115
87 glBegin GL_QUADS; 116 glBegin GL_QUADS;
88 glTexCoord 0, 0; glVertex $x, $y; 117 glTexCoord 0, 0; glVertex $x, $y;
89 glTexCoord 0, 1; glVertex $x, $y + 1; 118 glTexCoord 0, 1; glVertex $x, $y + 1;
90 glTexCoord 1, 1; glVertex $x + 1, $y + 1; 119 glTexCoord 1, 1; glVertex $x + 1, $y + 1;
97 glDisable GL_TEXTURE_2D; 126 glDisable GL_TEXTURE_2D;
98 glDisable GL_BLEND; 127 glDisable GL_BLEND;
99} 128}
100 129
1011; 1301;
131

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines