📄 obj.cpp
字号:
//***********************************************************************// MODULE : Obj - Class Body *// AUTHOR : Ron Chernich *// PURPOSE: Class supporting geometric objects used by RCOS *// HISTORY: *// 18-JAN-93 First (MSC/C++ 7.00) version *//***********************************************************************#include "obj.hpp"/////////////// very simple little 'critta makes no real assumptions about anything//point::point (INT16 n1, INT16 n2){ x = n1, y = n2;}///////////////// Assignment operator//point& point::operator = (point &pt){ x = pt.x, y = pt.y; return *this;}//////////////// assuming THIS (lvalue) is the origin,// RETURNS: TRUE .. point lies in second quadrent or on an axis boundary// FALSE .. point (rvalue) lies inside other three quadrents//BOOL point::operator >= (point &pt){ return (BOOL)((x >= pt.x) && (y >= pt.y));}//////////////// assuming THIS (lvalue) is the origin,// RETURNS: TRUE .. point on bounding axis or inside quadrents 1, 3 or 4// FALSE .. point (rvalue) lies inside second quadrent//BOOL point::operator <= (point &pt){ return (BOOL)((x <= pt.x) && (y <= pt.y));}void point::MovePt (INT16 n1, INT16 n2){ x = n1, y = n2;}///////////////////// Rectangle constructors with args..//rect::rect (point &pt1, point &pt2){ ul = pt1, lr = pt2;}rect::rect (point &pt1, INT16 n1, INT16 n2){ point pt2(n1, n2); ul = pt1, lr = pt2;}rect::rect (INT16 n1, INT16 n2, INT16 n3, INT16 n4){ point pt1(n1, n2), pt2(n3, n4); ul = pt1, lr = pt2;}///////////////////// RETURNS: TRUE if passed point is within the rectangle//BOOL rect::InRect (point &pt){ return (BOOL)((pt >= ul) && (pt <= lr));}/************************************ EOF ********************************/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -