GlistEngine
Loading...
Searching...
No Matches
gRect.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2016 Nitra Games Ltd.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef GRAPHICS_GRECT_H_
18#define GRAPHICS_GRECT_H_
19
20
27class gRect {
28public:
40 gRect(int left, int top, int right, int bottom);
45 gRect(const gRect& r);
46 virtual ~gRect();
47
52 int centerX() const;
57 int centerY() const;
62 float exactCenterX() const;
67 float exactCenterY() const;
68
76 void set(int left, int top, int right, int bottom);
81 void set(const gRect& r);
82
95 static bool intersects(int left1, int top1, int right1, int bottom1, int left2, int top2, int right2, int bottom2);
102 static bool intersects(const gRect& r1, const gRect& r2);
111 bool intersects(int left, int top, int right, int bottom) const;
117 bool intersects(const gRect& r) const;
118
131 static bool contains(int left1, int top1, int right1, int bottom1, int left2, int top2, int right2, int bottom2);
138 static bool contains(const gRect& r1, const gRect& r2);
147 bool contains(int left, int top, int right, int bottom) const;
153 bool contains(const gRect& r) const;
160 bool contains(int x, int y) const;
161
166 int left() const;
171 int top() const;
176 int right() const;
181 int bottom() const;
186 int getWidth() const;
191 int getHeight() const;
195 void moveX(int speedX);
199 void moveY(int speedY);
203 void moveX(float speedX);
207 void moveY(float speedY);
208private:
209 int l, r, t, b;
210 int width, height;
211};
212
213#endif /* GRAPHICS_GRECT_H_ */
Definition gRect.h:27
static bool intersects(const gRect &r1, const gRect &r2)
static bool intersects(int left1, int top1, int right1, int bottom1, int left2, int top2, int right2, int bottom2)
void set(const gRect &r)
bool intersects(int left, int top, int right, int bottom) const
bool contains(const gRect &r) const
gRect(int left, int top, int right, int bottom)
virtual ~gRect()
int right() const
int left() const
void moveY(int speedY)
gRect(const gRect &r)
void moveY(float speedY)
bool contains(int x, int y) const
float exactCenterY() const
bool contains(int left, int top, int right, int bottom) const
int centerX() const
void moveX(float speedX)
void set(int left, int top, int right, int bottom)
int bottom() const
int getWidth() const
int centerY() const
static bool contains(int left1, int top1, int right1, int bottom1, int left2, int top2, int right2, int bottom2)
void moveX(int speedX)
float exactCenterX() const
bool intersects(const gRect &r) const
int top() const
static bool contains(const gRect &r1, const gRect &r2)
int getHeight() const