Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- #include "MyFilledRectangle.h"
- #include "CImgGIP06.h"
- MyFilledRectangle::MyFilledRectangle(int px1, int py1, int px2, int py2)
- {
- x1 = px1;
- y1 = py1;
- x2 = px2;
- y2 = py2;
- }
- void MyFilledRectangle::draw() const{
- MyRectangle::draw();
- int width = x2 - x1;
- int height = y2 - y1;
- if ((width > 4) and (height > 4))
- {
- //gip_draw_line()
- for (int line = (y1 +2); line <= (y2 -2); line++)
- {
- gip_draw_line(x1 +2, line, x2-2, line, red);
- }
- }
- }
- bool MyFilledRectangle::does_not_collide_with(const MyFilledRectangle& other) const
- {
- return x1 > other.x2 || x2 < other.x1 || y1 > other.y2 || y2 < other.y1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement