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.11 by elmex, Fri Apr 7 20:39:58 2006 UTC vs.
Revision 1.12 by root, Fri Apr 7 20:55:32 2006 UTC

57 57
58sub draw { 58sub draw {
59 my ($self) = @_; 59 my ($self) = @_;
60 60
61 glPushMatrix; 61 glPushMatrix;
62 glTranslate ($self->{x} || 0, $self->{y} || 0, 0); 62 glTranslate $self->{x}, $self->{y}, 0;
63 $self->_draw; 63 $self->_draw;
64 glPopMatrix; 64 glPopMatrix;
65} 65}
66 66
67sub _draw { 67sub _draw {
72 my ($widget) = @_; 72 my ($widget) = @_;
73} 73}
74 74
75package Crossfire::Client::Widget::Label; 75package Crossfire::Client::Widget::Label;
76 76
77our @ISA = Crossfire::Client::Widget::;
78
77use SDL::OpenGL; 79use SDL::OpenGL;
78 80
79sub new { 81sub new {
80 my ($class, $ttf, $text) = @_; 82 my ($class, $x, $y, $z, $ttf, $text) = @_;
81 83
82 my $self = $class->SUPER::new; 84 my $self = $class->SUPER::new (x => $x, y => $y, z => $z);
83 85
84 $self->{texture} = new_from_ttf Crossfire::Client::Texture $ttf, $text; 86 $self->{texture} = new_from_ttf Crossfire::Client::Texture $ttf, $text;
85 87
86 $self 88 $self
87} 89}
89sub _draw { 91sub _draw {
90 my ($self) = @_; 92 my ($self) = @_;
91 93
92 my $tex = $self->{texture}; 94 my $tex = $self->{texture};
93 95
96 $self->{x}--;
97
98 glEnable GL_BLEND;
94 glEnable GL_TEXTURE_2D; 99 glEnable GL_TEXTURE_2D;
100 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE;
95 glBindTexture GL_TEXTURE_2D, $tex->{name}; 101 glBindTexture GL_TEXTURE_2D, $tex->{name};
102
103 glColor 1, 1, 1;
96 104
97 glBegin GL_QUADS; 105 glBegin GL_QUADS;
98 glTexCoord 0, 0; glVertex 0 , 0; 106 glTexCoord 0, 0; glVertex 0 , 0;
99 glTexCoord 0, 1; glVertex 0 , $tex->{height}; 107 glTexCoord 0, 1; glVertex 0 , $tex->{height};
100 glTexCoord 1, 1; glVertex $tex->{width}, $tex->{height}; 108 glTexCoord 1, 1; glVertex $tex->{width}, $tex->{height};
101 glTexCoord 1, 0; glVertex $tex->{width}, 0; 109 glTexCoord 1, 0; glVertex $tex->{width}, 0;
102 glEnd; 110 glEnd;
103 111
112 glDisable GL_BLEND;
104 glDisable GL_TEXTURE_2D; 113 glDisable GL_TEXTURE_2D;
105} 114}
106 115
107package Crossfire::Client::Widget::TextView; 116package Crossfire::Client::Widget::TextView;
108 117
140} 149}
141 150
142sub _draw { 151sub _draw {
143 glEnable GL_TEXTURE_2D; 152 glEnable GL_TEXTURE_2D;
144 glEnable GL_BLEND; 153 glEnable GL_BLEND;
154 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE;
145 155
146 my $map = $::CONN->{map}; 156 my $map = $::CONN->{map};
147 157
148 for my $x (0 .. $::CONN->{mapw} - 1) { 158 for my $x (0 .. $::CONN->{mapw} - 1) {
149 for my $y (0 .. $::CONN->{maph} - 1) { 159 for my $y (0 .. $::CONN->{maph} - 1) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines