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

Comparing deliantra/Deliantra-Client/bin/pclient (file contents):
Revision 1.18 by root, Fri Apr 7 18:49:53 2006 UTC vs.
Revision 1.19 by root, Fri Apr 7 19:33:42 2006 UTC

15use Crossfire::Client; 15use Crossfire::Client;
16use Crossfire::Protocol; 16use Crossfire::Protocol;
17 17
18use Client::Util; 18use Client::Util;
19use Client::Widget; 19use Client::Widget;
20
21our $FACECACHE;
20 22
21our $VERSION = '0.1'; 23our $VERSION = '0.1';
22 24
23our $CFG; 25our $CFG;
24our $CONN; 26our $CONN;
42 -blue_size => 8, 44 -blue_size => 8,
43 -double_buffer => 1, 45 -double_buffer => 1,
44 -fullscreen => $CFG->{fullscreen}, 46 -fullscreen => $CFG->{fullscreen},
45 -resizeable => 0; 47 -resizeable => 0;
46 48
49 glClearColor 0, 0, 0, 0;
50
47 glEnable GL_TEXTURE_2D; 51 glEnable GL_TEXTURE_2D;
48 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE; 52 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE;
49 glShadeModel GL_FLAT; 53 glShadeModel GL_FLAT;
50 glDisable GL_DEPTH_TEST; 54 glDisable GL_DEPTH_TEST;
51 glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA; 55 glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA;
52 glEnable GL_BLEND; 56 glEnable GL_BLEND;
53 57
54 glMatrixMode GL_PROJECTION; 58 glMatrixMode GL_PROJECTION;
55 glLoadIdentity; 59 glLoadIdentity;
56 glOrtho 0, $CFG->{width} / 32, $CFG->{height} / 32, 0, -1 , 1; 60 glOrtho 0, $CFG->{width} / 32, $CFG->{height} / 32, 0, -100 , 100;
61
62 glMatrixMode GL_MODELVIEW;
57 63
58 $_->() for @GL_INIT; 64 $_->() for @GL_INIT;
59} 65}
60 66
61sub start_game { 67sub start_game {
80 undef $SDL_APP; 86 undef $SDL_APP;
81 SDL::Quit; 87 SDL::Quit;
82} 88}
83 89
84sub refresh { 90sub refresh {
85 glClearColor 0, 0, 0, 0;
86 glClear GL_COLOR_BUFFER_BIT; 91 glClear GL_COLOR_BUFFER_BIT;
87 92
88 for (values %Client::Widget::ACTIVE_WIDGETS) { 93 for (values %Client::Widget::ACTIVE_WIDGETS) {
89 $_->draw 94 $_->draw
90 } 95 }
93} 98}
94 99
95%SDL_CB = ( 100%SDL_CB = (
96 SDL_QUIT() => sub { 101 SDL_QUIT() => sub {
97 warn "sdl quit\n";#d# 102 warn "sdl quit\n";#d#
98 exit; 103 main_quit Gtk2;
99 }, 104 },
100 SDL_VIDEORESIZE() => sub { 105 SDL_VIDEORESIZE() => sub {
101 }, 106 },
102 SDL_VIDEOEXPOSE() => sub { 107 SDL_VIDEOEXPOSE() => sub {
103 refresh; 108 refresh;
146 my ($self) = @_; 151 my ($self) = @_;
147 152
148 refresh; 153 refresh;
149} 154}
150 155
156sub conn::face_find {
157 my ($self, $face) = @_;
158
159 $FACECACHE->{"$face->{chksum},$face->{name}"}
160}
161
151sub conn::face_update { 162sub conn::face_update {
152 my ($self, $num, $face) = @_; 163 my ($self, $face) = @_;
164
165 $FACECACHE->{"$face->{chksum},$face->{name}"} = $face->{image};
153 166
154 $face->{texture} = new_from_image Crossfire::Client::Texture delete $face->{image}; 167 $face->{texture} = new_from_image Crossfire::Client::Texture delete $face->{image};
155} 168}
156 169
157############################################################################# 170#############################################################################
160 173
161$mapwidget->activate; 174$mapwidget->activate;
162$mapwidget->focus_in; 175$mapwidget->focus_in;
163 176
164Client::Util::read_cfg "$Crossfire::VARDIR/pclientrc"; 177Client::Util::read_cfg "$Crossfire::VARDIR/pclientrc";
178
179$FACECACHE = eval { Crossfire::load_ref "$Crossfire::VARDIR/pclient.faces" } || {};
165 180
166$CFG ||= { 181$CFG ||= {
167 width => 640, 182 width => 640,
168 height => 480, 183 height => 480,
169 fullscreen => 0, 184 fullscreen => 0,
174Client::Util::run_config_dialog 189Client::Util::run_config_dialog
175 login => sub { start_game }, 190 login => sub { start_game },
176 logout => sub { stop_game }; 191 logout => sub { stop_game };
177 192
178main Gtk2; 193main Gtk2;
194
195Crossfire::save_ref $FACECACHE, "$Crossfire::VARDIR/pclient.faces";

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines