📄 moustrap.prn
字号:
printf("Left buttom was pressed at %d,%d\n", x,y);
}
}
- Page 9 -
MouseTrap Library
September 21, 1988
Set_Mouse_Limit
GSyntax:H
void Get_Mouse_Press(Direction, Min, Max);
mouse_t Direction; /* M_HORIZ -or- M_VERT */
mouse_t Min;
mouse_t Max;
GDescription:H
Forces the mouse cursor's movements to remain within the
limits specificed. Min and Max are given using graphic coordinates
(0-629) (0-199), and it requires two calls to limit motion in all
directions.
GReturn Value:H
GH None
GH
GSee Also:H
GExample:H
#include <moustrap.h>
#include <stdio.h>
main()
{
Check_Mouse();
Set_Mouse_Limit(M_VERT,49,149);
Set_Mouse_Limit(M_HORIZ,159,479);
/* Mouse is now limited to the center of the screen */
Read_Mouse();
}
- Page 10 -
MouseTrap Library
September 21, 1988
Set_Mouse_Text_Cursor
GSyntax:H
void Set_Mouse_Text_Cursor(Type, P1, P2);
mouse_t Type; /* 1 = Hardware Cursor */
mouse_t P1 /* Start scan line */
mouse_t P2; /* Stop scan line */
-or-
mouse_t Type; /* 0 = Software Cursor */
mouse_t P1; /* Screen Mask */
mouse_t P2; /* Cursor Mask */
GDescription:H
Set_Mouse_Text_Cursor describes how the mouse cursor will
appear on the screen. This can be done in either of two way: by
using the Hardware cursor, or the Software cursor. The Hardware
cursor is the same one that the keyboard uses. If the hardware
cursor is used, P1 & P2 give the scan lines for that cursor. For
normal screen uses that 6 & 7. The Software cursor is a little more
complex. There, P1 is the "Screen mask" and P2 is the "Cursor
Mask". When the software cursor is drawn on the screen, the
character and color attribute is first ANDed with the screen mask,
then the result of that is XORed with the cursor mask. If the
screen mask is 0, the net effect is that the current value at that
location is replaced by the cursor mask. If the screen mask is
nonzero, the current value at the screen location WILL effect of
character or color of the mouse cursor.
GH
GReturn Value:H
GH None.
GExample:H
See Chapter 4.
- Page 11 -
MouseTrap Library
September 21, 1988
Chapter 3
G Advanced Mouse Control FunctionsH
These thirteen functions simplify the process of
interpreting the users input using a mouse. They work on the
assumption that most of the time a mouse is used by "clicking" a
specific button at a specific place on the screen. They were
written using Microsoft's C v5.1.
Activate_Mouse_Page()
Add_Mouse_Button()
Add_Mouse_Hot_Spot()
Add_Mouse_Page()
Clear_All_Mouse_Definition()
Clear_Mouse_Pages()
DeActivate_Mouse_Page()
Define_Mouse_System()
Delete_Mouse_Button()
Delete_Mouse_Hot_Spot()
Delete_Mouse_Page()
Get_Char_Mouse_Kbd()
Read_Mouse()
- Page 12 -
MouseTrap Library
September 21, 1988
Activate_Mouse_Page
GH
GSyntax:H
#include <moustrap.h>
mouse_t Activate_Mouse_Page(mouse_t Page_ID)
GDescription:H
The Activate_Mouse_Page function sets active one of the
previously defined mouse pages. In Single Page mode, the currently
active page is cleared, and the mouse cursor is limited to the area
of that page. In Overlaid mode, the current pages remain active, and
the mouse cursor area is widened, if necessary, to accommodate the
new page.
GH
GReturn Value:H
MNOERROR if there was no problem, otherwise
MERROR with M_Error set to the specific error.
GH
GSee Also:H
M_Error, DeActivate_Mouse_Page, Add_Mouse_Page
- Page 13 -
MouseTrap Library
September 21, 1988
Add_Mouse_Page
GSyntax:H
#include <moustrap.h>
mouse_t Add_Mouse_Page(Page_Type, Top, Left, Bottom, Right);
mouse_t Page_Type; /* M_Text_Coord or */
/* M_Graphic_Coord */
Mouse_t Top;
mouse_t Left; /* Coordinates of corners */
mouse_t Bottom; /* of the page. */
mouse_t Right;
GDescription:H
Defines a new mouse page which is added to the system.
Page_Type tells if the corner points are given using text
coordinates (80x25) or Graphic coordinates (640x200). Coordinates
of Hot Spots for this page are also assumed to be given using that
system.
GReturn Value:H
Return a Page ID number, which is to be used to reference
this page in the future, or, MERROR if there was a problem, with
it's cause given in M_Error.
GH
GSee Also:H
Delete_Mouse_Page, Add_Mouse_Button, Add_Mouse_Hot_Spot
M_Error, Activate_Mouse_Page, DeActivate_Mouse_Page
GExample:H
See Chapter 4.
- Page 14 -
MouseTrap Library
September 21, 1988
Add_Mouse_Button
GSyntax:H
#include <moustrap.h>
mouse_t Add_Mouse_Button(Page_ID, Button, Return_Value);
mouse_t Page_ID;
mouse_t Button;
mouse_t Return_Value;
GH
GDescription:H
Add_Mouse_Button lets you tell the system how to react to a
certain button being pressed. Page_ID is the page which this
definition refers to, or if 0, the definition is valid in all pages.
Button is either M_Left, M_Right, or M_Center. If the Return_Value
is 0, it's assumed the Hot Spots are associated with this button in
this page. Otherwise, the Return_Value is any value the user wished
to assign. It's return by Read_Mouse and Get_Char_Mouse_Kbd if that
button is pressed while that page is active. In Overlaid mode, if
more than one page, with conflicting definitions, are active the
most recent Add_Mouse_Button has precedence. Any definition of a
particular Page/Button combination replaces any previous definition
of that combination.
GReturn Value:H
MNOERROR if there was no problem; otherwise
MERROR with the specific error given in M_Error
GH
GSee Also:H
M_Error, Add_Mouse_Page, Add_Mouse_Hot_Spot
GH
GExample:H
See Chapter 4.
- Page 15 -
MouseTrap Library
September 21, 1988
Add_Mouse_Hot_Spot
GSyntax:H
#include <moustrap.h>
mouse_t Add_Mouse_Hot_Spot(Page_ID, Button, Top, Left,
Bottom, Right, Return_Value);
mouse_t Page_ID;
mouse_t Button;
mouse_t Top; /* corner of the area */
mouse_t Left;
mouse_t Bottom;
mouse_t Right;
mouse_t Return_Value;
GDescription:H
Add_Mouse_Hot_Spot defines an area such that if the
appropriate Button is pressed while the mouse cursor is within the
area given while the page given by Page_ID is active, Read_Mouse
will return Return_Value. A maximum of 65535 hot spots can be
defined.
GReturn Value:H
An ID number for this hot spot, if there was no problem;
otherwise MERROR with the specific error given in M_Error.
GSee Also:H
M_Error, Delete_Mouse_Hot_Spot
GExample:H
See Chapter 4.
- Page 16 -
MouseTrap Library
September 21, 1988
Clear_All_Mouse_Definitions
GSyntax:H
#include <moustrap.h>
mouse_t Clear_All_Mouse_Definitions(void);
GH
GDescription:H
Erases everything. Removes all Page, Button, and Hot Spot
definitions. Reset various internal variables. Must be done before
switching between Single Page & Overlaid modes.
GReturn Value:H
MNOERROR if there was no problem; otherwise
MERROR with the specific error given in M_Error
GSee Also:H
M_Error, Define_Mouse_System
GExample:H
See Chapter 4.
- Page 17 -
MouseTrap Library
September 21, 1988
Clear_Mouse_Pages
GSyntax:H
#include <moustrap.h>
mouse_t Clear_Mouse_Pages(void);
GDescription:H
Deactivates all mouse pages. Hides cursors. Resets cursor
limits.
GReturn Value:H
MNOERROR if there was no problem; otherwise
MERROR with the specific error given in M_Error
GSee Also:H
M_Error, DeActivate_Mouse_Page, Activate_Mouse_Cursor
GExample:H
See Chapter 4.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -