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

Comparing deliantra/Deliantra-Client/DC.pm (file contents):
Revision 1.51 by root, Sun May 14 20:51:19 2006 UTC vs.
Revision 1.56 by root, Fri May 19 23:18:40 2006 UTC

20 use XSLoader; 20 use XSLoader;
21 XSLoader::load "CFClient", $VERSION; 21 XSLoader::load "CFClient", $VERSION;
22} 22}
23 23
24use Carp (); 24use Carp ();
25use AnyEvent; 25use AnyEvent ();
26use BerkeleyDB; 26use BerkeleyDB;
27
27use CFClient::OpenGL; 28use CFClient::OpenGL;
28 29
29our %GL_EXT; 30our %GL_EXT;
30our $GL_VERSION; 31our $GL_VERSION;
31 32
49 50
50sub gl_check { 51sub gl_check {
51 return unless $GL_DEBUG; 52 return unless $GL_DEBUG;
52 53
53 if (my $error = glGetError) { 54 if (my $error = glGetError) {
54 Carp::cluck sprintf "opengl error %x while %s", $error, sprintf @_; 55 Carp::cluck sprintf "opengl error %x while %s", $error, &sprintf(@_);
55 } 56 }
56} 57}
57 58
58sub find_rcfile($) { 59sub find_rcfile($) {
59 my $path; 60 my $path;
120# -Filename => "database", 121# -Filename => "database",
121# -Subname => $table, 122# -Subname => $table,
122 -Property => DB_CHKSUM, 123 -Property => DB_CHKSUM,
123 -Flags => DB_CREATE | DB_UPGRADE, 124 -Flags => DB_CREATE | DB_UPGRADE,
124 or die "unable to create/open database table $_[0]: $BerkeleyDB::Error"; 125 or die "unable to create/open database table $_[0]: $BerkeleyDB::Error";
126}
127
128sub pod_to_pango($) {
129 my ($pom) = @_;
130
131 $pom->present ("CFClient::PodToPango")
132}
133
134package CFClient::PodToPango;
135
136use base Pod::POM::View::Text;
137
138our $indent = 0;
139
140*view_seq_code =
141*view_seq_bold = sub { "<b>$_[1]</b>" };
142*view_seq_italic = sub { "<i>$_[1]</i>" };
143*view_seq_space =
144*view_seq_link =
145*view_seq_index = sub { CFClient::UI::Label::escape ($_[1]) };
146
147sub view_seq_text {
148 my $text = $_[1];
149 $text =~ s/\s+/ /g;
150 CFClient::UI::Label::escape ($text)
151}
152
153sub view_item {
154 ("\t" x ($indent / 4))
155 . $_[1]->title->present ($_[0])
156 . "\n"
157 . $_[1]->content->present ($_[0])
158}
159
160sub view_verbatim {
161 (join "",
162 map +("\t" x ($indent / 2)) . "$_\n",
163 split /\n/, CFClient::UI::Label::escape ($_[1]))
164 . "\n"
165}
166
167sub view_textblock {
168 ("\t" x ($indent / 2)) . "$_[1]\n\n"
169}
170
171sub view_head2 {
172 "<big>" . $_[1]->title->present ($_[0]) . "</big>\n\n"
173 . $_[1]->content->present ($_[0])
174};
175
176sub view_over {
177 local $indent = $indent + $_[1]->indent;
178 $_[1]->content->present ($_[0])
125} 179}
126 180
127package CFClient::Database; 181package CFClient::Database;
128 182
129our @ISA = BerkeleyDB::Btree::; 183our @ISA = BerkeleyDB::Btree::;
301 glGetError; 355 glGetError;
302 356
303 if (defined $data) { 357 if (defined $data) {
304 glTexImage2D GL_TEXTURE_2D, 0, 358 glTexImage2D GL_TEXTURE_2D, 0,
305 $self->{internalformat}, 359 $self->{internalformat},
306 $tw, $th, # need to pad texture first 360 $tw, $th,
307 0, 361 0,
308 $self->{format}, 362 $self->{format},
309 $self->{type}, 363 $self->{type},
310 $data; 364 $data;
311 CFClient::gl_check "uploading texture %dx%d if=%x f=%x t=%x", 365 CFClient::gl_check "uploading texture %dx%d if=%x f=%x t=%x",
317 $tw, $th, 371 $tw, $th,
318 0; 372 0;
319 CFClient::gl_check "copying to texture %dx%d if=%x", 373 CFClient::gl_check "copying to texture %dx%d if=%x",
320 $tw, $th, $self->{internalformat}; 374 $tw, $th, $self->{internalformat};
321 } 375 }
376
377 glBindTexture GL_TEXTURE_2D, 0; # just to be on the safe side
322} 378}
323 379
324sub DESTROY { 380sub DESTROY {
325 my ($self) = @_; 381 my ($self) = @_;
326 382
328 384
329 glDeleteTexture delete $self->{name} 385 glDeleteTexture delete $self->{name}
330 if $self->{name}; 386 if $self->{name};
331} 387}
332 388
333sub restore_state{ 389sub restore_state {
334 $_->upload 390 $_->upload
335 for values %TEXTURES; 391 for values %TEXTURES;
336}; 392}
337 393
3381; 3941;
339 395
340=back 396=back
341 397

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines