PageRenderTime 58ms CodeModel.GetById 33ms app.highlight 19ms RepoModel.GetById 2ms app.codeStats 0ms

/indra/llmath/llcoord.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 105 lines | 59 code | 15 blank | 31 comment | 16 complexity | 499bc2d79b30ba70071194378eb89a9e MD5 | raw file
  1/** 
  2 * @file llcoord.h
  3 *
  4 * $LicenseInfo:firstyear=2001&license=viewerlgpl$
  5 * Second Life Viewer Source Code
  6 * Copyright (C) 2010, Linden Research, Inc.
  7 * 
  8 * This library is free software; you can redistribute it and/or
  9 * modify it under the terms of the GNU Lesser General Public
 10 * License as published by the Free Software Foundation;
 11 * version 2.1 of the License only.
 12 * 
 13 * This library is distributed in the hope that it will be useful,
 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 16 * Lesser General Public License for more details.
 17 * 
 18 * You should have received a copy of the GNU Lesser General Public
 19 * License along with this library; if not, write to the Free Software
 20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 21 * 
 22 * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
 23 * $/LicenseInfo$
 24 */
 25
 26#ifndef LL_LLCOORD_H
 27#define LL_LLCOORD_H
 28
 29// A two-dimensional pixel value
 30class LLCoord
 31{
 32public:
 33	S32		mX;
 34	S32		mY;
 35
 36	LLCoord():	mX(0), mY(0)
 37	{}
 38	LLCoord(S32 x, S32 y): mX(x), mY(y)
 39	{}
 40	virtual ~LLCoord()
 41	{}
 42
 43	virtual void set(S32 x, S32 y)		{ mX = x; mY = y; }
 44};
 45
 46
 47// GL coordinates start in the client region of a window,
 48// with left, bottom = 0, 0
 49class LLCoordGL : public LLCoord
 50{
 51public:
 52	LLCoordGL() : LLCoord()
 53	{}
 54	LLCoordGL(S32 x, S32 y) : LLCoord(x, y)
 55	{}
 56	bool operator==(const LLCoordGL& other) const { return mX == other.mX && mY == other.mY; }
 57	bool operator!=(const LLCoordGL& other) const { return !(*this == other); }
 58};
 59
 60//bool operator ==(const LLCoordGL& a, const LLCoordGL& b);
 61
 62// Window coords include things like window borders,
 63// menu regions, etc.
 64class LLCoordWindow : public LLCoord
 65{
 66public:
 67	LLCoordWindow() : LLCoord()
 68	{}
 69	LLCoordWindow(S32 x, S32 y) : LLCoord(x, y)
 70	{}
 71	bool operator==(const LLCoordWindow& other) const { return mX == other.mX && mY == other.mY; }
 72	bool operator!=(const LLCoordWindow& other) const { return !(*this == other); }
 73};
 74
 75
 76// Screen coords start at left, top = 0, 0
 77class LLCoordScreen : public LLCoord
 78{
 79public:
 80	LLCoordScreen() : LLCoord()
 81	{}
 82	LLCoordScreen(S32 x, S32 y) : LLCoord(x, y)
 83	{}
 84	bool operator==(const LLCoordScreen& other) const { return mX == other.mX && mY == other.mY; }
 85	bool operator!=(const LLCoordScreen& other) const { return !(*this == other); }
 86};
 87
 88class LLCoordFont : public LLCoord
 89{
 90public:
 91	F32 mZ;
 92	
 93	LLCoordFont() : LLCoord(), mZ(0.f)
 94	{}
 95	LLCoordFont(S32 x, S32 y, F32 z = 0) : LLCoord(x,y), mZ(z)
 96	{}
 97	
 98	void set(S32 x, S32 y) { LLCoord::set(x,y); mZ = 0.f; }
 99	void set(S32 x, S32 y, F32 z) { mX = x; mY = y; mZ = z; }
100	bool operator==(const LLCoordFont& other) const { return mX == other.mX && mY == other.mY; }
101	bool operator!=(const LLCoordFont& other) const { return !(*this == other); }
102};
103	
104
105#endif