source: abuse/trunk/src/chat.cpp @ 2

Last change on this file since 2 was 2, checked in by Sam Hocevar, 18 years ago
  • imported original 0.7.0 tarball
File size: 784 bytes
Line 
1#include "chat.hpp"
2
3extern char *symbol_str(char *name);
4
5chat_console::chat_console(window_manager *WM, JCFont *font, int width, int height) :
6  console(WM,font,width,height<4 ? 4 : height,symbol_str("CHAT"))
7{
8  clear();
9  cx=0;
10  cy=h-1;
11  lastx=xres/2-screen_w()/2;
12  lasty=yres-screen_h()-WINDOW_FRAME_TOP-WINDOW_FRAME_BOTTOM;
13}
14
15chat_console *chat=NULL;
16
17void chat_console::clear()
18{
19  memset(screen,' ',w*h);
20  memset(screen+w*(h-2),'-',w);
21  redraw();
22}
23
24void chat_console::put_all(char *st)
25{
26  memmove(screen,screen+w,w*(h-3));
27  memset(screen+w*(h-3),' ',w); 
28  memcpy(screen+w*(h-3),st,strlen(st));
29  redraw();
30}
31
32
33void chat_console::draw_user(char *st)
34{
35  memset(screen+w*(h-1),' ',w);
36  memcpy(screen+w*(h-1),st,strlen(st));
37  cx=strlen(st);
38  cy=h-1;
39  redraw();
40}
41
Note: See TracBrowser for help on using the repository browser.