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

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