TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: ALL
from: JAVIER KOHEN
date: 1997-06-13 21:19:00
subject: Classes [1/2]

Could you please make any suggestions that you can have about this
code??? (I mean the code part, not the algorithm)
>>>>>>>>>> CSplit: Version 2.2 >>>>>>>>>>
>>>>>>>>>> CSplit: Begin part 1/2 >>>>>>>>>>
>>>>>>>>>> CSplit: Begin file MOUSE.CPP >>>>>>>>>>
#include "mouse.h"
const int MOUSEINT = 0x33;
MouseInfo::MouseInfo()
{
    setButtons(-1);
}
int MouseInfo::getButtons() const
{
    return buttons;     // if installed = number of buttons, else = -1
}
void MouseInfo::setButtons(int but)
{
    if (but != -1) {
        installed = True;
        buttons = but;
    } else {
        installed = False;
        buttons = -1;
    }
}
Mouse::Mouse(Boolean initialize)
{
    if (initialize) {
        reset(Hard);
    }
}
void Mouse::reset(Reset resetType)
{
    if (resetType == Hard) {
        regs.x.ax = 0x0000;
    } else {
        regs.x.ax = 0x0021;
    }
    int86(MOUSEINT, ®s, ®s);
    if (regs.x.ax == 0xFFFF) {
        switch (regs.x.bx) {
            case 0x0000:
                setButtons(0);
                break;
            case 0x0002:
                setButtons(2);
                break;
            case 0x0003:
                setButtons(3);
                break;
            case 0xFFFF:
                setButtons(2);
                break;
            default:
                setButtons(regs.x.bx);
        }
    } else {
        setButtons(-1);
    }
}
>>>>>>>>>> CSplit: End file MOUSE.CPP >>>>>>>>>>
>>>>>>>>>> CSplit: Begin file MOUSE.H >>>>>>>>>>
#ifndef __MOUSE_H
#define __MOUSE_H
#include 
#ifdef __GNUC__
#define int86 _int86
#endif  // __GNUC__
enum Boolean {
    False, True
};
class MouseInfo {
    Boolean installed;
    int buttons;
protected:
    void setButtons(int);
public:
    MouseInfo();
>>>>>>>>>> CSplit: End part 1/2 crc: 9d99 >>>>>>>>>>
Internet: jkohen@tough.com þ Fidonet: 4:900/748.3 þ Sk-Network: 200:201/201.2
Rockernet: 33:300/100.3 þ  Javier Kohen/The_Crusher  þ PGP keyID: 3423EAA9
... Pointers are irrelevant, you shall be dereferenced þ C of Borg
-!- CrusherTag 0.021.
--- Terminate 4.00/Pro
4:900/748.3)
---------------
* Origin: The King of The Ring BBS þ +54-1-OFF-LINE þ TLD 0 - 7

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.