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

Last change on this file since 112 was 111, checked in by Sam Hocevar, 12 years ago
  • Simplified the window creation arguments. Got rid of a lot of macros and hid stuff in private namespaces.

Inspired by Win32 Abuse changelog for January 28, 2001:

  • Well, in the process of adding changes necessary to

handle recovery from alt-tabbing away from Abuse
(which is why I was updating jwindow::redraw()),
the entire windowing system is getting an overhaul.
It's gonna be sweet when I'm done, though.

  • jwindow::redraw() has been changed to a virtual

function requiring no parameters. This'll make
it much easier to implement special specific-
purpose windows.

File size: 1023 bytes
Line 
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
12#include "chat.hpp"
13#include "dev.hpp"
14
15chat_console *chat = NULL;
16
17chat_console::chat_console(JCFont *font, int width, int height) :
18  console(font,width,height<4 ? 4 : height,symbol_str("CHAT"))
19{
20    hide();
21    clear();
22    cx = 0;
23    cy = h - 1;
24    lastx = xres / 2 - screen_w() / 2;
25    lasty = yres - h;
26}
27
28void chat_console::clear()
29{
30  memset(screen,' ',w*h);
31  memset(screen+w*(h-2),'-',w);
32  redraw();
33}
34
35void chat_console::put_all(char *st)
36{
37  memmove(screen,screen+w,w*(h-3));
38  memset(screen+w*(h-3),' ',w); 
39  memcpy(screen+w*(h-3),st,strlen(st));
40  redraw();
41}
42
43
44void chat_console::draw_user(char *st)
45{
46  memset(screen+w*(h-1),' ',w);
47  memcpy(screen+w*(h-1),st,strlen(st));
48  cx=strlen(st);
49  cy=h-1;
50  redraw();
51}
52
Note: See TracBrowser for help on using the repository browser.