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

Comparing deliantra/Deliantra-Client/bin/cfplus (file contents):
Revision 1.99 by root, Sun Jul 23 08:58:44 2006 UTC vs.
Revision 1.100 by root, Sun Jul 23 16:11:12 2006 UTC

36 36
37use CFClient; 37use CFClient;
38use CFClient::OpenGL (); 38use CFClient::OpenGL ();
39use CFClient::Protocol; 39use CFClient::Protocol;
40use CFClient::UI; 40use CFClient::UI;
41use CFClient::Pod;
41use CFClient::BindingEditor; 42use CFClient::BindingEditor;
42use CFClient::MapWidget; 43use CFClient::MapWidget;
43 44
44$SIG{QUIT} = sub { Carp::cluck "QUIT" }; 45$SIG{QUIT} = sub { Carp::cluck "QUIT" };
45$SIG{PIPE} = 'IGNORE'; 46$SIG{PIPE} = 'IGNORE';
130our $BIND_UPD_CB; 131our $BIND_UPD_CB;
131 132
132our $PICKUP_CFG; 133our $PICKUP_CFG;
133 134
134sub status { 135sub status {
135 $STATUSBOX->add (CFClient::UI::Label::escape $_[0], pri => -10, group => "status", timeout => 10, fg => [1, 1, 0, 1]); 136 $STATUSBOX->add (CFClient::asxml $_[0], pri => -10, group => "status", timeout => 10, fg => [1, 1, 0, 1]);
136} 137}
137 138
138sub debug { 139sub debug {
139 $DEBUG_STATUS->set_text ($_[0]); 140 $DEBUG_STATUS->set_text ($_[0]);
140} 141}
1486 1487
1487 my $parser = HTML::Parser->new ( 1488 my $parser = HTML::Parser->new (
1488 text_h => [sub { 1489 text_h => [sub {
1489 my ($text) = @_; 1490 my ($text) = @_;
1490 $text =~ s/\s+/ /g; 1491 $text =~ s/\s+/ /g;
1491 $s[-1]{text} .= CFClient::UI::Label::escape $text; 1492 $s[-1]{text} .= CFClient::asxml $text;
1492 }, "dtext"], 1493 }, "dtext"],
1493 start_h => [sub { 1494 start_h => [sub {
1494 my ($tag, $attr) = @_; 1495 my ($tag, $attr) = @_;
1495 if ($passthrough{$tag}) { 1496 if ($passthrough{$tag}) {
1496 $s[-1]{text} .= "<$tag>"; 1497 $s[-1]{text} .= "<$tag>";
1583 }; 1584 };
1584 warn "$@" if $@; 1585 warn "$@" if $@;
1585 return; 1586 return;
1586 } 1587 }
1587 1588
1588 my $pom = CFClient::load_pod CFClient::find_rcfile "pod/$pod.pod", 1589 my $pom = CFClient::Pod::load CFClient::find_rcfile "pod/$pod.pod",
1589 doc_viewer => 1, sub { CFClient::pod_to_pango_list $_[0] }; 1590 doc_viewer => 1, sub { CFClient::Pod::as_paragraphs $_[0] };
1591
1592 #use Data::Dumper; warn Dumper $pom;#d#
1590 1593
1591 $viewer->clear; 1594 $viewer->clear;
1592 1595
1593# $viewer->add_paragraph ([1, 1, 1, 1], ["<big>Test</big>\n\n \x{fffc} \x{fffc}\n", 1596# $viewer->add_paragraph ([1, 1, 1, 1], ["<big>Test</big>\n\n \x{fffc} \x{fffc}\n",
1594# (new CFClient::UI::Image path => "x.png", can_hover => 1, can_events => 1), 1597# (new CFClient::UI::Image path => "x.png", can_hover => 1, can_events => 1),
1595# (new CFClient::UI::Label text => "üüüü", can_hover => 1, can_events => 1, tooltip => "??"), 1598# (new CFClient::UI::Label text => "üüüü", can_hover => 1, can_events => 1, tooltip => "??"),
1596# ]);#d# 1599# ]);#d#
1597 1600
1598 $viewer->add_paragraph ([1, 1, 1, 1], $_->[1], $_->[0]) 1601 $viewer->add_paragraph ([1, 1, 1, 1], [$_->{text}, @{ $_->{obj} || [] }], $_->{indent})
1599 for @$pom; 1602 for @$pom;
1600 1603
1601 $viewer->set_offset (0); 1604 $viewer->set_offset (0);
1602 1605
1603 0 1606 0
1869 1872
1870 $WANT_REFRESH = 0; 1873 $WANT_REFRESH = 0;
1871 $CAN_REFRESH = 0; 1874 $CAN_REFRESH = 0;
1872 $LAST_REFRESH = $NOW; 1875 $LAST_REFRESH = $NOW;
1873 1876
18740 && do {
1875 # some weird model-drawing code, just a joke right now
1876 use CFClient::OpenGL;
1877
1878 $demo{t}{eye_auv} ||= new_from_file CFClient::Texture "eye2.png" or die;
1879 $demo{t}{body_auv} ||= new_from_file CFClient::Texture "body_auv3.png" or die;
1880 $demo{r} ||= do {
1881 my $mod = Compress::LZF::sthaw do { local $/; open my $fh, "<:raw:perlio", "dread.lz3"; <$fh> };
1882 $mod->{v} = pack "f*", @{$mod->{v}};
1883 $_ = [scalar @$_, pack "S!*", @$_]
1884 for values %{$mod->{g}};
1885 $mod
1886 };
1887
1888 my $r = $demo{r} or die;
1889
1890 glDepthMask 1;
1891 glClear GL_DEPTH_BUFFER_BIT;
1892 glEnable GL_TEXTURE_2D;
1893 glEnable GL_DEPTH_TEST;
1894 glEnable GL_CULL_FACE;
1895 glShadeModel $::FAST ? GL_FLAT : GL_SMOOTH;
1896
1897 glMatrixMode GL_PROJECTION;
1898 glLoadIdentity;
1899 glFrustum -1 * ($::WIDTH / $::HEIGHT), 1 * ($::WIDTH / $::HEIGHT), 1, -1, 1, 10000;
1900 #glOrtho 0, $::WIDTH, 0, $::HEIGHT, -10000, 10000;
1901 glMatrixMode GL_MODELVIEW;
1902 glLoadIdentity;
1903
1904 glPushMatrix;
1905 glTranslate 0, 0, -800;
1906 glScale 1, -1, 1;
1907 glRotate $NOW * 1000 % 36000 / 5, 0, 1, 0;
1908 glRotate $NOW * 1000 % 36000 / 6, 1, 0, 0;
1909 glRotate $NOW * 1000 % 36000 / 7, 0, 0, 1;
1910 glScale 50, 50, 50;
1911
1912 glInterleavedArrays GL_T2F_N3F_V3F, 0, $r->{v};
1913 while (my ($k, $v) = each %{$r->{g}}) {
1914 glBindTexture GL_TEXTURE_2D, ($demo{t}{$k}{name} or die);
1915 glDrawElements GL_TRIANGLES, $v->[0], GL_UNSIGNED_SHORT, $v->[1];
1916 }
1917
1918 glPopMatrix;
1919
1920 glShadeModel GL_FLAT;
1921 glDisable GL_DEPTH_TEST;
1922 glDisable GL_TEXTURE_2D;
1923 glDepthMask 0;
1924
1925 $WANT_REFRESH++;
1926};
1927
1928 CFClient::SDL_GL_SwapBuffers; 1877 CFClient::SDL_GL_SwapBuffers;
1929} 1878}
1930 1879
1931my $refresh_watcher = Event->timer (after => 0, hard => 0, interval => 1 / $MAX_FPS, cb => sub { 1880my $refresh_watcher = Event->timer (after => 0, hard => 0, interval => 1 / $MAX_FPS, cb => sub {
1932 $NOW = time; 1881 $NOW = time;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines