Some stuff from the cookout during school. Old, I know.
This commit is contained in:
parent
cdd4d25fa5
commit
3aa8a4af8b
@ -77,4 +77,6 @@ namespace sharp
|
|||||||
void show();
|
void show();
|
||||||
void hide();
|
void hide();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
bool windows_intersect(const window_base& winA, const window_base& winB);
|
||||||
}
|
}
|
||||||
|
|||||||
31
src/sharpsoft/other_window_things.cpp
Normal file
31
src/sharpsoft/other_window_things.cpp
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
#define SHARPSOFT_INTERNAL
|
||||||
|
|
||||||
|
#include "sharpsoft/internal.hpp"
|
||||||
|
#include "sharpsoft/windowing.hpp"
|
||||||
|
|
||||||
|
using namespace sharp;
|
||||||
|
|
||||||
|
const sharp::window_styles sharp::window_styles::defaults =
|
||||||
|
{
|
||||||
|
color(0, 0, 0),
|
||||||
|
color(255, 255, 255)
|
||||||
|
};
|
||||||
|
|
||||||
|
bool sharp::windows_intersect(const window_base& winA, const window_base& winB)
|
||||||
|
{
|
||||||
|
// TODO: When I finish the header this'll change.
|
||||||
|
int winAMinX = winA.posX - 1, winAMaxX = winA.posX + winA.width + 2,
|
||||||
|
winAMinY = winA.posY - 1, winAMaxY = winA.posY + winA.height + 2,
|
||||||
|
winBMinX = winB.posX - 1, winBMaxX = winB.posX + winB.width + 2,
|
||||||
|
winBMinY = winB.posY - 1, winBMaxY = winB.posY + winB.height + 2;
|
||||||
|
|
||||||
|
// Killer IF statement but it works.
|
||||||
|
return (winAMinX >= winBMinX && winAMinX <= winBMaxX) || // winAMinX within winB
|
||||||
|
(winAMinY >= winBMinY && winAMinY <= winBMaxY) || // winAMinY within winB
|
||||||
|
(winAMaxX >= winBMinX && winAMaxX <= winBMaxX) || // winAMaxX within winB
|
||||||
|
(winAMaxY >= winBMinY && winAMaxY <= winBMaxY) || // winAMaxY within winB
|
||||||
|
(winBMinX >= winAMinX && winBMinX <= winAMaxX) || // winBMinX within winA
|
||||||
|
(winBMinY >= winAMinY && winBMinY <= winAMaxY) || // winBMinY within winA
|
||||||
|
(winBMaxX >= winAMinX && winBMaxX <= winAMaxX) || // winBMaxX within winA
|
||||||
|
(winBMaxY >= winAMinY && winBMaxY <= winAMaxY);
|
||||||
|
}
|
||||||
@ -6,12 +6,6 @@
|
|||||||
using std::string;
|
using std::string;
|
||||||
using namespace sharp;
|
using namespace sharp;
|
||||||
|
|
||||||
const sharp::window_styles sharp::window_styles::defaults =
|
|
||||||
{
|
|
||||||
color(0, 0, 0),
|
|
||||||
color(255, 255, 255)
|
|
||||||
};
|
|
||||||
|
|
||||||
sharp::window_base::window_base(const string& title, const int2& pos, const int2& size)
|
sharp::window_base::window_base(const string& title, const int2& pos, const int2& size)
|
||||||
{
|
{
|
||||||
this->title = title;
|
this->title = title;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user