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

Last change on this file since 97 was 56, checked in by Sam Hocevar, 12 years ago
  • Add licensing terms to most C / C++ files (Ref #5).
File size: 1.0 KB
RevLine 
[56]1/*
2 *  Abuse - dark 2D side-scrolling platform game
3 *  Copyright (c) 1995 Crack dot Com
4 *
5 *  This software was released into the Public Domain. As with most public
6 *  domain software, no warranty is made or implied by Crack dot Com or
7 *  Jonathan Clark.
8 */
9
10#include "config.h"
11
[2]12#include "chat.hpp"
[39]13#include "dev.hpp"
[2]14
15chat_console::chat_console(window_manager *WM, JCFont *font, int width, int height) :
16  console(WM,font,width,height<4 ? 4 : height,symbol_str("CHAT"))
17{
18  clear();
19  cx=0;
20  cy=h-1;
21  lastx=xres/2-screen_w()/2;
22  lasty=yres-screen_h()-WINDOW_FRAME_TOP-WINDOW_FRAME_BOTTOM;
23}
24
25chat_console *chat=NULL;
26
27void chat_console::clear()
28{
29  memset(screen,' ',w*h);
30  memset(screen+w*(h-2),'-',w);
31  redraw();
32}
33
34void chat_console::put_all(char *st)
35{
36  memmove(screen,screen+w,w*(h-3));
37  memset(screen+w*(h-3),' ',w); 
38  memcpy(screen+w*(h-3),st,strlen(st));
39  redraw();
40}
41
42
43void chat_console::draw_user(char *st)
44{
45  memset(screen+w*(h-1),' ',w);
46  memcpy(screen+w*(h-1),st,strlen(st));
47  cx=strlen(st);
48  cy=h-1;
49  redraw();
50}
51
Note: See TracBrowser for help on using the repository browser.