Platon Technologies
neprihlásený Prihlásiť Registrácia
SlovakEnglish
open source software development oslavujeme 10 rokov vývoja otvoreného softvéru! Nedeľa, 27. apríl 2025

Súbor: [Platon] / games / _shared / mouse.c (stiahnutie)

Revízia 1.4, Tue Apr 6 09:54:16 2004 UTC (21 years ago) by nepto


Zmeny od 1.3: +11 -3 [lines]

Headers update:
    - switch to standard/classic Platon SDG source header
    - bumped copyright year to 2004
    - changelog dates reformatted to new format YYYY-MM-DD

/*
 * games/_shared/ - shared routines for games
 *
 * mouse.c - interrupt 0x33 handler (mouse service)
 * ____________________________________________________________
 *
 * Developed by Ondrej Jombik <nepto@platon.sk>
 * Copyright (c) 1997-2000 Condy software inc.
 * Copyright (c) 2001-2004 Platon SDG, http://platon.sk/
 * All rights reserved.
 *
 * See README file for more information about this software.
 * See COPYING file for license information.
 *
 * Download the latest version from
 * http://platon.sk/projects/games/
 */

/* $Platon: games/_shared/mouse.c,v 1.3 2003/08/03 21:34:18 nepto Exp $ */

#include <dos.h>

#include "mouse.h"

/* Mouse handler implementation */

BYTE initmouse(void) /* {{{ */
{
    struct REGPACK rg;
    rg.r_ax=0x0;
    intr(0x33,&rg);
    return(rg.r_ax&rg.r_bx);
} /* }}} */

void showmouse(void) /* {{{ */
{
    struct REGPACK rg;
    rg.r_ax=0x1;
    intr(0x33,&rg);
} /* }}} */

void hidemouse(void) /* {{{ */
{
    struct REGPACK rg;
    rg.r_ax=0x2;
    intr(0x33,&rg);
} /* }}} */

BYTE getmousepos(WORD*x,WORD*y) /* {{{ */
{
    struct REGPACK rg;
    rg.r_ax=0x3;
    intr(0x33,&rg);
    *x=rg.r_cx;
    *y=rg.r_dx;
    return(rg.r_bx);
} /* }}} */

void setmousepos(WORD x,WORD y) /* {{{ */
{
    struct REGPACK rg;
    rg.r_cx=x;
    rg.r_dx=y;
    rg.r_ax=0x4;
    intr(0x33,&rg);
} /* }}} */

BYTE pressbutton(BYTE but,WORD*x,WORD*y) /* {{{ */
{
    struct REGPACK rg;
    rg.r_bx=but;
    rg.r_ax=0x5;
    intr(0x33,&rg);
    *x=rg.r_cx;
    *y=rg.r_dx;
    return(rg.r_bx);
} /* }}} */

BYTE releasebutton(BYTE but,WORD*x,WORD*y) /* {{{ */
{
    struct REGPACK rg;
    rg.r_bx=but;
    rg.r_ax=0x6;
    intr(0x33,&rg);
    *x=rg.r_cx;
    *y=rg.r_dx;
    return(rg.r_bx);
} /* }}} */

void rangex(WORD a_min,WORD a_max) /* {{{ */
{
    struct REGPACK rg;
    rg.r_cx=a_min;
    rg.r_dx=a_max;
    rg.r_ax=0x7;
    intr(0x33,&rg);
} /* }}} */

void rangey(WORD a_min,WORD a_max) /* {{{ */
{
    struct REGPACK rg;
    rg.r_cx=a_min;
    rg.r_dx=a_max;
    rg.r_ax=0x8;
    intr(0x33,&rg);
} /* }}} */

void setmousecur(WORD x,WORD y,void *p) /* {{{ */
{
    struct REGPACK rg;
    rg.r_es=FP_SEG(p);
    rg.r_dx=FP_OFF(p);
    rg.r_cx=y;rg.r_bx=x;
    rg.r_ax=0x9;
    intr(0x33,&rg);
} /* }}} */

void exclude(WORD x1,WORD y1,WORD x2,WORD y2) /* {{{ */
{
    struct REGPACK rg;
    rg.r_cx=x1;
    rg.r_dx=y1;
    rg.r_si=x2;
    rg.r_di=y2;
    rg.r_ax=0x10;
    intr(0x33,&rg);
} /* }}} */

void mousesensitive(WORD x,WORD y) /* {{{ */
{
    struct REGPACK rg;
    rg.r_cx=x;
    rg.r_dx=y;
    rg.r_ax=0xf;
    intr(0x33,&rg);
} /* }}} */

void setmousespeed(WORD speed) /* {{{ */
{
    struct REGPACK rg;
    rg.r_dx=speed;
    rg.r_ax=0x13;
    intr(0x33,&rg);
} /* }}} */

/* Modeline for ViM {{{
 * vim: set ts=4:
 * vim600: fdm=marker fdl=0 fdc=0:
 * }}} */


Platon Group <platon@platon.sk> http://platon.sk/
Copyright © 2002-2006 Platon Group
Stránka používa redakčný systém Metafox
Na začiatok